opencode-agile-agent 1.2.0 → 1.2.1

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.
Files changed (65) hide show
  1. package/README.md +75 -12
  2. package/bin/cli.js +179 -25
  3. package/bin/validate-templates.js +17 -17
  4. package/package.json +1 -1
  5. package/templates/.opencode/ARCHITECTURE.md +90 -66
  6. package/templates/.opencode/README.md +107 -65
  7. package/templates/.opencode/agents/archiver.md +45 -0
  8. package/templates/.opencode/agents/backend-specialist.md +11 -23
  9. package/templates/.opencode/agents/context-gatherer.md +18 -29
  10. package/templates/.opencode/agents/debugger.md +12 -21
  11. package/templates/.opencode/agents/developer.md +22 -26
  12. package/templates/.opencode/agents/devops-engineer.md +10 -21
  13. package/templates/.opencode/agents/feature-lead.md +53 -34
  14. package/templates/.opencode/agents/frontend-specialist.md +12 -22
  15. package/templates/.opencode/agents/performance-optimizer.md +12 -21
  16. package/templates/.opencode/agents/pr-reviewer.md +17 -34
  17. package/templates/.opencode/agents/project-planner.md +9 -22
  18. package/templates/.opencode/agents/retrospective-writer.md +48 -0
  19. package/templates/.opencode/agents/security-auditor.md +9 -22
  20. package/templates/.opencode/agents/system-analyst.md +16 -25
  21. package/templates/.opencode/agents/test-engineer.md +14 -21
  22. package/templates/.opencode/bun.lock +18 -0
  23. package/templates/.opencode/commands/archive.md +15 -0
  24. package/templates/.opencode/commands/assign-models.md +39 -0
  25. package/templates/.opencode/commands/brainstorm.md +5 -2
  26. package/templates/.opencode/commands/{progress.md → check-progress.md} +2 -1
  27. package/templates/.opencode/commands/create.md +8 -3
  28. package/templates/.opencode/commands/plan.md +6 -1
  29. package/templates/.opencode/commands/review.md +9 -3
  30. package/templates/.opencode/commands/status.md +3 -0
  31. package/templates/.opencode/commands/test.md +8 -3
  32. package/templates/.opencode/config.template.json +116 -20
  33. package/templates/.opencode/package.json +6 -0
  34. package/templates/.opencode/plugins/session-artifacts.ts +611 -0
  35. package/templates/.opencode/skills/archive-writing/SKILL.md +36 -0
  36. package/templates/.opencode/skills/artifact-discipline/SKILL.md +30 -0
  37. package/templates/.opencode/skills/clarify-first/SKILL.md +34 -0
  38. package/templates/.opencode/skills/context-archive/SKILL.md +10 -26
  39. package/templates/.opencode/skills/context-gathering/SKILL.md +2 -0
  40. package/templates/.opencode/skills/intelligent-routing/SKILL.md +10 -2
  41. package/templates/.opencode/templates/brief.template.md +10 -5
  42. package/templates/.opencode/templates/notes.template.md +4 -4
  43. package/templates/.opencode/templates/review-summary.template.md +6 -0
  44. package/templates/.opencode/templates/session-summary.template.md +7 -0
  45. package/templates/.opencode/templates/spec.template.md +6 -6
  46. package/templates/.opencode/templates/status.template.yaml +12 -12
  47. package/templates/.opencode/templates/task.template.md +3 -11
  48. package/templates/opencode.json +12 -0
  49. package/templates/.opencode/agents/api-designer.md +0 -54
  50. package/templates/.opencode/agents/code-archaeologist.md +0 -54
  51. package/templates/.opencode/agents/database-architect.md +0 -54
  52. package/templates/.opencode/agents/documentation-writer.md +0 -52
  53. package/templates/.opencode/agents/explorer-agent.md +0 -61
  54. package/templates/.opencode/agents/feature-loop.md +0 -100
  55. package/templates/.opencode/agents/game-developer.md +0 -53
  56. package/templates/.opencode/agents/mobile-developer.md +0 -54
  57. package/templates/.opencode/agents/orchestrator.md +0 -60
  58. package/templates/.opencode/agents/penetration-tester.md +0 -53
  59. package/templates/.opencode/agents/product-manager.md +0 -55
  60. package/templates/.opencode/agents/qa-automation-engineer.md +0 -55
  61. package/templates/.opencode/agents/seo-specialist.md +0 -54
  62. package/templates/.opencode/archive/README.md +0 -24
  63. package/templates/.opencode/commands/debug.md +0 -10
  64. package/templates/.opencode/skills/parallel-agents/SKILL.md +0 -38
  65. package/templates/.opencode/skills/redteam-validation/SKILL.md +0 -33
