@amsterdamdatalabs/adl-agent-control-linux-x64 0.1.35 → 0.1.46

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 (128) hide show
  1. package/bin/adl +2 -2
  2. package/bin/reconcile +3 -11
  3. package/bin/setup +15 -15
  4. package/package.json +1 -1
  5. package/packages/agent-hooks/deploy-profile.json +1 -1
  6. package/packages/agent-hooks/package.json +1 -1
  7. package/packages/agent-hooks/src/main.ts +23 -2
  8. package/packages/agent-hooks/src/pre-tool-use/handler.ts +2 -2
  9. package/packages/agent-hooks/src/rules/impl/adl-build-run-role.ts +116 -0
  10. package/packages/agent-hooks/src/rules/impl/adl-git-user-override-block.ts +159 -0
  11. package/packages/agent-hooks/src/rules/impl/adl-mcp-cli.ts +22 -12
  12. package/packages/agent-hooks/src/rules/impl/adl-pr-complete-pending.ts +9 -9
  13. package/packages/agent-hooks/src/rules/impl/adl-pr-role.ts +6 -5
  14. package/packages/agent-hooks/src/rules/impl/adl-run-required.ts +11 -5
  15. package/packages/agent-hooks/src/rules/impl/adl-workitem-role.ts +18 -5
  16. package/packages/agent-hooks/src/rules/impl/agent-tamper-protection.ts +30 -25
  17. package/packages/agent-hooks/src/rules/impl/git-core.ts +4 -8
  18. package/packages/agent-hooks/src/rules/impl/git-target.ts +5 -0
  19. package/packages/agent-hooks/src/rules/impl/mcp-tool.ts +4 -2
  20. package/packages/agent-hooks/src/rules/impl/tool-frontend.ts +230 -11
  21. package/packages/agent-hooks/src/rules/registry.ts +11 -2
  22. package/packages/agent-hooks/src/rules/shell/git-identity.ts +1 -1
  23. package/packages/agent-hooks/src/rules/shell/invocation.ts +14 -2
  24. package/packages/agent-hooks/src/rules/shell/protected-carriers.ts +10 -7
  25. package/packages/agent-settings/assets/TARUN-GLOBAL-AGENTS-INSTRUCTIONS.md +2 -2
  26. package/packages/agent-settings/package.json +1 -1
  27. package/packages/agent-settings/src/deploy/agents-deploy.ts +19 -1
  28. package/packages/agent-settings/src/deploy/index.ts +1 -0
  29. package/packages/agent-skills/assets/agent-search-tool-audit/SKILL.md +4 -6
  30. package/packages/agent-skills/assets/code-review/SKILL.md +84 -66
  31. package/packages/agent-skills/assets/diagnosing-bugs/SKILL.md +23 -2
  32. package/packages/agent-skills/assets/diagnosing-bugs/references/FEEDBACK-LOOP-TACTICS.md +1 -1
  33. package/packages/agent-skills/assets/explore-codebase/SKILL.md +3 -2
  34. package/packages/agent-skills/assets/finalize-feature/SKILL.md +63 -0
  35. package/packages/agent-skills/assets/fix-ci/SKILL.md +58 -0
  36. package/packages/agent-skills/assets/handoff/SKILL.md +1 -1
  37. package/packages/agent-skills/assets/implement-feature/SKILL.md +150 -0
  38. package/packages/agent-skills/assets/implement-feature/references/briefs.md +94 -0
  39. package/packages/agent-skills/assets/implement-item/SKILL.md +71 -0
  40. package/packages/agent-skills/assets/mechanics/SKILL.md +38 -0
  41. package/packages/agent-skills/assets/plan-feature/SKILL.md +141 -0
  42. package/packages/agent-skills/assets/prepare-promotion/SKILL.md +90 -0
  43. package/packages/agent-skills/assets/ralplan/SKILL.md +149 -0
  44. package/packages/agent-skills/assets/refactor-safely/SKILL.md +4 -3
  45. package/packages/agent-skills/assets/report-bug/SKILL.md +72 -0
  46. package/packages/agent-skills/assets/review-change/SKILL.md +82 -0
  47. package/packages/agent-skills/assets/review-plan/SKILL.md +124 -0
  48. package/packages/agent-skills/assets/triage-workitems/SKILL.md +99 -0
  49. package/packages/agent-skills/assets/ultragoal/SKILL.md +77 -0
  50. package/packages/agent-skills/assets/validate-design/SKILL.md +64 -0
  51. package/packages/agent-skills/assets/verify-item/SKILL.md +71 -0
  52. package/packages/agent-skills/assets/wayfinder/SKILL.md +1 -1
  53. package/packages/agent-skills/assets/workitems-process/SKILL.md +145 -0
  54. package/packages/agent-skills/assets/workitems-process/references/ado-and-git.md +227 -0
  55. package/packages/agent-skills/assets/workitems-process/references/evidence.md +74 -0
  56. package/packages/agent-skills/assets/workitems-process/references/workitem-states.md +92 -0
  57. package/packages/agent-skills/assets/write-feature/SKILL.md +94 -0
  58. package/packages/agent-skills/dist/deploy.d.ts +52 -0
  59. package/packages/agent-skills/dist/deploy.d.ts.map +1 -1
  60. package/packages/agent-skills/dist/deploy.js +218 -7
  61. package/packages/agent-skills/dist/deploy.js.map +1 -1
  62. package/packages/agent-skills/dist/index.d.ts +1 -1
  63. package/packages/agent-skills/dist/index.d.ts.map +1 -1
  64. package/packages/agent-skills/dist/index.js +1 -1
  65. package/packages/agent-skills/dist/index.js.map +1 -1
  66. package/packages/agent-skills/package.json +1 -1
  67. package/packages/agent-skills/src/deploy.ts +288 -6
  68. package/packages/agent-skills/src/index.ts +10 -1
  69. package/packages/azdo/README.md +13 -4
  70. package/packages/azdo/bunfig.toml +6 -0
  71. package/packages/azdo/package.json +1 -1
  72. package/packages/azdo/scripts/probe-ado-rules.ts +1 -1
  73. package/packages/azdo/src/activity-log.ts +118 -0
  74. package/packages/azdo/src/azdo-attachments.ts +109 -0
  75. package/packages/azdo/src/azdo-pl.ts +100 -3
  76. package/packages/azdo/src/azdo-pr.ts +376 -17
  77. package/packages/azdo/src/azdo-wit.ts +594 -34
  78. package/packages/azdo/src/cli.ts +119 -12
  79. package/packages/azdo/src/lib/client.ts +95 -17
  80. package/packages/azdo/src/lib/validate-pr-metadata.ts +14 -5
  81. package/packages/azdo/src/mcp-server.ts +121 -8
  82. package/packages/azdo/src/tool-dispatch.ts +107 -23
  83. package/packages/azdo/src/workflow-ladder.csv +125 -107
  84. package/packages/azdo/src/workflow-rules.ts +254 -97
  85. package/packages/fleet/src/install-adl-package.ts +4 -3
  86. package/packages/repo-controls/README.md +12 -4
  87. package/packages/repo-controls/assets/promote.ts +1 -0
  88. package/packages/repo-controls/assets/scaffold/docs/AGENTS.md +5 -5
  89. package/packages/repo-controls/assets/scaffold/plans/AGENTS.md +42 -13
  90. package/packages/repo-controls/assets/scaffold/root/CONTRIBUTING.md +5 -5
  91. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/closed_set/test_check.py +0 -11
  92. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/test_check.py +4 -6
  93. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/ledger/test_check.py +15 -0
  94. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/docs-okf-profiles.yaml +1 -17
  95. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-untyped/docs/research/no-type.md +1 -1
  96. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-untyped/docs/research/typed-experiment.md +1 -1
  97. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-untyped/docs/research/typed-research.md +1 -1
  98. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/extra-key.md +1 -1
  99. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/extra-keys.md +1 -1
  100. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-created.md +1 -1
  101. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-description.md +1 -1
  102. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-last-update.md +1 -1
  103. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-status.md +1 -1
  104. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-title.md +1 -1
  105. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/optional-keys.md +1 -1
  106. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/research-ok.md +1 -1
  107. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/test_check.py +3 -22
  108. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/open_work_cap/check.py +39 -182
  109. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/open_work_cap/fixtures/open-work-cap-clean/plans/features/az601-clean/intent.md +17 -0
  110. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/open_work_cap/test_check.py +90 -321
  111. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plan_metadata.py +31 -5
  112. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plans_layout/check.py +282 -54
  113. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plans_layout/fixtures/plans-layout-clean/plans/features/az347-test-coverage/design.md +35 -0
  114. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plans_layout/fixtures/plans-layout-clean/plans/features/az347-test-coverage/file-map-reference.md +19 -0
  115. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plans_layout/fixtures/plans-layout-clean/plans/features/az347-test-coverage/intent.md +25 -0
  116. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plans_layout/fixtures/plans-layout-clean/plans/features/az347-test-coverage/items/az351-restore-entrypoint.md +25 -0
  117. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plans_layout/fixtures/plans-layout-clean/plans/features/az347-test-coverage/requirements.md +44 -0
  118. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plans_layout/fixtures/plans-layout-violation/plans/features/az347-test-coverage/requirements.md +44 -0
  119. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plans_layout/test_check.py +646 -53
  120. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/cli.py +3 -3
  121. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/docs_shape.py +1 -12
  122. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/gate-registry.alt.yaml +1 -1
  123. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/gate-registry.yaml +1 -1
  124. package/packages/repo-controls/package.json +1 -1
  125. package/packages/repo-controls/src/config.ts +21 -2
  126. package/packages/repo-controls/src/doctor.ts +9 -14
  127. package/packages/repo-controls/src/findings-ratchet.ts +12 -0
  128. package/packages/repo-controls/src/hook.ts +61 -4
