devflow-kit 3.4.0 → 3.5.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.
Files changed (186) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +8 -4
  3. package/dist/agents/code-edit.md +133 -0
  4. package/dist/agents/code-fix.md +165 -0
  5. package/dist/agents/code.md +39 -182
  6. package/dist/agents/design.md +0 -1
  7. package/dist/agents/git.md +31 -693
  8. package/dist/agents/knowledge.md +8 -2
  9. package/dist/agents/research.md +6 -0
  10. package/dist/agents/review.md +0 -4
  11. package/dist/agents/scrutinize.md +3 -0
  12. package/dist/agents/skim.md +4 -0
  13. package/dist/agents/triage.md +8 -1
  14. package/dist/cli/commands/behavior-prompts.js +77 -0
  15. package/dist/cli/commands/behavior.js +123 -0
  16. package/dist/cli/commands/flags.js +8 -2
  17. package/dist/cli/commands/init-seed.js +7 -3
  18. package/dist/cli/commands/init.js +72 -5
  19. package/dist/cli/commands/rules.js +16 -0
  20. package/dist/cli/commands/tracker.js +112 -15
  21. package/dist/cli.js +2 -0
  22. package/dist/commands/bug-analysis.md +5 -5
  23. package/dist/commands/code-review.md +14 -9
  24. package/dist/commands/debug.md +25 -4
  25. package/dist/commands/dynamic-build.md +28 -38
  26. package/dist/commands/dynamic-plan.md +11 -9
  27. package/dist/commands/dynamic-profile.md +3 -3
  28. package/dist/commands/dynamic-tickets.md +12 -10
  29. package/dist/commands/explore.md +3 -3
  30. package/dist/commands/implement.md +91 -125
  31. package/dist/commands/plan.md +15 -8
  32. package/dist/commands/release.md +3 -2
  33. package/dist/commands/research.md +16 -9
  34. package/dist/commands/resolve.md +20 -15
  35. package/dist/commands/self-review.md +2 -2
  36. package/dist/core/agent-frontmatter.js +101 -0
  37. package/dist/core/compliance-compose.js +6 -4
  38. package/dist/core/feature-switch.js +23 -2
  39. package/dist/core/flags.js +111 -0
  40. package/dist/core/manifest.js +11 -3
  41. package/dist/core/mds-variants.js +68 -26
  42. package/dist/core/plugins.js +42 -65
  43. package/dist/core/project-paths.js +0 -4
  44. package/dist/core/proxy-log.js +1 -1
  45. package/dist/core/proxy-state.js +1 -1
  46. package/dist/core/tracker.js +120 -2
  47. package/dist/learning-off/agents/code-edit.md +129 -0
  48. package/dist/learning-off/agents/code-fix.md +161 -0
  49. package/dist/learning-off/agents/code.md +37 -180
  50. package/dist/learning-off/agents/design.md +0 -1
  51. package/dist/learning-off/agents/knowledge.md +8 -2
  52. package/dist/learning-off/agents/research.md +6 -0
  53. package/dist/learning-off/agents/review.md +0 -4
  54. package/dist/learning-off/agents/scrutinize.md +3 -0
  55. package/dist/learning-off/agents/skim.md +4 -0
  56. package/dist/learning-off/agents/triage.md +8 -1
  57. package/dist/learning-off/commands/bug-analysis.md +3 -3
  58. package/dist/learning-off/commands/code-review.md +12 -7
  59. package/dist/learning-off/commands/debug.md +22 -2
  60. package/dist/learning-off/commands/dynamic-build.md +27 -37
  61. package/dist/learning-off/commands/dynamic-plan.md +10 -8
  62. package/dist/learning-off/commands/dynamic-profile.md +2 -2
  63. package/dist/learning-off/commands/dynamic-tickets.md +11 -9
  64. package/dist/learning-off/commands/explore.md +1 -1
  65. package/dist/learning-off/commands/implement.md +89 -123
  66. package/dist/learning-off/commands/plan.md +13 -6
  67. package/dist/learning-off/commands/release.md +3 -2
  68. package/dist/learning-off/commands/research.md +14 -7
  69. package/dist/learning-off/commands/resolve.md +18 -13
  70. package/dist/skills/git/references/learn-conventions.md +27 -3
  71. package/dist/skills/git/references/pr/check-ci-status.md +19 -0
  72. package/dist/skills/git/references/pr/check-merge-readiness.md +19 -0
  73. package/dist/skills/git/references/pr/fetch-review-threads.md +30 -0
  74. package/dist/skills/git/references/pr/post-resolution-summary.md +18 -0
  75. package/dist/skills/git/references/pr/post-review-summary.md +20 -0
  76. package/dist/skills/git/references/pr/resolve-review-threads.md +28 -4
  77. package/dist/skills/git/references/pr/update-pr-evidence.md +13 -0
  78. package/dist/skills/git/references/pr/validate-branch.md +26 -0
  79. package/dist/skills/git/references/tracker/github/associate-release.md +24 -0
  80. package/dist/skills/git/references/tracker/github/backlink-shipped-issues.md +31 -1
  81. package/dist/skills/git/references/tracker/github/create-release.md +30 -1
  82. package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +89 -2
  83. package/dist/skills/git/references/tracker/github/ensure-traceable-issue.md +16 -1
  84. package/dist/skills/git/references/tracker/github/fetch-issue.md +36 -1
  85. package/dist/skills/git/references/tracker/github/fetch-issues-batch.md +47 -1
  86. package/dist/skills/git/references/tracker/github/gather-release-evidence.md +25 -0
  87. package/dist/skills/git/references/tracker/github/manage-debt.md +21 -1
  88. package/dist/skills/git/references/tracker/github/post-wave-report.md +15 -1
  89. package/dist/skills/git/references/tracker/github/setup-task.md +41 -1
  90. package/dist/skills/git/references/tracker/jira/associate-release.md +24 -0
  91. package/dist/skills/git/references/tracker/jira/backlink-shipped-issues.md +31 -1
  92. package/dist/skills/git/references/tracker/jira/create-release.md +30 -1
  93. package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +89 -2
  94. package/dist/skills/git/references/tracker/jira/ensure-traceable-issue.md +16 -1
  95. package/dist/skills/git/references/tracker/jira/fetch-issue.md +36 -1
  96. package/dist/skills/git/references/tracker/jira/fetch-issues-batch.md +47 -1
  97. package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +25 -0
  98. package/dist/skills/git/references/tracker/jira/manage-debt.md +21 -1
  99. package/dist/skills/git/references/tracker/jira/post-wave-report.md +15 -1
  100. package/dist/skills/git/references/tracker/jira/setup-task.md +41 -1
  101. package/dist/skills/git/references/tracker/linear/associate-release.md +24 -0
  102. package/dist/skills/git/references/tracker/linear/backlink-shipped-issues.md +31 -1
  103. package/dist/skills/git/references/tracker/linear/create-release.md +30 -1
  104. package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +89 -2
  105. package/dist/skills/git/references/tracker/linear/ensure-traceable-issue.md +16 -1
  106. package/dist/skills/git/references/tracker/linear/fetch-issue.md +36 -1
  107. package/dist/skills/git/references/tracker/linear/fetch-issues-batch.md +47 -1
  108. package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +25 -0
  109. package/dist/skills/git/references/tracker/linear/manage-debt.md +21 -1
  110. package/dist/skills/git/references/tracker/linear/post-wave-report.md +15 -1
  111. package/dist/skills/git/references/tracker/linear/setup-task.md +41 -1
  112. package/dist/targets/claude-code/agent-type-owner.js +164 -0
  113. package/dist/targets/claude-code/behavior-install.js +111 -0
  114. package/dist/targets/claude-code/installer.js +69 -2
  115. package/dist/targets/claude-code/learning-install.js +9 -1
  116. package/dist/targets/claude-code/tracker-install.js +33 -16
  117. package/dist/targets/claude-code/tracker-servers.js +107 -0
  118. package/package.json +4 -3
  119. package/src/assets/agents/_partials/_code.mds +109 -0
  120. package/src/assets/agents/code-edit.mds +81 -0
  121. package/src/assets/agents/code-fix.mds +113 -0
  122. package/src/assets/agents/code.mds +18 -222
  123. package/src/assets/agents/design.mds +0 -1
  124. package/src/assets/agents/evaluate.md +7 -1
  125. package/src/assets/agents/explore.md +58 -0
  126. package/src/assets/agents/git.mds +31 -693
  127. package/src/assets/agents/knowledge.mds +8 -2
  128. package/src/assets/agents/learning.md +19 -69
  129. package/src/assets/agents/research.mds +6 -0
  130. package/src/assets/agents/review.mds +0 -4
  131. package/src/assets/agents/scrutinize.mds +3 -0
  132. package/src/assets/agents/simplify.md +3 -0
  133. package/src/assets/agents/skim.mds +4 -0
  134. package/src/assets/agents/synthesize.md +26 -352
  135. package/src/assets/agents/test.md +8 -0
  136. package/src/assets/agents/tracker.md +20 -7
  137. package/src/assets/agents/triage.mds +8 -1
  138. package/src/assets/agents/validate.md +5 -0
  139. package/src/assets/commands/_partials/_compliance.mds +36 -0
  140. package/src/assets/commands/_partials/_decisions.mds +2 -2
  141. package/src/assets/commands/_partials/_engine.mds +8 -8
  142. package/src/assets/commands/_partials/_preamble.mds +3 -3
  143. package/src/assets/commands/_partials/_roster.mds +4 -3
  144. package/src/assets/commands/_partials/_wave.mds +2 -2
  145. package/src/assets/commands/bug-analysis.mds +3 -3
  146. package/src/assets/commands/code-review.mds +11 -8
  147. package/src/assets/commands/debug.mds +24 -2
  148. package/src/assets/commands/dynamic-build.mds +14 -25
  149. package/src/assets/commands/dynamic-plan.mds +4 -3
  150. package/src/assets/commands/dynamic-tickets.mds +5 -4
  151. package/src/assets/commands/explore.mds +1 -1
  152. package/src/assets/commands/implement.mds +89 -125
  153. package/src/assets/commands/plan.mds +12 -7
  154. package/src/assets/commands/release.mds +3 -2
  155. package/src/assets/commands/research.mds +14 -7
  156. package/src/assets/commands/resolve.mds +17 -14
  157. package/src/assets/mds/.mdsroot +4 -0
  158. package/src/assets/mds/git/_ops.mds +383 -0
  159. package/src/assets/mds/git/_ops_pr.mds +201 -0
  160. package/src/assets/mds/git/_ops_steps.mds +147 -0
  161. package/src/assets/mds/git/_pr.mds +39 -44
  162. package/src/assets/mds/git/_references.mds +6 -3
  163. package/src/assets/mds/tracker/_common.mds +5 -5
  164. package/src/assets/mds/tracker/_contract.mds +4 -3
  165. package/src/assets/mds/tracker/_github.mds +60 -14
  166. package/src/assets/mds/tracker/_jira.mds +60 -14
  167. package/src/assets/mds/tracker/_linear.mds +60 -14
  168. package/src/assets/mds/tracker/_steps.mds +10 -9
  169. package/src/assets/rules/behavior.md +6 -0
  170. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +2 -1
  171. package/src/assets/scripts/hooks/lib/project-paths.cjs +0 -6
  172. package/src/assets/skills/agent-references/SKILL.md +33 -0
  173. package/src/assets/skills/agent-references/references/learning/maintain.md +71 -0
  174. package/src/assets/skills/agent-references/references/synthesize/bug-analysis.md +71 -0
  175. package/src/assets/skills/agent-references/references/synthesize/design.md +36 -0
  176. package/src/assets/skills/agent-references/references/synthesize/exploration.md +38 -0
  177. package/src/assets/skills/agent-references/references/synthesize/planning.md +60 -0
  178. package/src/assets/skills/agent-references/references/synthesize/research.md +61 -0
  179. package/src/assets/skills/agent-references/references/synthesize/review.md +76 -0
  180. package/src/assets/skills/compliance/SKILL.md +1 -1
  181. package/src/assets/skills/docs-framework/SKILL.md +80 -83
  182. package/src/assets/skills/docs-framework/references/patterns.md +14 -25
  183. package/src/assets/skills/docs-framework/references/violations.md +7 -7
  184. package/src/assets/skills/gap-analysis/SKILL.md +0 -16
  185. package/src/assets/skills/gap-analysis/references/compliance.md +19 -0
  186. package/dist/skills/git/references/pr/ensure-pr-ready.md +0 -24
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Tracker-server stamp for the installed Git and Tracker agents.
3
+ *
4
+ * D-TRACKER-SERVER-ALLOWLIST: the Git and Tracker agents ship a tool ALLOWLIST (their
5
+ * frontmatter `tools:` line), and the tracker tool servers a user has connected are
6
+ * configured per machine, so the shipped line names none. The installer appends one
7
+ * whole-server entry per configured server (`mcp__<server>`, which grants every tool the
8
+ * server exposes) to the INSTALLED `tools:` line of those two agents, after the file is
9
+ * copied. The list is `manifest.features.tracker.servers`, else TRACKER_MCP_SERVERS_DEFAULT,
10
+ * and `devflow tracker --servers` changes it. Decided here:
11
+ *
12
+ * - Stamped agents: Git and Tracker, the two that call tracker tools. Code and Research keep a
13
+ * denylist and so every tool server; Scrutinize and Simplify deny them all.
14
+ * - Where the stamp is written. Every path that writes an installed copy of either agent either
15
+ * stamps it or carries the stamp it finds:
16
+ * 1. `installViaFileCopy` stamps Git as it writes it (full install and `--plugin` alike);
17
+ * a `--plugin` run that does not install Git leaves the installed, stamped copy alone.
18
+ * 2. `convergeTrackerArtifacts` stamps Tracker as it writes it, and compares the STAMPED text
19
+ * with the installed file, so a steady-state run reports `unchanged`.
20
+ * 3. `convergeLearningVariants` (init, `devflow learning --enable/--disable`) carries the
21
+ * installed stamp onto the variant it writes (`carryStampedTools`), the way it carries
22
+ * `model:` and `effort:`, so a variant switch keeps the list and a repeat run is byte-equal.
23
+ * 4. `devflow tracker --servers` re-stamps the installed copies at once ({@link restampTrackerAgents}).
24
+ * `reapplyAgentMapping` and `revertExternalAgents` (`devflow agents`, the proxy, an uninstall's
25
+ * revert) go through `rewriteAgentFrontmatter`, which manages `model:` and `effort:` only, so
26
+ * they preserve the line. An agent has no shadow override: only skills and rules do.
27
+ * - The agent sources stay vendor-neutral. No stamped name appears under src/.
28
+ * - A name no connected server answers to is inert. The agent then finds no tool for the capability
29
+ * it needs and reports `TRACEABILITY: DEGRADED (no tracker tool for {capability})`, so a wrong
30
+ * or missing name is visible and the remedy is `devflow tracker --servers`.
31
+ *
32
+ * Never throws: every failure is a warning, because the install must not die on a stamp.
33
+ */
34
+ import { promises as fs } from 'fs';
35
+ import * as path from 'path';
36
+ import { stampAgentTools } from '../../core/agent-frontmatter.js';
37
+ import { writeFileAtomicExclusive } from '../../core/fs-atomic.js';
38
+ import { mdFileName } from '../../core/orphan-sweep.js';
39
+ import { trackerServerTools } from '../../core/tracker.js';
40
+ import { TRACKER_AGENT_NAME } from './tracker-install.js';
41
+ /** The registry name of the Git agent. */
42
+ export const GIT_AGENT_NAME = 'git';
43
+ /** The installed agents that carry the stamp. */
44
+ export const TRACKER_STAMPED_AGENTS = [GIT_AGENT_NAME, TRACKER_AGENT_NAME];
45
+ /** True when `agentName` is an agent that carries the stamp. */
46
+ export function isTrackerStampedAgent(agentName) {
47
+ return TRACKER_STAMPED_AGENTS.includes(agentName);
48
+ }
49
+ /**
50
+ * Stamp the installed Git and Tracker agents with `servers`.
51
+ *
52
+ * Rewrites only an installed copy (an absent one stays absent), compares against the bytes on
53
+ * disk at the moment of writing, and writes atomically only when they differ, so a run that
54
+ * changes nothing writes nothing. Never throws.
55
+ */
56
+ export async function restampTrackerAgents(opts) {
57
+ const { claudeDir, servers, warn } = opts;
58
+ const rewritten = [];
59
+ const unchanged = [];
60
+ const absent = [];
61
+ const failed = [];
62
+ // Precondition, asserted in production code: a relative claudeDir would resolve the targets
63
+ // against the working directory.
64
+ if (!path.isAbsolute(claudeDir)) {
65
+ warn(`tracker servers: claudeDir is not an absolute path ("${claudeDir}") — the installed agents were not stamped`);
66
+ return { rewritten, unchanged, absent, failed: [...TRACKER_STAMPED_AGENTS] };
67
+ }
68
+ const tools = trackerServerTools(servers);
69
+ for (const agent of TRACKER_STAMPED_AGENTS) {
70
+ const target = path.join(claudeDir, 'agents', 'devflow', mdFileName(agent));
71
+ let current;
72
+ try {
73
+ current = await fs.readFile(target, 'utf-8');
74
+ }
75
+ catch (err) {
76
+ if (err.code === 'ENOENT') {
77
+ absent.push(agent);
78
+ }
79
+ else {
80
+ warn(`tracker servers: cannot read ${mdFileName(agent)} (${target}) — ${String(err)}`);
81
+ failed.push(agent);
82
+ }
83
+ continue;
84
+ }
85
+ const stamped = stampAgentTools(current, tools);
86
+ if (!stamped.ok) {
87
+ warn(`tracker servers: ${mdFileName(agent)} could not be stamped (${stamped.error}), so it was left as it is. ` +
88
+ 'Run `devflow init` to reinstall it.');
89
+ failed.push(agent);
90
+ continue;
91
+ }
92
+ if (!stamped.value.changed) {
93
+ unchanged.push(agent);
94
+ continue;
95
+ }
96
+ try {
97
+ await writeFileAtomicExclusive(target, stamped.value.content);
98
+ rewritten.push(agent);
99
+ }
100
+ catch (err) {
101
+ warn(`tracker servers: could not rewrite ${mdFileName(agent)} (${target}) — ${String(err)}`);
102
+ failed.push(agent);
103
+ }
104
+ }
105
+ return { rewritten, unchanged, absent, failed };
106
+ }
107
+ //# sourceMappingURL=tracker-servers.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devflow-kit",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "A meta-harness for Claude Code — turns a single coding agent into an engineering team: orchestration, parallel review, persistent memory, self-learning, and graph workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -28,7 +28,8 @@
28
28
  "test": "vitest run",