package/README.md CHANGED
@@ -7,10 +7,53 @@ Scaffold the OpenCode spec-driven agent kit into any project with one confirmati
7
7
  - `npx opencode-agile-agent@latest`
8
8
  - `npx create-opencode-agile`
9
9
 
10
+ ## Example Command Flow
11
+
12
+ ### Start a new project
13
+ 1. Run `npx opencode-agile-agent` inside the repo you want to set up.
14
+ 2. Ask the main agent to clarify the project direction first.
15
+ 3. Use `/brainstorm` if the idea is still fuzzy.
16
+ 4. Use `/plan` once the scope is clear enough to turn into `brief.md`, `spec.md`, `task.md`, `notes.md`, and `status.yaml`.
17
+ 5. Use `/create` when you want the first implementation pass to begin.
18
+ 6. Use `/test` and `/review` before considering the first slice done.
19
+ 7. Use `/archive` when the finished slice is approved and worth preserving as a summary.
20
+
21
+ Example:
22
+ ```text
23
+ /brainstorm build a small SaaS app for tracking invoices for freelancers
24
+ /plan turn this into an MVP with auth, invoice CRUD, and dashboard
25
+ /create implement the MVP from the approved plan
26
+ /test cover the critical flows
27
+ /review check if this is safe to ship
28
+ /archive summarize what shipped in the approved MVP slice
29
+ ```
30
+
31
+ ### Start a new feature in an existing project
32
+ 1. Start with `/brainstorm` if the request is ambiguous.
33
+ 2. Use `/plan` to define the feature boundary and acceptance criteria.
34
+ 3. Use `/create` to implement the approved feature slice.
35
+ 4. Use `/test` to verify behavior and nearby paths.
36
+ 5. Use `/review` for the final quality gate.
37
+ 6. Use `/archive` after approval to store a finished work summary.
38
+ 7. Use `/status` anytime you want a compact progress snapshot.
39
+
40
+ Example:
41
+ ```text
42
+ /plan add team invitations with email, role selection, and acceptance flow
43
+ /create implement the invitations feature
44
+ /test verify invite creation, email sending, and acceptance flow
45
+ /review check for regressions, dead code, and spec drift
46
+ /archive summarize the approved invitations slice
47
+ ```
48
+
10
49
  ## Install Flow
11
50
  - The installer asks one yes/no question.
12
51
  - Framework, language, and project name are auto-detected.
13
- - Confirmed installs copy `.opencode` into the current project root and generate `AGENTS.md` there.
52
+ - Confirmed installs merge `.opencode` into the current project root instead of replacing it.
53
+ - If `templates/opencode.json` exists, the installer also creates or merges `opencode.json` in the project root.
54
+ - If the project already uses `opencode.jsonc` (and not `opencode.json`), the installer skips config installation to avoid creating a competing config file.
55
+ - Missing files are created. Existing `.md`, `.txt`, and `.gitignore` files receive appended template content when it is not already present.
56
+ - Existing `.json` files are merged key-wise without clobbering existing values. Other structured files like `.ts` and `.yaml` are left in place and are not overwritten.
14
57
  - Declining exits immediately.
15
58
 
16
59
  ## Local Install
@@ -18,33 +61,53 @@ Scaffold the OpenCode spec-driven agent kit into any project with one confirmati
18
61
  - The installer writes to the current working directory, not the package directory.
19
62
 
20
63
  ## What Gets Installed
21
- - 26 agents
22
- - 14 skills
23
- - 10 commands
64
+ - 15 agents
65
+ - 15 skills
66
+ - 11 commands
67
+ - 1 runtime plugin
24
68
  - Shared rules, docs, and project config
25
69
 
70
+ ## Plannotator Integration
71
+
72
+ - The template includes `templates/opencode.json` with `@plannotator/opencode@latest` configured.
73
+ - With Plannotator enabled, `/plan` will use `submit_plan` (when available) to open a browser UI for plan approval and feedback.
74
+
26
75
  ## Custom Commands
27
76
  - `.opencode/commands/*.md` holds the slash commands.
28
77
  - Each command uses Markdown frontmatter plus a prompt body, matching OpenCode's command format.
29
- - The command set is `brainstorm`, `create`, `debug`, `plan`, `progress`, `reframe`, `review`, `rubber-duck`, `status`, and `test`.
78
+ - The command set is `archive`, `assign-models`, `brainstorm`, `check-progress`, `create`, `plan`, `reframe`, `review`, `rubber-duck`, `status`, and `test`.
30
79
 