@@ -10,9 +10,16 @@
10
10
  * `agent-tamper-protection.ts` imports it, rather than two copies that could
11
11
  * drift.
12
12
  *
13
- * Still hard-coded on purpose (not configurable): see
14
- * `impl/agent-tamper-protection.ts`'s header for why an `adl-config.toml`
15
- * allowlist for this rule would be the same "switch the gate off" hole it
13
+ * `adl-config.toml` is NOT in this set. It is a runtime configuration file
14
+ * the agent must be able to edit (Tarun, 2026-10-13: "adl-config.toml can be
15
+ * editted but not committed by the agents"). The COMMIT side is enforced by
16
+ * repo-controls' `integrity.ts` (`WIRING`, refuses a normal commit of
17
+ * `adl-config.toml`) and by `agent-hooks`' `git.protected-tree-commit` rule
18
+ * (Bug 373/PBI 679); both fire on the staged index, not on the working
19
+ * tree.
20
+ *
21
+ * Still hard-coded on purpose (not configurable): a per-repo allowlist in
22
+ * `adl-config.toml` would be the same "switch the gate off" hole this rule
16
23
  * exists to close.
17
24
  */
18
25
 
@@ -29,10 +36,6 @@ export const PROTECTED_CARRIER_PATHS: ReadonlySet<string> = new Set([
29
36
  '.claude/settings.json',
30
37
  '.claude/settings.local.json',
31
38
  '.codex/config.toml',
32
- // `adl-config.toml` was the fourth entry until 2026-10-01 (Tarun: "nobody
33
- // should stop editing adl-config.toml"). It stays human-landed at commit time
34
- // (`git.protected-tree-commit`, repo-controls' integrity gate), but an agent
35
- // can now write it, and every hook run re-reads it.
36
39
  '.codex/hooks.json',
37
40
  '.cursor/hooks.json',
38
41
  '.opencode/plugins/adl-repo.ts',
@@ -6,8 +6,8 @@ Where a repository has its own AGENTS.md, that file and the files it links add t
6
6
  ## Communication
7
7
  - Address me as **Tarun**.
8
8
  - **Answer first.** No greeting, no "let me", no recap of what was just done, no closers.
9
- - One idea per sentence. Short beats polite. Articles can go; not, never, no, only never do. Numbers, paths, commands exact.
10
- - Bullet points over prose.
9
+ - One idea per sentence. Short beats polite. Articles can go; not, never, no, only never do. Numbers, paths, commands exact. **Maximum 100 words** per response
10
+ - **Bullet points over prose**.
11
11
  - **Open points:** one numbered list of open decisions per conversation. Show it only when it changes — item added or resolved. After a long gap or compaction, restate the full list. That is when it gets lost.
12
12
  - **Questions:** one at a time, one or two sentences. Options inline: `A) … B) …`. A long multi-part question means split the work, not more prose.
13
13
  - Full sentences for security warnings, irreversible actions, step-by-step orders, and when I'm confused. Then short resumes.
@@ -6,7 +6,7 @@
6
6
  "description": "Machine-global agent surface tooling (sweep, global-agents, kimi-hooks, surface-policy) run by the fleet bin wrappers under bun; also holds GLOBAL-AGENTS.md, surface policy, and the protected list. Subagent definitions (Claude/Codex/Cursor/Kimi/OpenCode) are canonical in packages/agent-skills/extensions/adl-factory/agents/*.toml and projected per repo by that package's installer; this package does not generate or hold its own copy.",
7
7
  "scripts": {
8
8
  "typecheck": "tsc --noEmit",
9
- "test": "bun test --coverage",
9
+ "test": "bun test --isolate --coverage",
10
10
  "check": "bun run typecheck && bun run test --coverage"
11
11
  },
12
12
  "dependencies": {
@@ -25,6 +25,13 @@ export interface DeployAgentsOptions {
25
25
  readonly agents?: readonly AgentDef[];
26
26
  /** Computes the exact same written/unchanged/removed/conflicts result without writing anything (independent review, 2026-09-29, finding 6). */
27
27
  readonly dryRun?: boolean;
28
+ /**
29
+ * When set, deploy only the named surface (profile.agents.surfaces[].name) —
30
+ * the deploy half of the per-surface knob (az567). Other surfaces are
31
+ * left untouched: their files are not written, their conflicts are not
32
+ * reported, the lock is not rewritten for them.
33
+ */
34
+ readonly surfaceFilter?: string;
28
35
  }
29
36
 
30
37
  interface AgentConflict {
@@ -71,6 +78,10 @@ export function deployAgents(options: DeployAgentsOptions): DeployAgentsResult {
71
78
  let anyLegacyTakeover = false;
72
79
 
73
80
  for (const surface of profile.agents.surfaces) {
81
+ // az567 surfaceFilter: only iterate the named surface. Other
82
+ // surfaces' deploy paths, conflicts, and lock entries are out of
83
+ // scope and never appear in this result.
84
+ if (options.surfaceFilter !== undefined && surface.name !== options.surfaceFilter) continue;
74
85
  const ext = extensionFor(surface);
75
86
  const kept: string[] = [];
76
87
 
@@ -126,7 +137,14 @@ export function deployAgents(options: DeployAgentsOptions): DeployAgentsResult {
126
137
  newAgentEntries[surface.folder] = kept.sort();
127
138
  }
128
139
 
129
- if (!dryRun) writeLock(targetRepo, { schema: 1, mcp: lock.mcp, agents: newAgentEntries });
140
+ // az567 surfaceFilter: when only one surface is in scope, the
141
+ // `newAgentEntries` map only carries that surface. The lock write
142
+ // must keep every other surface's previous lock entry byte-identical
143
+ // so non-target surfaces are not "unwritten" by a per-surface deploy.
144
+ const lockAgents = options.surfaceFilter === undefined
145
+ ? newAgentEntries
146
+ : { ...lock.agents, ...newAgentEntries };
147
+ if (!dryRun) writeLock(targetRepo, { schema: 1, mcp: lock.mcp, agents: lockAgents });
130
148
 
131
149
  // Once anything was actually taken over, this package's own footprint in
132
150
  // the legacy lock's `files` section for these exact agent paths is stale:
@@ -1,6 +1,7 @@
1
1
  export { type DoctorResult } from "./doctor.js";
2
2
  export { listSettings } from "./list.js";
3
3
  export { deploySettings, doctorSettings, type DeploySettingsResult } from "./settings.js";
4
+ export { deployAgents, type DeployAgentsResult } from "./agents-deploy.js";
4
5
  export { loadProfile } from "./profile.js";
5
6
  export { loadMcpSource, type McpServerSpec } from "./mcp-source.js";
6
7
  export { loadAgentSources, type AgentDef } from "./agent-toml.js";
@@ -26,8 +26,7 @@ and its evidence siblings.
26
26
  - The repo has no `.adl/logs/` (no agent-hooks hooks installed).
27
27
  - The question is about a non-search tool (use a different audit
28
28
  script).
29
- - The repo is not a git repo and the script's `git rev-parse
30
- --show-toplevel` fallback cannot find the project root — pass
29
+ - The repo has no project root the script can find — pass
31
30
  `--out <absolute-dir>` to write the report elsewhere.
32
31
 
33
32
  ## Process
@@ -42,8 +41,7 @@ After deploy, the script lives at:
42
41
 
43
42
  In dev (this repo's `packages/agent-skills/`), the equivalent path is
44
43
  `packages/agent-skills/assets/agent-search-tool-audit/scripts/audit.sh`.
45
- The script finds the project root via `git rev-parse --show-toplevel`,
46
- so it works in both layouts.
44
+ The script locates the project root, so it works in both layouts.
47
45
 
48
46
  ### 2. Run with the desired window
49
47
 
@@ -133,8 +131,8 @@ Rationale moved out of `scripts/audit.sh` (REP-007: no multi-line comments).
133
131
  `hooks-deny.log` (read-only history, never migrated, deduped against the new ones);
134
132
  `.adl/logs/agents/tool-calls.log` (`adl run` lifecycle).
135
133
  - Path discovery: the script lives in the agent-skills asset tree (5 levels deep in dev, 4 once
136
- deployed to `.agents/skills/`), so it uses `git rev-parse --show-toplevel` to work in both layouts
137
- and falls back to the dev layout if git is missing.
134
+ deployed to `.agents/skills/`), so it locates the project root to work in both layouts
135
+ and falls back to the dev layout if it cannot.
138
136
  - Required tools: `jq`, `python3` and `rg`; each is checked up front and the script fails loud
139
137
  (exit 1) naming the missing one. `rg` is a protected bootstrap tool on every managed machine.
140
138
  - Cost: under 30 s on a typical 2-3 MB log set; no network.
@@ -1,100 +1,118 @@
1
1
  ---
2
2
  name: code-review
3
- description: Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes — Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/PRD asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to "review since X".
4
- disable-model-invocation: false
3
+ description: Run a comprehensive code review
5
4
  ---
6
5
 
7
- # Code Review
8
- Two-axis review of the diff between `HEAD` and a fixed point the user supplies:
6
+ # Code Review Task Card
9
7
 
10
- - **Standards** — does the code conform to this repo's documented coding standards?
11
- - **Spec** — does the code faithfully implement the originating issue / PRD / spec?
8
+ Use this explicit opt-in for a merge-readiness review. Shared operating invariants
9
+ live in `templates/AGENTS.md`; this card only defines review-specific behavior.
12
10
 
13
- Both axes run as **parallel sub-agents** so they don't pollute each other's context, then this skill aggregates their findings.
11
+ ## When to use
14
12
 
15
- ## Use When
13
+ - The user asks for a code review or quality/security assessment.
14
+ - A change is ready for review before merge, or a major feature needs an independent review.
15
+ - Do not activate this card for implementation, broad planning, or automatic cleanup.
16
16
 
17
- - The user wants to review a branch, a PR, or work-in-progress changes against a fixed point.
18
- - The user asks to "review since X" (a commit, branch, tag, or merge-base).
17
+ ## Inputs
19
18
 
20
- ## Do Not Use When
19
+ - Scope: the requested files, commit, PR, or whole diff.
20
+ - Requirements/specification, acceptance criteria, and relevant test/CI evidence.
21
+ - Existing review artifacts and known risks, if any.
22
+ - If the user says `continue`, advance the current verified review step rather than restarting discovery.
21
23
 
22
- - There is no fixed point to diff against and the user won't supply one (pin one first, see Process step 1), or the work isn't implemented yet so there's no diff to review — use `implement` first.
24
+ Start by recording the scope:
23
25
 
24
- The issue tracker should have been provided to you — run `/setup-matt-pocock-skills` if `docs/agents/issue-tracker.md` is missing.
26
+ ```sh
27
+ git status --short
28
+ git diff --stat
29
+ git diff -- <scope>
30
+ ```
25
31
 
26
- ## Process
32
+ ## Execution
27
33
 
28
- ### 1. Pin the fixed point
34
+ 1. Identify changed files and review boundaries; do not silently widen the scope.
35
+ 2. Launch the `code-reviewer` and `architect` agents in parallel. Both lanes run in parallel on a clean context with explicit scope and artifacts. If either lane cannot be launched or does not return evidence, report `independent review unavailable`; do **not** substitute the current/authoring lane, and do **not** approve or mark the review merge-ready.
36
+ 3. Respect the user's current model and reasoning/effort selection. Do not pass `model` or `reasoning_effort` overrides in review-lane calls.
29
37
 
30
- Whatever the user said is the fixed point — a commit SHA, branch name, tag, `main`, `HEAD~5`, etc. If they didn't specify one, ask for it.
38
+ ```text
39
+ task(
40
+ agent_type="code-reviewer",
41
+ prompt="CODE REVIEW TASK
31
42
 
32
- Capture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, so the comparison is against the merge-base). Also note the list of commits via `git log <fixed-point>..HEAD --oneline`.
43
+ Review the supplied scope for spec compliance, security, quality, performance, and maintainability.
44
+ Return files reviewed, severity-rated findings with file:line evidence and concrete fixes,
45
+ and a recommendation: APPROVE / REQUEST CHANGES / COMMENT. Do not review architecture.
46
+ Scope: [scope and artifacts]"
47
+ )
33
48
 
34
- Before going further, confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty. A bad ref or empty diff should fail here — not inside two parallel sub-agents.
49
+ task(
50
+ agent_type="architect",
51
+ prompt="ARCHITECTURE / DEVIL'S-ADVOCATE REVIEW TASK
35
52
 
36
- ### 2. Identify the spec source
53
+ Review the same scope for boundaries, interfaces, hidden coupling, long-term tradeoffs,
54
+ and the strongest counterargument against approval. Return file:line evidence,
55
+ recommendations, and Architectural Status: CLEAR / WATCH / BLOCK.
56
+ Scope: [scope and artifacts]"
57
+ )
58
+ ```
37
59
 
38
- Look for the originating spec, in this order:
60
+ ## Review taxonomy
39
61
 
40
- 1. Issue references in the commit messages (`#123`, `Closes #45`, GitLab `!67`, etc.) — fetch via the workflow in `docs/agents/issue-tracker.md`.
41
- 2. A path the user passed as an argument.
42
- 3. A PRD/spec file under `docs/`, `specs/`, or `.adl/` matching the branch name or feature.
43
- 4. If nothing is found, ask the user where the spec is. If they say there isn't one, the **Spec** sub-agent will skip and report "no spec available".
62
+ - `code-reviewer` checks **Security**, **Code Quality**, **Performance**, **Best Practices**, and **Maintainability**.
63
+ - Rate each finding: **CRITICAL** (security or data-loss blocker), **HIGH** (bug/major smell), **MEDIUM** (important improvement), or **LOW** (style/suggestion).
64
+ - `architect` checks explicit boundaries/interfaces, hidden coupling, long-horizon tradeoffs, and devil's-advocate concerns. Status is **CLEAR**, **WATCH** (non-blocking concern), or **BLOCK** (merge blocker).
65
+ - Every finding names `file:line`, issue, risk, and a concrete fix; distinguish facts from suggestions.
44
66
 
45
- ### 3. Identify the standards sources
67
+ ## State/HUD Phase Contract
46
68
 
47
- Anything in the repo that documents how code should be written, such as `CODING_STANDARDS.md` or `CONTRIBUTING.md`.
69
+ - Standalone `$code-review` relies on hook-owned `skill-active-state.json` (`skill:"code-review"`, `phase:"planning"`); do not create `code-review-state.json`.
70
+ - Inside Autopilot, keep `mode:"autopilot"` active with `current_phase:"code-review"` / skill-active `phase:"code-review"`; do not activate a peer workflow.
71
+ - On clean review, persist the artifact under Autopilot `handoff_artifacts.code_review` before moving to `ultraqa`. On non-clean review, persist findings and use `rework` or `ralplan` as appropriate.
48
72
 
49
- On top of whatever the repo documents, the Standards axis always carries the **smell baseline** below — a fixed set of Fowler code smells (_Refactoring_, ch.3) that applies even when a repo documents nothing. Two rules bind it:
73
+ ```sh
74
+ adw state write --input '{"mode":"autopilot","active":true,"current_phase":"code-review"}' --json
75
+ ```
50
76
 
51
- - **The repo overrides.** A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell.
52
- - **Always a judgement call.** Each smell is a labelled heuristic ("possible Feature Envy"), never a hard violation — and, like any standard here, skip anything tooling already enforces.
77
+ ## Final Synthesis and gate
53
78
 
54
- Each smell reads *what it is* → *how to fix*; match it against the diff:
79
+ ### Architectural Status Contract
55
80
 
56
- - **Mysterious Name** — a function, variable, or type whose name doesn't reveal what it does or holds. → rename it; if no honest name comes, the design's murky.
57
- - **Duplicated Code** — the same logic shape appears in more than one hunk or file in the change. → extract the shared shape, call it from both.
58
- - **Feature Envy** — a method that reaches into another object's data more than its own. → move the method onto the data it envies.
59
- - **Data Clumps** — the same few fields or params keep travelling together (a type wanting to be born). → bundle them into one type, pass that.
60
- - **Primitive Obsession** — a primitive or string standing in for a domain concept that deserves its own type. → give the concept its own small type.
61
- - **Repeated Switches** — the same `switch`/`if`-cascade on the same type recurs across the change. → replace with polymorphism, or one map both sites share.
62
- - **Shotgun Surgery** — one logical change forces scattered edits across many files in the diff. → gather what changes together into one module.
63
- - **Divergent Change** — one file or module is edited for several unrelated reasons. → split so each module changes for one reason.
64
- - **Speculative Generality** — abstraction, parameters, or hooks added for needs the spec doesn't have. → delete it; inline back until a real need shows.
65
- - **Message Chains** — long `a.b().c().d()` navigation the caller shouldn't depend on. → hide the walk behind one method on the first object.
66
- - **Middle Man** — a class or function that mostly just delegates onward. → cut it, call the real target direct.
67
- - **Refused Bequest** — a subclass or implementer that ignores or overrides most of what it inherits. → drop the inheritance, use composition.
81
+ Combine the `code-reviewer` recommendation and architect status. Approval requires explicit evidence from both independent lanes; missing or failed delegation is a blocking unavailable-review state, not an approval fallback. The final report must make architect blockers impossible to miss.
68
82
 
69
- ### 4. Spawn both sub-agents in parallel
83
+ - If architect status is **BLOCK**, final recommendation is **REQUEST CHANGES**.
84
+ - Else if `code-reviewer` recommendation is **REQUEST CHANGES**, final recommendation is **REQUEST CHANGES**.
85
+ - Else if architect status is **WATCH**, final recommendation is **COMMENT**.
86
+ - Else final recommendation follows the `code-reviewer` lane.
70
87
 
71
- Send a single message with two `Agent` tool calls. Use the `general-purpose` subagent for both.
88
+ Approval criteria: **APPROVE** only when `code-reviewer` returns APPROVE, architect status is `CLEAR`, and both independent lanes returned evidence. **REQUEST CHANGES** for a blocker, unresolved high/critical finding, or unavailable lane. **COMMENT** may record non-blocking findings.
72
89
 
73
- **Standards sub-agent prompt** — include:
90
+ Do not self-review as a fallback. If the `code-reviewer` or `architect` path is missing, unavailable, skipped, or fails, block approval until independent lane evidence exists. Plain `code-review` itself remains read-only and does **not** promise auto-fix.
74
91
 
75
- - The full diff command and commit list.
76
- - The list of standards-source files you found in step 3, **plus the smell baseline from step 3** pasted in full — the sub-agent has no other access to it.
77
- - The brief: "Report — per file/hunk where relevant — (a) every place the diff violates a documented standard: cite the standard (file + the rule); and (b) any baseline smell you spot: name it and quote the hunk. Distinguish hard violations from judgement calls — documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repo standard overrides the baseline. Skip anything tooling enforces. Under 400 words."
92
+ ## Evidence/output contract
78
93
 
79
- **Spec sub-agent prompt** — include:
94
+ Return a concise report containing:
80
95
 
81
- - The diff command and commit list.
82
- - The path or fetched contents of the spec.
83
- - The brief: "Report: (a) requirements the spec asked for that are missing or partial; (b) behaviour in the diff that wasn't asked for (scope creep); (c) requirements that look implemented but where the implementation looks wrong. Quote the spec line for each finding. Under 400 words."
96
+ ```text
97
+ CODE REVIEW REPORT
98
+ Files Reviewed: <count>
99
+ Total Issues: 0
100
+ Architectural Status: CLEAR | WATCH | BLOCK
101
+ CRITICAL (0) | HIGH (0) | MEDIUM (0) | LOW (0)
102
+ Findings: file:line -> issue, risk, concrete fix (or none)
103
+ ARCHITECTURE WATCHLIST: concern, status, recommendation (or none)
104
+ - code-reviewer recommendation: COMMENT
105
+ - architect status: WATCH
106
+ - final recommendation: COMMENT
107
+ RECOMMENDATION: COMMENT
108
+ ```
84
109
 
85
- If the spec is missing, skip the Spec sub-agent and note this in the final report.
110
+ Replace the illustrative counts and verdict with observed values. Include scope,
111
+ lane evidence/artifact references, unresolved risks, and validation gaps.
86
112
 
87
- ### 5. Aggregate
113
+ ## Exit condition
88
114
 
89
- Present the two reports under `## Standards` and `## Spec` headings, verbatim or lightly cleaned. Do **not** merge or rerank findings — the two axes are deliberately separate (see _Why two axes_).
90
-
91
- End with a one-line summary: total findings per axis, and the worst issue _within each axis_ (if any). Don't pick a single winner across axes — that's the reranking the separation exists to prevent.
92
-
93
- ## Why two axes
94
-
95
- A change can pass one axis and fail the other:
96
-
97
- - Code that follows every standard but implements the wrong thing → **Standards pass, Spec fail.**
98
- - Code that does exactly what the issue asked but breaks the project's conventions → **Spec pass, Standards fail.**
99
-
100
- Reporting them separately stops one axis from masking the other.
115
+ Stop when the scoped diff has two independent lane results and a deterministic final
116
+ recommendation. Report `APPROVE` only under the approval criteria; otherwise leave a
117
+ bounded `REQUEST CHANGES`, `COMMENT`, or unavailable-review result. Never claim
118
+ merge-ready without the required evidence.
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: diagnosing-bugs
3
- description: Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.
3
+ description: Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", reports something broken/throwing/failing/slow, or asks to trace a crash or root cause through the call chain.
4
+ keywords: trace crash root cause call chain execution flow callers callees failing throwing regression diagnose debug
4
5
  disable-model-invocation: false
5
6
  ---
6
7
 
@@ -53,6 +54,24 @@ Once it's red, shrink the repro to the **smallest scenario that still goes red**
53
54
 
54
55
  Done when **every remaining element is load-bearing** — removing any one of them makes the loop go green. Do not proceed until you have reproduced **and** minimised.
55
56
 
57
+ ## Trace with the knowledge graph
58
+
59
+ When the symptom names a code area, or a recent change is the suspect, trace
60
+ the call structure with the knowledge graph instead of reading file by file —
61
+ this is how Phase 3 hypotheses get built fast:
62
+
63
+ 1. Run `crg search "<query>"` to find code related to the issue.
64
+ 2. Run `crg query callers_of <target>` and `crg query callees_of <target>` to trace call chains.
65
+ 3. Run `crg flow --name <n>` to see full execution paths through suspected areas.
66
+ 4. Run `crg detect-changes --base <ref>` to check if recent changes caused the issue.
67
+ 5. Run `crg impact --files <f…>` on suspected files to see what else is affected.
68
+
69
+ - Check both callers and callees to understand the full context.
70
+ - Look at affected flows to find the entry point that triggers the bug.
71
+ - Recent changes are the most common source of new issues.
72
+ - Trace efficiently: capped output (`--limit`, `--brief`), a handful of commands,
73
+ then verify the suspected cause against real source before proposing a fix.
74
+
56
75
  ## Phase 3 — Hypothesise
57
76
 
58
77
  Generate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.
@@ -99,10 +118,12 @@ Required before declaring done:
99
118
 
100
119
  **Then ask: what would have prevented this bug?** If the answer involves architectural change (no good test seam, tangled callers, hidden coupling) hand off to the `/improve-codebase-architecture` skill with the specifics. Make the recommendation **after** the fix is in, not before — you have more information now than when you started.
101
120
 
102
- ## HITL loop script
121
+ ## HITL loop script — live sessions only
103
122
 
104
123
  `scripts/hitl-loop.template.sh` is the human-in-the-loop reproduction loop (usage notes moved out of the script so the deployed copy has no multi-line comment run).
105
124
 
125
+ **Live sessions only** — a session where the human is present (`write-feature`-style live work, or this skill invoked interactively). Never inside a dispatched run: No block forbids waiting on a person, and run evidence must be machine-checkable. In a dispatched run a human-only repro is automated instead (Playwright drives the clicks — tactic 4) or, if that genuinely fails, the lead posts the attempt as a finding and parks the item with proof. In a live session the captured `KEY=VALUE` pairs are the human's testimony, and the regression test built from them still lands before the fix.
126
+
106
127
  - Copy the file, edit the steps in it, and run it. The agent runs the script; the user follows prompts in their terminal.
107
128
  - Usage: `bash hitl-loop.template.sh`
108
129
  - Two helpers: `step "<instruction>"` shows the instruction and waits for Enter; `capture VAR "<question>"` shows the question and reads the response into `VAR`.
@@ -11,7 +11,7 @@
11
11
  7. **Property / fuzz loop.** If the bug is "sometimes wrong output", run 1000 random inputs and look for the failure mode.
12
12
  8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate "boot at state X, check, repeat" so you can `git bisect run` it.
13
13
  9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.
14
- 10. **HITL bash script.** Last resort. If a human must click, drive _them_ with `scripts/hitl-loop.template.sh` so the loop is still structured. Captured output feeds back to you.
14
+ 10. **HITL bash script.** If a human must click, drive _them_ with `scripts/hitl-loop.template.sh` so the loop is still structured. **Live sessions only** — never inside a dispatched run (No block: never wait on a person; run evidence must be machine-checkable). In a run, automate the human instead (Playwright, tactic 4); if that genuinely fails, the lead parks the item with proof. Captured output feeds back to you.
15
15
 
16
16
  Build the right feedback loop, and the bug is 90% fixed.
17
17
 
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: explore-codebase
3
3
  description: Navigate and understand codebase structure using the knowledge graph
4
+ keywords: navigate orient structure understand unfamiliar get oriented modules
4
5
  disable-model-invocation: false
5
6
  ---
6
7
 
@@ -16,8 +17,8 @@ relationships before making a change, or locating where a concept lives.
16
17
  ## Do Not Use When
17
18
 
18
19
  You already know where the problem is and need to trace a bug — use
19
- `debug-issue`. You are about to refactor a known target — use
20
- `refactor-safely`. You are reviewing a pending diff — use `review-changes`.
20
+ `diagnosing-bugs`. You are about to refactor a known target — use
21
+ `refactor-safely`. You are reviewing a pending diff — use `code-review`.
21
22
 
22
23
  ## Steps
23
24
 
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: finalize-feature
3
+ description: Assemble the content for the one Feature implementation PR without pushing - the five-section PR body and the implementation report for all items - and check that the design's docs impact is in the diff. Returns text to the lead. Use when the implementation lead spawns writer after the Feature-final check passed at the final head.
4
+ metadata:
5
+ step: "finalize"
6
+ role: "writer"
7
+ states: "Updating Docs"
8
+ ---
9
+
10
+ # Finalize Feature (sub-agent skill)
11
+
12
+ Load `workitems-process` first. You are a leaf sub-agent of `lead` (`implement-feature`). Evidence assembly only. Docs were written in `implement-item` and reviewed with the code; you make **no pushes, commits, file edits or board writes**, because any push voids the Feature-final evidence. The lead raises the PR; `pr_create_or_update` links the items, moves them and attaches the report **[pending P1/P2/P4]**. You supply content only.
13
+
14
+ ## When to use
15
+
16
+ - The lead holds a Feature-final verify `PASS` and both review lanes passing at the final head `H`, and items are code-complete (Updating Docs or about to be).
17
+ - Also on a CI round: the lead asks you to append that round to the report.
18
+ - Not for writing docs, fixing code or resolving conflicts.
19
+
20
+ ## Inputs (from the brief)
21
+
22
+ - Final head `H`, `base_sha`, all per-item sub-agent reports (implement, verify, review) and their finding resolutions, the Feature-final reports, design-update commits, CI rounds so far.
23
+ - Plan folder: `requirements.md`, `design.md` (`## Docs impact`), item files.
24
+
25
+ ## Preconditions
26
+
27
+ 1. The branch head equals `H` and the worktree is clean; else return it to the lead as a finding and stop ([No block](../workitems-process/SKILL.md#no-block)).
28
+ 2. The Feature-final verify is `PASS` and code is `APPROVE` and architecture `CLEAR`/`WATCH`, all at `H`; else return it to the lead as a finding and stop ([No block](../workitems-process/SKILL.md#no-block)).
29
+
30
+ ## Procedure
31
+
32
+ 1. **Docs check.** For each entry in `design.md` `## Docs impact` (per-Bug run: the docs the fix touches), find the matching path in the diff against `H` and read the hunk, not just the filename. "No docs impact" counts as covered. Any missing entry: verdict `REWORK`, finding `docs-missing` (`where`: doc path or section; `fix`: what to write). Stop.
33
+ 2. **PR body.** The five non-empty sections (Summary, Why, Changes, Test plan, Security impact considered), filled as below. Every claim links to evidence (a report, a commit, a run); no unverified statements.
34
+ - `## Summary`: what the Feature delivers, by item (id, title).
35
+ - `## Why`: from `intent.md` and `requirements.md`, in the plan's words, not new claims.
36
+ - `## Changes`: per item, the files and behaviour changed; design updates made during the run; docs touched.
37
+ - `## Test plan`: per `AC-n`, the test and its result; Feature-final verify run at `H`; CI status as known.
38
+ - `## Security impact considered`: what the code reviewer examined and found; "none" only with the reviewer's report as the source.
39
+ The title is `<type>(<scope>): <lowercase subject>`.
40
+ 3. **Implementation report** (becomes `impl-report-pr<id>.md`). Per item: changes, tests (`AC-n` → test, red then green), review findings (id, severity, resolution or accepted WATCH), rounds used. Then: design updates, Feature-final heads and results, CI rounds. Facts only, from the reports.
41
+ 4. **Return** `lane: finalize`, `head_sha` = `H`, `verdict`, and in the reply the PR body, the report text and the docs-impact table (entry → doc path), each in its own fenced block. Write them nowhere.
42
+
43
+ ## Verdicts
44
+
45
+ | Verdict | When | Lead does |
46
+ |---|---|---|
47
+ | `DONE` | Docs covered; body and report complete | Pushes and raises the PR |
48
+ | `REWORK` + `docs-missing` | Docs impact not in the diff | Executor writes it; Feature-final repeats |
49
+
50
+ ## Stop rules
51
+
52
+ - One pass, against the `head_sha` recorded at start. If HEAD moves while you work, finish against that `head_sha` and say so; never restart. The lead re-runs you at the new head ([Evidence and reports](../workitems-process/SKILL.md#evidence-and-reports), the head rule).
53
+
54
+ ## Never
55
+
56
+ - Never push, commit, rebase or edit files. Never write the body or report to disk.
57
+ - Never call `pr_create_or_update` or any board tool; never link items, set auto-complete, vote or merge.
58
+ - Never include a claim without a source, or a PR link that does not resolve.
59
+ - Never write the docs yourself.
60
+
61
+ ## Parked
62
+
63
+ `prepare-promotion` (integration to main, G2) is parked: no target fires it. It stays with `writer`, for later.
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: fix-ci
3
+ description: Make the smallest fix for a red CI run on the run's implementation PR (a Feature's, or a Fixes Bug's) - read the failing job, reproduce it locally, fix at the cause, commit on the run's branch, no skips and no masking. Use when the implementation lead spawns executor for the CI stage after the PR checks went red.
4
+ metadata:
5
+ step: "fix-ci"
6
+ role: "executor"
7
+ states: "CI stage"
8
+ ---
9
+
10
+ # Fix CI (sub-agent skill)
11
+
12
+ Load `workitems-process` first. You are a leaf sub-agent of `lead` (`implement-feature`), the fix lane of the CI stage (ADR-019). CI is the last gate before the implementation PR (the Feature's, or the Fixes Bug's) merges to `integration`. A hard cut: the fix is the smallest change that makes the real check pass.
13
+
14
+ ## When to use
15
+
16
+ - The PR's required check failed at head `H`. The lead names the PR id, the failed build and job ids, and the related item.
17
+ - A merge-conflict round is not yours; the lead sends an executor with `implement-item`.
18
+
19
+ ## Inputs (from the brief)
20
+
21
+ - PR id, build id, failed job(s), head SHA, related item id (the item whose commits touch the failing paths; else the lowest-id item; in a per-Bug run, the Bug), plan folder (in a per-Bug run, the Bug's item file).
22
+
23
+ ## Preconditions
24
+
25
+ 1. Worktree toplevel and HEAD equal the brief's; tree is clean; branch is the run's branch (the Feature branch, or `fix/az<bug id>-<slug>` in a per-Bug run).
26
+ 2. The failing job log is readable (`build_list_or_get --build-id <id>`, with `--tail`). Unreadable: return it to the lead as a finding and stop ([No block](../workitems-process/SKILL.md#no-block)).
27
+
28
+ ## Procedure
29
+
30
+ 1. **Read the log.** Find the first failing step, its command and its error. Quote the failing line.
31
+ 2. **Classify.**
32
+ - Code or test failure: continue.
33
+ - Infrastructure failure (agent lost, cancelled, network, queue timeout) with log proof and no code cause: return `INFRA` with the proof. The lead may re-queue the PR's own validation (pending H1). Do not change code.
34
+ 3. **Reproduce locally** with the same command. A failure you cannot reproduce is reported with both outputs, not "fixed" by guessing.
35
+ 4. **Fix at the cause.** Test first when the failure exposes a missing test. Smallest change; no unrelated cleanup; no new abstraction.
36
+ 5. **Checks.** Run the failing command and the repo's lint, typecheck, build and the relevant tests locally. Green.
37
+ 6. **Commit** on the run's branch: `fix(ci): <lowercase subject>`, `AB#<item id>` in the body (the Bug's id in a per-Bug run), naming the build and job. Do not push.
38
+ 7. **Return the report**: `lane: fix-ci`, `head_sha` = your commit, `verdict`, `findings` (the cause: `where`, `what`, `fix`), `artifacts` = failing log line, local red and green runs, commit SHA.
39
+
40
+ ## Verdicts
41
+
42
+ | Verdict | When |
43
+ |---|---|
44
+ | `FIXED` | Reproduced, fixed at the cause, local checks green, committed |
45
+ | `INFRA` | Not a code failure; log proof included; nothing changed |
46
+
47
+ The lead then has `verifier` and `code-reviewer` re-check the delta at the new head. A fix is not done until they pass.
48
+
49
+ ## Stop rules
50
+
51
+ - The same check fails after three distinct fixes: return it to the lead as a finding and stop ([No block](../workitems-process/SKILL.md#no-block)).
52
+
53
+ ## Never
54
+
55
+ - Never skip, disable, quarantine or loosen a test or check. Never `|| true`. Never `--no-verify`. Never delete a failing test.
56
+ - Never re-run until green and call it fixed; a flaky result is reported with both runs.
57
+ - Never push, force-push, re-queue a build, move an item or touch the PR.
58
+ - Never edit `requirements.md` or `design.md`.
@@ -21,7 +21,7 @@ Write a handoff document summarising the current conversation so a fresh agent c
21
21
 
22
22
  Include a "suggested skills" section in the document, which suggests skills that the agent should invoke.
23
23
 
24
- Do not duplicate content already captured in other artifacts (specs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.
24
+ Do not duplicate content already captured in other artifacts (docs, plans, ADRs, commits, diffs). Reference them by path or URL instead.
25
25
 
26
26
  Redact any sensitive information, such as API keys, passwords, or personally identifiable information.
27
27