29
29
  "test:watch": "vitest",
30
30
  "test:integration": "vitest run --config vitest.integration.config.ts",
31
- "test:golden:update": "npx tsx scripts/update-golden.ts"
31
+ "test:golden:update": "npx tsx scripts/update-golden.ts",
32
+ "audit:tokens": "tsx scripts/token-audit/index.ts"
32
33
  },
33
34
  "keywords": [
34
35
  "claude",
@@ -65,7 +66,7 @@
65
66
  "@clack/prompts": "^0.9.1",
66
67
  "commander": "^12.0.0",
67
68
  "picocolors": "^1.1.1",
68
- "subswitch": "0.5.0"
69
+ "subswitch": "0.6.0"
69
70
  },
70
71
  "devDependencies": {
71
72
  "@mdscript/mds": "0.4.4",
@@ -0,0 +1,109 @@
1
+ A partial: the text the three Code variants share. `code.mds` (Code: implement, issue-fix),
2
+ `code-fix.mds` (Code-fix: validation-fix, alignment-fix, qa-fix, ci-fix) and `code-edit.mds`
3
+ (Code-edit: edit) are the hosts. A host is any file with `output-dir:`; this file declares none,
4
+ so the build skips it and it reaches an artifact only through the hosts that import it.
5
+
6
+ D-CODE-VARIANTS: a spawn runs exactly one mode, so one agent for every mode would pay for every
7
+ mode's text and skills on every spawn. Each host carries its own mode sections, its own `OPERATION:`
8
+ line and its own preload (D-CODE-PRELOADS); what every mode needs is written once here. The
9
+ security-scan block lives in `commit_push()`, so every variant keeps it, and the Running
10
+ commands block lives in `tail()`, so the three carry one byte-identical copy.
11
+
12
+ D-NO-RUNTIME-SKILLS: no variant carries a mode-skill table, a `DOMAIN` input or an instruction
13
+ to load a skill by language.
14
+
15
+ D-COMPLIANCE-INJECT: no variant names the compliance skill or takes a compliance input. The command
16
+ injects the compliance directive into a spawn prompt only when the resolved lens is on, so a
17
+ lens-off spawn pays nothing for it (the directive's home is `commands/_partials/_compliance.mds`).
18
+
19
+ The hosts import this partial as an alias (`as code`) and call each define once. A learning arm
20
+ inside a define is split by the build like an arm in a host: the markers sit on lines of their own.
21
+
22
+ @define input_core():
23
+ - **TASK_ID**: Unique identifier (e.g., "task-2025-01-15_1430")
24
+ - **TASK_DESCRIPTION**: What to do
25
+ - **PUSH** (optional): `true` (default) | `false` — when false, commit only; orchestrator owns push/CI gate
26
+ <!-- learning:on -->
27
+ - **DECISIONS_CONTEXT** (optional): Compact index of active ADR/PF entries.
28
+ When provided, use `devflow:apply-decisions` to Read full bodies on demand.
29
+ <!-- learning:end -->
30
+ @end
31
+
32
+ @define decisions_orient():
33
+ <!-- learning:on -->
34
+ - If `DECISIONS_CONTEXT` is provided, follow `devflow:apply-decisions` on it. An absent key or `(none)` means no decisions context. State every decision or pitfall you apply in words in code, comments, tests and commit messages, never by its ID.
35
+ <!-- learning:end -->
36
+ @end
37
+
38
+ @define commit_push():
39
+ **Commit and push**: Create atomic commits with clear messages. Reference TASK_ID. Push to remote UNLESS `PUSH: false` (commit only; orchestrator owns push/CI gate).
40
+ **Security scan (conditional):** Only when this session offers a code-scanning tool. Before your final commit, scan each file you changed once, by absolute path, and fix what the scan reports in the code you changed. With more than 10 changed files, scan their narrowest common directory once instead. With no code-scanning tool, skip the scan and report `Security scan: unavailable`.
41
+ @end
42
+
43
+ @define tail():
44
+ ## Running commands
45
+
46
+ Run builds, typechecks, lints and tests in the foreground, each with an explicit Bash `timeout` above its expected run time. The ceiling is 600000 ms, or `BASH_MAX_TIMEOUT_MS` when set (`echo ${BASH_MAX_TIMEOUT_MS:-600000}`).
47
+
48
+ - Capture, then tail, in one Bash call (shell state does not persist): `LOG=$(mktemp); echo "LOG=$LOG"; <command> >"$LOG" 2>&1; rc=$?; tail -n 40 "$LOG"; echo "EXIT=$rc"`. The printed `EXIT=` value is the result; never decide one from a grep count.
49
+ - Never background a command and wait on it, and never poll across turns: no `sleep` or `true` turns, no sentinel-file checks, no Monitor.
50
+ - Prefer the scoped command for the change (a package, a path or a test file); for the whole set, one workspace-level command over a per-package loop.
51
+ - A run that exceeds its timeout is BLOCKED: report its duration and log path. Do not wait on it, poll it or re-run it.
52
+ - A run expected to exceed the ceiling is split into parts, each under about 90% of it, run in sequence. If it cannot be split, report BLOCKED with the remedy `devflow flags --set bash-max-timeout-ms=<ms>`.
53
+ - Never re-run a command when nothing it reads has changed.
54
+ - Never wrap a build or test command in `sh -c`, `bash -c`, `python3 -c` or `node -e`: permission rules deny wrapped commands they would allow directly.
55
+ - The same rules hold inside a dynamic Workflow sub-agent.
56
+
57
+ ## Principles
58
+
59
+ 1. **Work on feature branch** - All operations happen on the current feature branch
60
+ 2. **Orient, then match patterns** - Before writing code, orient on branch state and find similar implementations; match their conventions, don't invent new ones
61
+ 3. **Be decisive** - Make confident implementation choices. Don't present alternatives or ask permission for tactical decisions
62
+ 4. **Small, focused changes** - Don't scope creep beyond the plan
63
+ 5. **Fail honestly** - If blocked, report clearly with what was completed
64
+
65
+ ## Output
66
+
67
+ Return structured completion status:
68
+
69
+ ```markdown
70
+ ## Implementation Report: {TASK_ID}
71
+
72
+ ### Status: COMPLETE | FAILED | BLOCKED
73
+
74
+ ### Implementation
75
+ - Files created: {n}
76
+ - Files modified: {n}
77
+ - Tests added: {n}
78
+
79
+ ### Commits
80
+ - {sha} {message}
81
+
82
+ ### Key Decisions (if any)
83
+ - {Decision}: {rationale}
84
+
85
+ ### Blockers (if any)
86
+ {Description of blocker or failure with recommendation}
87
+ ```
88
+
89
+ Report cap: final message at most about 1,500 tokens; longer material goes to a `mktemp` file (via Bash or Write) and the message gives its path. Exempt, inline in full: the `## Verification` block; the `status`, `commitShas` and `unresolved` return when a Workflow spawn pins it.
90
+
91
+ ## Boundaries
92
+
93
+ **Escalate to orchestrator:**
94
+ - Discovered dependency on another task
95
+ - Scope significantly larger than planned
96
+ - Breaking changes to shared interfaces
97
+ - Prior phase code is broken or incomplete (in sequential execution)
98
+
99
+ **Never:**
100
+ - Switch branches during implementation
101
+ - Push to branches other than your feature branch
102
+ - Merge PRs (orchestrator handles this)
103
+ - Trust handoff summaries without reading actual code
104
+ @end
105
+
106
+ @export input_core
107
+ @export decisions_orient
108
+ @export commit_push
109
+ @export tail
@@ -0,0 +1,81 @@
1
+ ---
2
+ output-dir: dist/agents
3
+ # D-CODE-VARIANTS: Code-edit runs edit, a mechanical change that adds no behaviour. Its text is the
4
+ # shared partial _partials/_code.mds plus the one mode section below.
5
+ # D-CODE-PRELOADS: Code-edit preloads git, worktree-support and apply-decisions: no tests are written
6
+ # and no FEATURE_KNOWLEDGE is passed.
7
+ # D-VARIANT-SLUGS: code-edit is its own `devflow agents` slug with Code's model and effort; a `code`
8
+ # override does not reach it.
9
+ ---
10
+ @import "./_partials/_code.mds" as code
11
+ ---
12
+ name: Code-edit
13
+ description: Autonomous mechanical edit on feature branch. Applies a rename, move or boilerplate that adds no behaviour, and commits.
14
+ model: sonnet
15
+ effort: high
16
+ skills:
17
+ - devflow:git
18
+ - devflow:worktree-support
19
+ <!-- learning:on -->
20
+ - devflow:apply-decisions
21
+ <!-- learning:end -->
22
+ disallowedTools:
23
+ - Agent
24
+ - SendMessage
25
+ - NotebookEdit
26
+ - EnterWorktree
27
+ - ExitWorktree
28
+ - ArtifactComments
29
+ - ArtifactData
30
+ - TodoWrite
31
+ - AskUserQuestion
32
+ - TaskOutput
33
+ - ScheduleWakeup
34
+ - CronCreate
35
+ - CronDelete
36
+ - CronList
37
+ - RemoteTrigger
38
+ - PushNotification
39
+ - DesignSync
40
+ ---
41
+
42
+ # Code-edit Agent
43
+
44
+ You are an autonomous editing specialist working on a feature branch. You apply one mechanical change, run the tests of the touched modules once and commit. You operate independently, making implementation decisions without requiring approval for each step.
45
+
46
+ ## Input Context
47
+
48
+ You receive from orchestrator:
49
+ {{code.input_core()}}
50
+ - **OPERATION** (optional): `edit` (default when absent) — selects operating mode (see below); every spawn passes it as the first prompt line. Any other value returns BLOCKED, naming it, and changes nothing.
51
+
52
+ **Worktree Support**: If `WORKTREE_PATH` is provided, follow the `devflow:worktree-support` skill for path resolution. If omitted, use cwd.
53
+
54
+ ## Responsibilities
55
+
56
+ 1. **Orient on branch state** (always, before any change):
57
+ - Run `git status` and `git diff --stat` and `git diff --cached --stat` to see uncommitted/unstaged work
58
+ - Read the files the change covers, to match their naming conventions and structure
59
+ {{code.decisions_orient()}}
60
+
61
+ 2. **Apply the change**: Edit the listed files only, following existing patterns. Add no behaviour.
62
+
63
+ 3. **Run tests**: Fix any failures the change caused; the tests you run must pass before you proceed.
64
+ **Gate ownership:** Run the tests of the touched modules once. Never the full suite. Only Validate runs the full suite.
65
+
66
+ 4. {{code.commit_push()}}
67
+
68
+ ## Mode: edit
69
+
70
+ When `OPERATION: edit`, you apply a mechanical change: a rename, a move or boilerplate that adds no behaviour.
71
+
72
+ **Inputs:** `EDIT_SPEC` (the change and the files it covers), `SCOPE: no new behaviour`, `PUSH: false`
73
+
74
+ **Protocol:**
75
+ 1. Apply the change to the listed files only; add no tests, since no behaviour changes
76
+ 2. Run the tests of the touched modules once (Running commands block)
77
+ 3. Commit
78
+
79
+ **Return:** status, commit SHAs, `## Verification` block
80
+
81
+ {{code.tail()}}
@@ -0,0 +1,113 @@
1
+ ---
2
+ output-dir: dist/agents
3
+ # D-CODE-VARIANTS: Code-fix runs validation-fix, alignment-fix, qa-fix and ci-fix, and has no default
4
+ # mode. Its text is the shared partial _partials/_code.mds plus the four mode sections below.
5
+ # D-CODE-PRELOADS: Code-fix preloads git, testing, worktree-support and apply-decisions: a gate-failure
6
+ # fix runs the named tests and is not a test-first build, and no fix spawn passes FEATURE_KNOWLEDGE.
7
+ # D-VARIANT-SLUGS: code-fix is its own `devflow agents` slug with Code's model and effort; a `code`
8
+ # override does not reach it.
9
+ ---
10
+ @import "./_partials/_code.mds" as code
11
+ ---
12
+ name: Code-fix
13
+ description: Autonomous gate-failure repair on feature branch. Fixes the listed validation, alignment, QA or CI failures, verifies, and commits.
14
+ model: sonnet
15
+ effort: high
16
+ skills:
17
+ - devflow:git
18
+ - devflow:testing
19
+ - devflow:worktree-support
20
+ <!-- learning:on -->
21
+ - devflow:apply-decisions
22
+ <!-- learning:end -->
23
+ disallowedTools:
24
+ - Agent
25
+ - SendMessage
26
+ - NotebookEdit
27
+ - EnterWorktree
28
+ - ExitWorktree
29
+ - ArtifactComments
30
+ - ArtifactData
31
+ - TodoWrite
32
+ - AskUserQuestion
33
+ - TaskOutput
34
+ - ScheduleWakeup
35
+ - CronCreate
36
+ - CronDelete
37
+ - CronList
38
+ - RemoteTrigger
39
+ - PushNotification
40
+ - DesignSync
41
+ ---
42
+
43
+ # Code-fix Agent
44
+
45
+ You are an autonomous repair specialist working on a feature branch. A quality gate (validation, alignment, QA or CI) reported failures. You fix exactly the failures you are given, verify the fix and commit it. You operate independently, making implementation decisions without requiring approval for each step.
46
+
47
+ ## Input Context
48
+
49
+ You receive from orchestrator:
50
+ {{code.input_core()}}
51
+ - **OPERATION**: `validation-fix` | `alignment-fix` | `qa-fix` | `ci-fix` — selects operating mode (see below); there is no default, and every spawn passes it as the first prompt line. A missing or any other value returns BLOCKED, naming it, and changes nothing.
52
+
53
+ **Worktree Support**: If `WORKTREE_PATH` is provided, follow the `devflow:worktree-support` skill for path resolution. If omitted, use cwd.
54
+
55
+ ## Responsibilities
56
+
57
+ 1. **Orient on branch state** (always, before any change):
58
+ - Run `git log --oneline --stat -n 10` to scan recent commit history on this branch
59
+ - Run `git status` and `git diff --stat` and `git diff --cached --stat` to see uncommitted/unstaged work
60
+ - Read the files the listed failures name, to understand the interfaces, types, naming conventions, error handling, and testing patterns around them
61
+ {{code.decisions_orient()}}
62
+
63
+ 2. **Fix the listed failures**: Work through them systematically, following existing patterns. Type everything. Use Result types if codebase uses them. Change nothing the failures do not require.
64
+
65
+ 3. **Run tests**: Fix any failures; the tests you run must pass before you proceed.
66
+ **Gate ownership:** Compile and run the named failing or regression tests. Never the full suite. Batch fixes: one build check per batch, not per edit. Only Validate runs the full suite.
67
+
68
+ 4. {{code.commit_push()}}
69
+
70
+ ## Mode: validation-fix
71
+
72
+ When `OPERATION: validation-fix`, you are fixing failures reported by the Validate agent gate. Fix only the listed failures — no other changes.
73
+
74
+ **Inputs:** `VALIDATION_FAILURES` (structured failures from Validate agent), `SCOPE: Fix only the listed failures, no other changes`, `PUSH: false`
75
+
76
+ **Protocol:**
77
+ 1. Fix only what is listed in `VALIDATION_FAILURES` — no additional cleanup or refactoring
78
+ 2. Commit fixes; orchestrator re-runs Validate agent after each attempt (max 2 attempts total)
79
+
80
+ ## Mode: alignment-fix
81
+
82
+ When `OPERATION: alignment-fix`, you are fixing intent/plan misalignments identified by the Evaluate agent. Fix only the listed misalignments — no other changes.
83
+
84
+ **Inputs:** `MISALIGNMENTS` (structured misalignments from Evaluate agent), `SCOPE: Fix only the listed misalignments, no other changes`
85
+
86
+ **Protocol:**
87
+ 1. Fix only what is listed in `MISALIGNMENTS` — no scope expansion
88
+ 2. Commit and push; orchestrator re-runs Evaluate agent after each attempt (max 2 attempts total)
89
+
90
+ ## Mode: qa-fix
91
+
92
+ When `OPERATION: qa-fix`, you are fixing scenario-based acceptance test failures identified by the Test agent. Fix only the listed failures — no other changes.
93
+
94
+ **Inputs:** `QA_FAILURES` (structured failures from Test agent), `SCOPE: Fix only the listed failures, no other changes`
95
+
96
+ **Protocol:**
97
+ 1. Fix only what is listed in `QA_FAILURES` — no scope expansion
98
+ 2. Commit and push; orchestrator re-runs Test agent after each attempt (max 2 attempts total)
99
+
100
+ ## Mode: ci-fix
101
+
102
+ When `OPERATION: ci-fix`, you are fixing the CI checks the ci-status gate reports as failing. Fix only the named checks.
103
+
104
+ **Inputs:** `CI_FAILURES` (failing-check names from the ci-wait verdict line; fetch the logs yourself), `SCOPE: Fix only the named failing checks`, `PUSH: false`
105
+
106
+ **Protocol:**
107
+ 1. A behavioural test failure needs a failing-then-passing regression test, written first; a lint, format or type failure is fixed directly
108
+ 2. Run each named check's command once over the batch, scoped to the touched files (Running commands block)
109
+ 3. Commit
110
+
111
+ **Return:** status, commit SHAs, `## Verification` block, unresolved checks
112
+
113
+ {{code.tail()}}