31
80
  ## Design Notes
32
81
  - Skills are compact, philosophy-first, and loaded by intent.
33
- - `security-gate` decides when a change needs a security gate or redteam phase.
34
- - `redteam-validation` simulates attacker behavior and proves exploitability.
35
- - `qa-automation-engineer` is support-only for harness and CI plumbing, not the default test path.
36
- - `orchestrator` is optional; default routing stays with `feature-lead` and the owning specialists.
82
+ - `artifact-discipline` and `clean-code` are the core quality spine.
83
+ - `session-artifacts` is the runtime spine that preserves active feature state and safe handoffs.
84
+ - `retrospective-writer` captures reusable lessons from real failures and asks whether they should become a skill or rule.
85
+ - `archiver` is a dedicated archive-summary agent, not just a final step bolted onto the lead.
86
+ - `session_artifact_repo_delta` guards summaries and reviews against drift from the real git state.
37
87
  - The compact planning bundle is brief.md, spec.md, task.md, notes.md, and status.yaml.
38
88
  - `@feature-lead` is the primary entry point; the rest are subagents.
39
- - Completed feature bundles are archived in `.opencode/archive/<feature-slug>/`.
89
+ - `.opencode/artifacts/` is local runtime state and is git-ignored by the installed template.
90
+ - Completed work summaries are archived in `.opencode/archive/<feature-slug>.md`.
91
+
92
+ ## Flow Notes
93
+ - The default command spine is `/brainstorm -> /plan -> /create -> /test -> /review -> /archive`.
94
+ - The flow is not rigid. You can reuse commands mid-stream when the work needs them.
95
+ - Examples:
96
+ - `/brainstorm` again when implementation reveals ambiguity.
97
+ - `/plan` again when scope changes materially.
98
+ - `/test` on an intermediate risky slice.
99
+ - `/review` before the whole feature is finished.
100
+ - `/archive` for one completed slice while larger work continues.
40
101
 
41
102
  ## Spec-Driven Flow
42
103
  - `@feature-lead` is the primary entry point.
104
+ - `session_artifact_current` restores active feature state before deeper work.
43
105
  - `@context-gatherer` maps the current project before any planning or proof.
44
106
  - `@project-planner` and `@system-analyst` build `brief.md`, `spec.md`, `task.md`, `notes.md`, and `status.yaml`.
45
107
  - `@developer` implements the approved spec.
46
- - `@test-engineer`, `@security-auditor`, `@penetration-tester`, and `@pr-reviewer` close the loop.
47
- - `@feature-lead` archives the completed bundle in `.opencode/archive/<feature-slug>/`.
108
+ - `@test-engineer`, `@retrospective-writer`, `@security-auditor`, and `@pr-reviewer` close the loop.
109
+ - When a resolved failure exposes a durable lesson, ask whether to promote it into a reusable skill or rule.
110
+ - `@feature-lead` archives the completed work summary in `.opencode/archive/<feature-slug>.md` through the artifact finalizer.
48
111
 
49
112
  ## Template Source Of Truth
50
113
  - `templates/.opencode` mirrors the project kit.
package/bin/cli.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { fileURLToPath } from 'url';
4
- import { dirname, join, sep } from 'path';
5
- import { existsSync, mkdirSync, cpSync, rmSync } from 'fs';
6
- import { createInterface } from 'readline';
3
+ import { fileURLToPath } from 'url';
4
+ import { dirname, extname, join, sep } from 'path';
5
+ import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'fs';
6
+ import { createInterface } from 'readline';
7
7
 
8
8
  const __filename = fileURLToPath(import.meta.url);
9
9
  const __dirname = dirname(__filename);
@@ -45,17 +45,18 @@ const question = (prompt) => new Promise((resolve) => {
45
45
  rl.question(prompt, resolve);
46
46
  });
47
47
 
