@markjaquith/agency 2.41.0 → 2.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -51,7 +51,7 @@ workbase/
51
51
  .agency/
52
52
  AGENTS.md # managed Agency instructions
53
53
  .opencode/
54
- opencode.jsonc # managed instructions and whole-workbase reference
54
+ opencode.jsonc # managed @agency subagent, instructions, and reference
55
55
  agency.json # tracked config and portable repository declarations
56
56
  repos/ # ignored local materializations
57
57
  frontend/ # bare Git repository or symlink
@@ -90,11 +90,14 @@ Agency-managed root `AGENTS.md` to `.agency/AGENTS.md` once the OpenCode config
90
90
  can load the hidden file. A customized root file, including a symlink, is
91
91
  preserved as user-owned content.
92
92
 
93
- The OpenCode config loads Agency's hidden instructions in addition to any
94
- user-owned root `AGENTS.md` and advertises the complete workbase as one portable
95
- reference. OpenCode discovers that config from task and epic launch directories.
96
- Agents receive whole-workbase visibility from that reference. Bash and Agency
97
- operations must still follow the write authority reported by `agency context`.
93
+ The OpenCode config defines an `@agency` subagent for delegated workbase
94
+ orchestration, loads Agency's hidden instructions in addition to any user-owned
95
+ root `AGENTS.md`, advertises the complete workbase as one portable reference,
96
+ and replaces the built-in Plan agent with `agency-plan`. That planning agent can
97
+ update `TASK.md`, `PHASE.md`, and `EPIC.md` while other edits remain disabled.
98
+ OpenCode discovers the config from task and epic launch directories. Agents
99
+ receive whole-workbase visibility from that reference. Bash and Agency operations
100
+ must still follow the write authority reported by `agency context`.
98
101
 
99
102
  OpenCode also discovers a managed `/agency` command. Use `/agency status` for a
100
103
  read-only current-work summary, `/agency start [target]` to begin or resume work
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markjaquith/agency",
3
- "version": "2.41.0",
3
+ "version": "2.43.0",
4
4
  "description": "Manage agentic work across repositories with durable workbases",
5
5
  "keywords": [
6
6
  "agents",
package/src/cli.test.ts CHANGED
@@ -1059,13 +1059,32 @@ status: open
1059
1059
  env: environment,
1060
1060
  })
1061
1061
  expect(configProbe.exitCode).toBe(0)