48
- const args = process.argv.slice(2);
49
- if (args.includes('--help') || args.includes('-h')) {
50
- console.log(`
51
- OpenCode Agile Agent Installer
48
+ const args = process.argv.slice(2);
49
+ if (args.includes('--help') || args.includes('-h')) {
50
+ console.log(`
51
+ OpenCode Agile Agent Installer
52
52
 
53
53
  Usage:
54
54
  opencode-agile-agent
55
55
 
56
56
  What it does:
57
57
  - Asks one yes/no question.
58
- - Copies .opencode into the current project.
58
+ - Merges .opencode into the current project.
59
+ - Optionally merges opencode.json into the project root.
59
60
 
60
61
  Commands:
61
62
  --help, -h Show this help message
@@ -64,9 +65,166 @@ Commands:
64
65
  process.exit(0);
65
66
  }
66
67
 
67
- function shouldCopyPath(path) {
68
- return !path.includes(`${sep}node_modules${sep}`) && !path.endsWith(`${sep}node_modules`);
69
- }
68
+ function shouldCopyPath(path) {
69
+ return !path.includes(`${sep}node_modules${sep}`) && !path.endsWith(`${sep}node_modules`);
70
+ }
71
+
72
+ function isAppendableTextFile(path) {
73
+ return path.endsWith('.md') || path.endsWith('.txt') || path.endsWith('.gitignore');
74
+ }
75
+
76
+ function isJsonFile(path) {
77
+ return extname(path) === '.json';
78
+ }
79
+
80
+ function appendUniqueContent(targetPath, sourceContent) {
81
+ const targetContent = readFileSync(targetPath, 'utf8');
82
+ const trimmedSource = sourceContent.trim();
83
+ if (!trimmedSource || targetContent.includes(trimmedSource)) {
84
+ return 'skipped';
85
+ }
86
+
87
+ const nextContent = `${targetContent.trimEnd()}\n\n${trimmedSource}\n`;
88
+ writeFileSync(targetPath, nextContent);
89
+ return 'appended';
90
+ }
91
+
92
+ function isPlainObject(value) {
93
+ return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
94
+ }
95
+
96
+ function mergeJsonValues(targetValue, sourceValue) {
97
+ if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
98
+ const seen = new Set(targetValue.map((item) => JSON.stringify(item)));
99
+ const merged = [...targetValue];
100
+ for (const item of sourceValue) {
101
+ const key = JSON.stringify(item);
102
+ if (!seen.has(key)) {
103
+ seen.add(key);
104
+ merged.push(item);
105
+ }
106
+ }
107
+ return merged;
108
+ }
109
+
110
+ if (isPlainObject(targetValue) && isPlainObject(sourceValue)) {
111
+ const merged = { ...sourceValue };
112
+ for (const [key, value] of Object.entries(targetValue)) {
113
+ if (Object.prototype.hasOwnProperty.call(sourceValue, key)) {
114
+ merged[key] = mergeJsonValues(value, sourceValue[key]);
115
+ } else {
116
+ merged[key] = value;
117
+ }
118
+ }
119
+ return merged;
120
+ }
121
+
122
+ return targetValue;
123
+ }
124
+
125
+ function mergeJsonFile(targetPath, sourceContent) {
126
+ try {
127
+ const sourceJson = JSON.parse(sourceContent);
128
+ const targetJson = JSON.parse(readFileSync(targetPath, 'utf8'));
129
+ const merged = mergeJsonValues(targetJson, sourceJson);
130
+ const nextContent = `${JSON.stringify(merged, null, 2)}\n`;
131
+ if (nextContent === readFileSync(targetPath, 'utf8')) {
132
+ return 'skipped';
133
+ }
134
+ writeFileSync(targetPath, nextContent);
135
+ return 'merged';
136
+ } catch {
137
+ return 'skipped';
138
+ }
139
+ }
140
+
141
+ function mergeDirectory(sourceDir, targetDir, stats) {
142
+ if (!existsSync(targetDir)) {
143
+ mkdirSync(targetDir, { recursive: true });
144
+ }
145
+
146
+ for (const entry of readdirSync(sourceDir, { withFileTypes: true })) {
147
+ const sourcePath = join(sourceDir, entry.name);
148
+ const targetPath = join(targetDir, entry.name);
149
+
150
+ if (!shouldCopyPath(sourcePath)) {
151
+ continue;
152
+ }
153
+
154
+ if (entry.isDirectory()) {
155
+ mergeDirectory(sourcePath, targetPath, stats);
156
+ continue;
157
+ }
158
+
159
+ if (!entry.isFile()) {
160
+ continue;
161
+ }
162
+
163
+ if (!existsSync(targetPath)) {
164
+ writeFileSync(targetPath, readFileSync(sourcePath));
165
+ stats.created += 1;
166
+ continue;
167
+ }
168
+
169
+ if (!statSync(targetPath).isFile()) {
170
+ stats.skipped += 1;
171
+ continue;
172
+ }
173
+
174
+ if (isJsonFile(sourcePath)) {
175
+ const result = mergeJsonFile(targetPath, readFileSync(sourcePath, 'utf8'));
176
+ if (result === 'merged') {
177
+ stats.appended += 1;
178
+ } else {
179
+ stats.skipped += 1;
180
+ }
181
+ continue;
182
+ }
183
+
184
+ if (!isAppendableTextFile(sourcePath)) {
185
+ stats.skipped += 1;
186
+ continue;
187
+ }
188
+
189
+ const result = appendUniqueContent(targetPath, readFileSync(sourcePath, 'utf8'));
190
+ if (result === 'appended') {
191
+ stats.appended += 1;
192
+ } else {
193
+ stats.skipped += 1;
194
+ }
195
+ }
196
+ }
197
+
198
+ function mergeProjectConfig(templatesDir, projectRoot, stats) {
199
+ const sourceConfig = join(templatesDir, 'opencode.json');
200
+ if (!existsSync(sourceConfig) || !statSync(sourceConfig).isFile()) {
201
+ return;
202
+ }
203
+
204
+ const targetJson = join(projectRoot, 'opencode.json');
205
+ const targetJsonc = join(projectRoot, 'opencode.jsonc');
206
+ if (!existsSync(targetJson) && existsSync(targetJsonc)) {
207
+ // Avoid generating a second competing config file in repos that already
208
+ // use JSONC. Ask the user to merge manually.
209
+ stats.skipped += 1;
210
+ log.warn('Found opencode.jsonc. Skipping opencode.json install; merge templates/opencode.json manually if desired.');
211
+ return;
212
+ }
213
+
214
+ const sourceContent = readFileSync(sourceConfig, 'utf8');
215
+ if (!existsSync(targetJson)) {
216
+ writeFileSync(targetJson, sourceContent);
217
+ stats.created += 1;
218
+ return;
219
+ }
220
+
221
+ const result = mergeJsonFile(targetJson, sourceContent);
222
+ if (result === 'merged') {
223
+ stats.appended += 1;
224
+ } else {
225
+ stats.skipped += 1;
226
+ }
227
+ }
70
228
 