1062
- expect(JSON.parse(configProbe.stdout.toString()).references).toEqual({
1062
+ const effectiveConfig = JSON.parse(configProbe.stdout.toString())
1063
+ expect(effectiveConfig.agent.agency).toMatchObject({
1064
+ description: expect.stringContaining(
1065
+ "Agency workbase orchestration",
1066
+ ),
1067
+ mode: "subagent",
1068
+ })
1069
+ expect(effectiveConfig.references).toEqual({
1063
1070
  workbase: {
1064
1071
  path: "..",
1065
1072
  description:
1066
1073
  "Complete Agency workbase context; write authority still comes only from agency context",
1067
1074
  },
1068
1075
  })
1076
+ const agencyProbe = Bun.spawnSync(
1077
+ ["opencode", "debug", "agent", "agency"],
1078
+ { cwd: contract.cwd, env: environment },
1079
+ )
1080
+ expect(agencyProbe.exitCode).toBe(0)
1081
+ expect(JSON.parse(agencyProbe.stdout.toString())).toMatchObject({
1082
+ name: "agency",
1083
+ description: expect.stringContaining(
1084
+ "Agency workbase orchestration",
1085
+ ),
1086
+ mode: "subagent",
1087
+ })
1069
1088
  for (const document of documents) {
1070
1089
  const read = Bun.spawnSync(
1071
1090
  [
@@ -40,6 +40,23 @@ describe("init command", () => {
40
40
  ).text()
41
41
  const config = JSON.parse(opencode.slice(opencode.indexOf("\n\n") + 2))
42
42
  expect(config.instructions).toEqual([".agency/AGENTS.md"])
43
+ expect(config.agent.agency).toMatchObject({
44
+ description: expect.stringContaining("Agency workbase orchestration"),
45
+ mode: "subagent",
46
+ prompt: expect.stringContaining("agency context . --json"),
47
+ })
48
+ expect(config.agent.plan).toEqual({ disable: true })
49
+ expect(config.agent["agency-plan"]).toMatchObject({
50
+ mode: "primary",
51
+ permission: {
52
+ edit: {
53
+ "*": "deny",
54
+ "tasks/*/TASK.md": "allow",
55
+ "tasks/*/phases/*/PHASE.md": "allow",
56
+ "epics/*/EPIC.md": "allow",
57
+ },
58
+ },
59
+ })
43
60
  expect(config.references).toEqual({
44
61
  workbase: expect.objectContaining({ path: ".." }),
45
62
  })
@@ -138,10 +138,40 @@ describe("IntegrationService", () => {
138
138
  expect(body).toContain(".opencode/command/agency.md")
139
139
  })
140
140
 
141
- test("grants OpenCode access to the complete workbase", () => {
141
+ test("configures Agency agents with complete workbase access", () => {
142
142
  const config = JSON.parse(managedBody(managedWorkbaseOpencode))
143
143
 
144
144
  expect(config.instructions).toEqual([".agency/AGENTS.md"])
145
+ expect(config.agent).toEqual({
146
+ agency: {
147
+ description:
148
+ "Handles Agency workbase orchestration and workflow operations with the Agency CLI",
149
+ mode: "subagent",
150
+ prompt: expect.stringContaining("agency context . --json"),
151
+ },
152
+ plan: {
153
+ disable: true,
154
+ },
155
+ "agency-plan": {
156
+ description:
157
+ "Agency planning mode. May edit only Agency planning documents.",
158
+ mode: "primary",
159
+ prompt: expect.stringContaining("You are in Agency Plan mode"),
160
+ permission: {
161
+ question: "allow",
162
+ edit: {
163
+ "*": "deny",
164
+ "tasks/*/TASK.md": "allow",
165
+ "tasks/*/phases/*/PHASE.md": "allow",
166
+ "epics/*/EPIC.md": "allow",
167
+ },
168
+ },
169
+ },
170
+ })
171
+ expect(config.agent.agency.model).toBeUndefined()
172
+ expect(config.agent.agency.permission).toBeUndefined()
173
+ expect(config.agent.agency.hidden).toBeUndefined()
174
+ expect(config.agent.agency.steps).toBeUndefined()
145
175
  expect(config.references).toEqual({
146
176
  workbase: {
147
177
  path: "..",
@@ -6,11 +6,42 @@ const managedHeaderPattern =
6
6
  const checksum = (content: string) =>
7
7
  createHash("sha256").update(content).digest("hex")
8
8
 
9
+ const agencyPlanPrompt = `You are in Agency Plan mode. Think, read, search, and delegate exploration to construct a well-formed plan for the user's goal. Keep the plan comprehensive but concise, and ask clarifying questions when important tradeoffs or intent are unclear.
10
+
11
+ You may edit TASK.md, PHASE.md, and EPIC.md to record the outcome, current approach, and important decisions. Do not edit any other file or use shell commands to modify the system.`
12
+
9
13
  const body = () =>
10
14
  `${JSON.stringify(
11
15
  {
12
16
  $schema: "https://opencode.ai/config.json",
13
17
  instructions: [".agency/AGENTS.md"],
18
+ agent: {
19
+ agency: {
20
+ description:
21
+ "Handles Agency workbase orchestration and workflow operations with the Agency CLI",
22
+ mode: "subagent",
23
+ prompt:
24
+ "You are the Agency workflow specialist. Use the Agency CLI to handle delegated workbase orchestration and workflow operations. Always start with `agency context . --json`, follow the managed Agency instructions and reported authority, use Agency commands for durable mutations, and report the resulting state concisely.",
25
+ },
26
+ plan: {
27
+ disable: true,
28
+ },
29
+ "agency-plan": {
30
+ description:
31
+ "Agency planning mode. May edit only Agency planning documents.",
32
+ mode: "primary",
33
+ prompt: agencyPlanPrompt,
34
+ permission: {
35
+ question: "allow",
36
+ edit: {
37
+ "*": "deny",
38
+ "tasks/*/TASK.md": "allow",
39
+ "tasks/*/phases/*/PHASE.md": "allow",
40
+ "epics/*/EPIC.md": "allow",
41
+ },
42
+ },
43
+ },
44
+ },
14
45
  references: {
15
46
  workbase: {
16
47
  path: "..",