71
229
  async function install() {
72
230
  console.log(banner);
@@ -89,20 +247,16 @@ async function install() {
89
247
  return;
90
248
  }
91
249
 
92
- if (!existsSync(target)) {
93
- mkdirSync(target, { recursive: true });
94
- } else {
95
- rmSync(target, { recursive: true, force: true });
96
- mkdirSync(target, { recursive: true });
97
- }
98
-
99
- cpSync(source, target, {
100
- recursive: true,
101
- overwrite: true,
102
- filter: shouldCopyPath,
103
- });
250
+ if (!existsSync(target)) {
251
+ mkdirSync(target, { recursive: true });
252
+ }
253
+
254
+ const stats = { created: 0, appended: 0, skipped: 0 };
255
+ mergeDirectory(source, target, stats);
256
+ mergeProjectConfig(templatesDir, projectRoot, stats);
104
257
 
105
- log.success('Installed .opencode.');
258
+ log.success('Installed .opencode in merge mode.');
259
+ log.info(`Created ${stats.created} files, appended ${stats.appended} text files, skipped ${stats.skipped} existing files.`);
106
260
  log.title('Done');
107
261
  console.log('Start with @feature-lead and add or update AGENTS.md manually if your repo needs one.');
108
262
 
@@ -10,57 +10,57 @@ const templatesDir = join(__dirname, '..', 'templates');
10
10
 
11
11
  // Required files for templates
12
12
  const requiredFiles = [
13
+ 'opencode.json',
14
+ '.opencode/.gitignore',
13
15
  '.opencode/README.md',
14
16
  '.opencode/ARCHITECTURE.md',
15
17
  '.opencode/archive/README.md',
18
+ '.opencode/artifacts/README.md',
16
19
  '.opencode/config.template.json',
17
20
  '.opencode/package.json',
21
+ '.opencode/plugins/session-artifacts.ts',
22
+ '.opencode/agents/retrospective-writer.md',
23
+ '.opencode/agents/archiver.md',
18
24
  '.opencode/agents/context-gatherer.md',
19
- '.opencode/agents/api-designer.md',
20
25
  '.opencode/agents/backend-specialist.md',
21
- '.opencode/agents/code-archaeologist.md',
22
- '.opencode/agents/database-architect.md',
23
26
  '.opencode/agents/debugger.md',
24
27
  '.opencode/agents/developer.md',
25
28
  '.opencode/agents/devops-engineer.md',
26
- '.opencode/agents/documentation-writer.md',
27
- '.opencode/agents/explorer-agent.md',
28
29
  '.opencode/agents/feature-lead.md',
29
30
  '.opencode/agents/frontend-specialist.md',
30
- '.opencode/agents/game-developer.md',
31
- '.opencode/agents/mobile-developer.md',
32
- '.opencode/agents/orchestrator.md',
33
- '.opencode/agents/penetration-tester.md',
34
31
  '.opencode/agents/performance-optimizer.md',
35
32
  '.opencode/agents/pr-reviewer.md',
36
- '.opencode/agents/product-manager.md',
37
33
  '.opencode/agents/project-planner.md',
38
- '.opencode/agents/qa-automation-engineer.md',
39
34
  '.opencode/agents/security-auditor.md',
40
- '.opencode/agents/seo-specialist.md',
41
35
  '.opencode/agents/system-analyst.md',
42
36
  '.opencode/agents/test-engineer.md',
43
37
  '.opencode/commands/brainstorm.md',
38
+ '.opencode/commands/archive.md',
39
+ '.opencode/commands/assign-models.md',
40
+ '.opencode/commands/check-progress.md',
44
41
  '.opencode/commands/create.md',
45
- '.opencode/commands/debug.md',
46
42
  '.opencode/commands/plan.md',
43
+ '.opencode/commands/reframe.md',
47
44
  '.opencode/commands/review.md',
45
+ '.opencode/commands/rubber-duck.md',
48
46
  '.opencode/commands/status.md',
49
47
  '.opencode/commands/test.md',
50
48
  '.opencode/skills/api-patterns/SKILL.md',
49
+ '.opencode/skills/archive-writing/SKILL.md',
50
+ '.opencode/skills/artifact-discipline/SKILL.md',
51
51
  '.opencode/skills/brainstorming/SKILL.md',
52
+ '.opencode/skills/clarify-first/SKILL.md',
52
53
  '.opencode/skills/clean-code/SKILL.md',
53
54
  '.opencode/skills/code-philosophy/SKILL.md',
54
55
  '.opencode/skills/context-archive/SKILL.md',
55
56
  '.opencode/skills/context-gathering/SKILL.md',
56
- '.opencode/skills/frontend-design/SKILL.md',
57
- '.opencode/skills/intelligent-routing/SKILL.md',
58
- '.opencode/skills/parallel-agents/SKILL.md',
57
+ '.opencode/skills/intelligent-routing/SKILL.md',
59
58
  '.opencode/skills/plan-writing/SKILL.md',
60
- '.opencode/skills/redteam-validation/SKILL.md',
61
59
  '.opencode/skills/security-gate/SKILL.md',
62
60
  '.opencode/skills/systematic-debugging/SKILL.md',
63
61
  '.opencode/skills/testing-patterns/SKILL.md',
62
+ '.opencode/templates/review-summary.template.md',
63
+ '.opencode/templates/session-summary.template.md',
64
64
  '.opencode/rules/coding-standards.md',
65
65
  '.opencode/rules/git-conventions.md',
66
66
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-agile-agent",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "AI Agile Spec-Driven Development - Install .opencode agile agent system into any project",
5
5
  "keywords": [
6
6
  "ai",
@@ -1,88 +1,112 @@
1
- # OpenCode Agent Kit - Architecture
2
-
3
- ## Overview
1
+ # OpenCode Agent Kit Architecture
4
2
 
5
- - 26 agents
6
- - 25 agents
7
- - 14 skills
8
- - 7 commands
9
- - Primary agent: feature-lead
10
- - All other agents are subagents and communicate through @ handoffs
3
+ ## Overview
4
+ - 15 agents, 19 skills, 11 commands, 1 runtime plugin
5
+ - Primary: feature-lead
6
+ - All others are subagents communicating through @ handoffs
7
+ - `session-artifacts` is the runtime spine for active feature state and handoff safety
11
8
 
12
9
  ## Request Lifecycle
13
-
14
10
  1. User request lands with @feature-lead.
15
- 2. @context-gatherer maps the current project and active work.
16
- 3. Discovery and planning create the compact context bundle.
17
- 4. Build agents implement the approved spec.
18
- 5. Quality agents review, test, and harden the change.
19
- 6. Security-sensitive changes pass through @security-auditor and @penetration-tester before approval.
20
- 7. Any failure loops back to the owning agent.
21
- 8. Approved feature bundles are archived under .opencode/archive/<feature-slug>/.
22
- 9. feature-lead synthesizes the final outcome.
23
-
24
- ## Context Bundle
11
+ 2. @feature-lead **clarifies first** iterates questions until scope, intent, and business value are clear. If user has no idea, offers default + trade-offs.
12
+ 3. `session_artifact_current` restores active feature state.
13
+ 4. @context-gatherer maps current project and active work.
14
+ 5. If new feature: create context bundle + status.yaml. If continuing: refresh the active artifact.
15
+ 6. Discovery and planning produce the compact context bundle.
16
+ 7. Build agents implement the approved spec from canonical handoff packets.
17
+ 8. Quality agents review, test, and harden.
18
+ 9. Security-sensitive changes pass through @security-auditor.
19
+ 10. Any failure loops back to the owning agent.
20
+ 11. When the flow may compact before the final gates, @retrospective-writer captures a compact checkpoint.
21
+ 12. After a meaningful failure is resolved, the agent may ask whether the lesson should become a reusable skill or rule.
22
+ 13. Approved work summaries archived under `.opencode/archive/<feature-slug>.md` through the artifact finalizer.
23
+ 14. @archiver writes the final archive record.
24
+ 15. feature-lead synthesizes the final outcome.
25
25
 
26
- - brief.md: why, outcome, scope, constraints, default choice
26
+ ## Context Bundle
27
+ Create only for new features. Skip if no active feature and user is continuing work.
28
+ - brief.md: why, outcome, business context, scope, constraints, default choice
27
29
  - spec.md: contract, data flow, edge cases, risks, acceptance criteria
28
30
  - task.md: ordered checklist, dependencies, owners
29
31
  - notes.md: facts, decisions, blockers, links
30
32
  - status.yaml: live execution state
31
33
 
32
- - `status.yaml` is the live execution artifact; the markdown files stay as stable planning/reference context.
33
- - `status.yaml.status` allowed values: `active`, `blocked`, `review`, `done`.
34
+ `status.yaml.status` allowed: `brainstorm`, `planning`, `implementation`, `verification`, `review`, `done`, `blocked`.
34
35
 
35
36
  ## Archive
36
-
37
- - Archive completed bundles in `.opencode/archive/<feature-slug>/`.
38
- - Keep archive entries compact and aligned with the approved bundle.
39
- - Archive only when `status.yaml` is `done`.
40
- - Archive the full bundle: `brief.md`, `spec.md`, `task.md`, `notes.md`, and final `status.yaml`.
41
- - Finalize archive only from the main agent handling the request: `feature-lead` or `feature-loop`.
37
+ - Archive in `.opencode/archive/<feature-slug>.md`.
38
+ - Include the shipped summary, changed surfaces, verification signal, and remaining follow-up.
39
+ - Finalize only when `status.yaml` is `done`.
40
+ - Finalize only from the primary agent.
42
41
 
43
42
  ## Skill Design
44
-
45
43
  - Skills are small, philosophy-first mental models.
46
- - Skill descriptions should state the trigger and the decision domain.
44
+ - Skill descriptions state the trigger and decision domain.
47
45
  - Prefer the smallest skill that changes the next decision.
48
-
49
- ## Role Map
50
-
46
+ - `artifact-discipline` keeps runtime state out of prompt memory.
47
+ - `session-closeout` leaves a durable checkpoint before compaction or pause.
48
+ - Use `cross-model-regression` when risky changes need multiple specialist checks across different reviewer models.
49
+ - Promote lessons from repeated or costly failures only when they create durable guidance.
50
+
51
+ ## Runtime Spine
52
+ - Active work lives in `.opencode/artifacts/features/<feature-slug>/`.
53
+ - `.opencode/artifacts/` is local runtime state and should be git-ignored.
54
+ - Planning docs and runtime evidence live side-by-side but stay separate.
55
+ - Every subagent should start from `session_artifact_handoff` instead of a document dump.
56
+ - `session_artifact_repo_delta` guards against drift between artifact state and git state.
57
+ - Archive remains the immutable shipped summary.
58
+
59
+ ## Flow Rules
60
+ - The default command spine is `/brainstorm -> /plan -> /create -> /test -> /review -> /archive`.
61
+ - The flow is resumable and non-linear. Any command can be re-entered when the work needs that lens.
62
+ - Re-plan on scope drift, re-brainstorm on ambiguity, re-test on risky changes, and re-review at meaningful checkpoints.
63
+ - Use @retrospective-writer when a failure may deserve a reusable lesson.
64
+
65
+ ## Role Map
66
+
51
67
  | Stage | Agents | Responsibility |
52
68
  |-------|--------|----------------|
53
- | Primary | feature-lead | Owns the request, tradeoffs, and the final gate loop |
54
- | Context | context-gatherer | Map the current project state and archive-ready history |
55
- | Coordination | project-planner, explorer-agent | Split, map, and sequence the work |
56
- | Advanced | orchestrator | Optional multi-domain synthesis pass |
57
- | Product | product-manager | Define problem, value, priorities, and release scope |
58
- | Spec | system-analyst, api-designer, database-architect | Create the compact context bundle and contracts |
59
- | Build | developer, frontend-specialist, backend-specialist, mobile-developer, game-developer, devops-engineer | Implement the approved spec |
60
- | Quality | test-engineer, security-auditor, penetration-tester, performance-optimizer, debugger, pr-reviewer | Verify, review, and harden |
61
- | Automation | qa-automation-engineer | Build and maintain test harnesses and repeatable validation |
62
- | Output | documentation-writer, seo-specialist | Explain and publish clearly |
63
- | Maintenance | code-archaeologist | Clean and simplify legacy code |
64
-
69
+ | Primary | feature-lead | Own request, tradeoffs, final gate loop |
70
+ | Archive | archiver | Write compact archive summaries for approved work |
71
+ | Learning | retrospective-writer | Capture a reusable failure lesson and decide whether it should become a skill or rule |
72
+ | Context | context-gatherer | Map project state and archive-ready history |
73
+ | Coordination | project-planner | Split, map, sequence work |
74
+ | Spec | system-analyst | Create compact context bundle and contracts |
75
+ | Build | developer, frontend-specialist, backend-specialist, devops-engineer | Implement approved spec |
76
+ | Quality | test-engineer, security-auditor, performance-optimizer, debugger, pr-reviewer | Verify, review, harden |
77
+
65
78
  ## Command Map
66
79
 
67
80
  | Command | Entry | Exit |
68
81
  |---------|-------|------|
69
- | brainstorm | @feature-lead receives the request. | One recommended path is clear. |
70
- | create | @feature-lead receives the feature request. | Implementation matches the spec. |
71
- | debug | @feature-lead scopes the bug and the impact. | The original failure no longer reproduces. |
72
- | plan | @feature-lead receives the request. | The planning bundle is short and complete. |
73
- | review | @feature-lead hands the change to @pr-reviewer. | Either APPROVED or CHANGES REQUESTED is clear. |
74
- | status | @feature-lead asks for the current project state. | The current health is easy to understand. |
75
- | test | @feature-lead defines the test scope. | The important paths are covered. |
76
-
77
- ## Gate Rules
78
-
79
- - Do not hand off to build until the spec bundle is clear.
80
- - Do not hand off to review until implementation is complete.
81
- - Do not ship until the review gate is clean.
82
- - Loop back to the owning agent when a gate fails.
83
-
84
- ## Decision Rule
85
-
86
- - Prefer defaults when the tradeoff is low risk.
87
- - Escalate to the user only when scope, security, or architecture changes materially.
88
- - Keep all context compact enough for a subagent to finish without asking again.
82
+ | archive | @archiver closes approved work | Archive path and saved summary are explicit |
83
+ | brainstorm | @feature-lead receives request or ambiguity returns | One recommended path is clear |
84
+ | check-progress | @feature-lead needs a git-aware status read | Current state and next step are explicit |
85
+ | create | @feature-lead receives feature request | Implementation matches spec |
86
+ | plan | @feature-lead receives request or scope drift | Planning bundle is short and complete |
87
+ | review | @feature-lead hands change to @pr-reviewer at any meaningful checkpoint | APPROVED or CHANGES REQUESTED |
88
+ | reframe | @feature-lead detects a framing mismatch | Better direction and next step are explicit |
89
+ | rubber-duck | @feature-lead needs to reason before changing code | Assumptions and next check are explicit |
90
+ | status | @feature-lead asks for project state | Current health is easy to understand |
91
+ | test | @feature-lead defines test scope | Important paths are covered |
92
+
93
+ ## Gate Rules
94
+ - Do not hand off to build until spec bundle is clear.
95
+ - Do not hand off to review until implementation is complete.
96
+ - Do not ship until review gate is clean.
97
+ - Do not archive until repo delta is reconciled.
98
+ - Loop back to owning agent when a gate fails.
99
+
100
+ ## Decision Rules
101
+ - Prefer defaults when tradeoff is low risk AND business intent is clear.
102
+ - Escalate to user when scope, security, or architecture changes materially.
103
+ - Keep context compact enough for a subagent to finish without asking again.
104
+ - Pass intent in prompts and retrieve documents through tools.
105
+
106
+ ## Clarification Rules
107
+ - **Iterate until clear**: Keep asking until scope, intent, and business value are unambiguous.
108
+ - **No hallucination**: If you don't know, ask. Never assume user intent.
109
+ - **Default + trade-offs**: If user has no idea, propose a default path with trade-offs. Let them choose.
110
+ - **Business before technical**: Capture who, what value, and success criteria before any technical planning.
111
+ - **State assumptions**: Flag what you inferred and what is unverified.
112
+ - **Compact but complete**: Keep context bundle output compact, but never skip user requirements.