auditor-lambda 0.2.8 → 0.2.9

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 (98) hide show
  1. package/README.md +6 -0
  2. package/audit-code-wrapper-lib.mjs +1 -1
  3. package/dist/adapters/eslint.js +9 -5
  4. package/dist/cli.d.ts +42 -1
  5. package/dist/cli.js +114 -64
  6. package/dist/extractors/bucketing.d.ts +4 -0
  7. package/dist/extractors/bucketing.js +6 -2
  8. package/dist/extractors/disposition.d.ts +4 -0
  9. package/dist/extractors/disposition.js +6 -2
  10. package/dist/extractors/fileInventory.js +24 -28
  11. package/dist/extractors/flows.d.ts +5 -0
  12. package/dist/extractors/flows.js +18 -38
  13. package/dist/extractors/pathPatterns.d.ts +10 -3
  14. package/dist/extractors/pathPatterns.js +109 -61
  15. package/dist/extractors/surfaces.d.ts +4 -0
  16. package/dist/extractors/surfaces.js +11 -11
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +2 -1
  19. package/dist/io/artifacts.d.ts +55 -40
  20. package/dist/io/artifacts.js +73 -110
  21. package/dist/io/json.js +52 -21
  22. package/dist/io/runArtifacts.d.ts +1 -1
  23. package/dist/io/runArtifacts.js +26 -3
  24. package/dist/orchestrator/advance.js +83 -62
  25. package/dist/orchestrator/flowCoverage.js +11 -5
  26. package/dist/orchestrator/flowPlanning.d.ts +7 -2
  27. package/dist/orchestrator/flowPlanning.js +46 -21
  28. package/dist/orchestrator/flowRequeue.js +28 -8
  29. package/dist/orchestrator/internalExecutors.js +12 -8
  30. package/dist/orchestrator/planning.js +25 -3
  31. package/dist/orchestrator/requeue.js +11 -1
  32. package/dist/orchestrator/taskBuilder.d.ts +4 -2
  33. package/dist/orchestrator/taskBuilder.js +153 -52
  34. package/dist/orchestrator/unitBuilder.d.ts +3 -1
  35. package/dist/orchestrator/unitBuilder.js +24 -16
  36. package/dist/prompts/renderWorkerPrompt.d.ts +1 -1
  37. package/dist/prompts/renderWorkerPrompt.js +16 -8
  38. package/dist/providers/claudeCodeProvider.d.ts +4 -1
  39. package/dist/providers/claudeCodeProvider.js +8 -5
  40. package/dist/providers/localSubprocessProvider.d.ts +4 -0
  41. package/dist/providers/localSubprocessProvider.js +7 -2
  42. package/dist/providers/spawnLoggedCommand.d.ts +9 -1
  43. package/dist/providers/spawnLoggedCommand.js +77 -29
  44. package/dist/reporting/synthesis.d.ts +2 -0
  45. package/dist/reporting/synthesis.js +12 -9
  46. package/dist/supervisor/operatorHandoff.js +48 -18
  47. package/dist/supervisor/runLedger.d.ts +1 -1
  48. package/dist/supervisor/runLedger.js +112 -5
  49. package/dist/supervisor/sessionConfig.js +10 -10
  50. package/dist/types/externalAnalyzer.d.ts +3 -0
  51. package/dist/types/flowCoverage.d.ts +5 -1
  52. package/dist/types/flowCoverage.js +5 -1
  53. package/dist/types/flows.d.ts +5 -1
  54. package/dist/types/flows.js +1 -1
  55. package/dist/types/runLedger.d.ts +5 -1
  56. package/dist/types/runLedger.js +6 -1
  57. package/dist/types/runtimeValidation.d.ts +12 -3
  58. package/dist/types/runtimeValidation.js +16 -1
  59. package/dist/types/sessionConfig.d.ts +15 -2
  60. package/dist/types/sessionConfig.js +15 -1
  61. package/dist/types/surfaces.d.ts +4 -1
  62. package/dist/types/surfaces.js +1 -1
  63. package/dist/types/workerSession.d.ts +9 -0
  64. package/dist/types/workerSession.js +5 -1
  65. package/dist/validation/artifacts.d.ts +1 -1
  66. package/dist/validation/artifacts.js +33 -20
  67. package/dist/validation/auditResults.d.ts +2 -2
  68. package/dist/validation/auditResults.js +7 -15
  69. package/dist/validation/basic.d.ts +9 -1
  70. package/dist/validation/basic.js +40 -3
  71. package/dist/validation/sessionConfig.d.ts +4 -2
  72. package/dist/validation/sessionConfig.js +62 -15
  73. package/docs/agent-integrations.md +29 -9
  74. package/docs/next-steps.md +21 -4
  75. package/docs/packaging.md +14 -0
  76. package/docs/product-direction.md +22 -0
  77. package/docs/production-launch-bar.md +2 -0
  78. package/docs/releasing.md +17 -0
  79. package/docs/remediation-baseline.md +75 -0
  80. package/docs/run-flow.md +23 -11
  81. package/docs/session-config.md +50 -5
  82. package/docs/supervisor.md +7 -0
  83. package/docs/workflow-refactor-brief.md +177 -0
  84. package/package.json +1 -1
  85. package/schemas/audit_result.schema.json +4 -1
  86. package/schemas/audit_task.schema.json +3 -1
  87. package/schemas/coverage_matrix.schema.json +3 -3
  88. package/schemas/critical_flows.schema.json +6 -2
  89. package/schemas/file_disposition.schema.json +2 -2
  90. package/schemas/finding.schema.json +9 -4
  91. package/schemas/flow_coverage.schema.json +2 -2
  92. package/schemas/repo_manifest.schema.json +4 -4
  93. package/schemas/risk_register.schema.json +2 -2
  94. package/schemas/runtime_validation_report.schema.json +2 -2
  95. package/schemas/runtime_validation_tasks.schema.json +8 -2
  96. package/schemas/surface_manifest.schema.json +6 -3
  97. package/schemas/unit_manifest.schema.json +3 -2
  98. package/skills/audit-code/SKILL.md +5 -0
@@ -14,6 +14,17 @@ Normal product usage should:
14
14
  - avoid manual `--root`, provider flags, and model selection in normal use
15
15
  - let the supervisor advance the audit automatically until it completes or no further automatic progress is possible
16
16
 
17
+ ## Review ownership rule
18
+
19
+ Semantic review should stay with the active conversation agent by default.
20
+
21
+ That means:
22
+
23
+ - use the current host conversation as the normal owner of review work
24
+ - if the host agent can delegate to subagents in parallel, let the host runtime make that decision
25
+ - do not treat `.audit-artifacts/session-config.json` as the normal way to choose a second LLM for review
26
+ - treat backend provider adapters as compatibility bridges for fallback CLI usage only
27
+
17
28
  ## Conversation-first setup
18
29
 
19
30
  The canonical prompt asset is:
@@ -136,7 +147,11 @@ Terminal interpretation:
136
147
  - `audit_state.status === "complete"` means the audit finished end to end.
137
148
  - `audit_state.status === "blocked"` means the wrapper exhausted automatic work and the remaining review still needs imported results or a provider-capable continuation path.
138
149
 
139
- When `provider` is configured as `claude-code`, `opencode`, `subprocess-template`, or `vscode-task`, the wrapper can now continue through audit-task review in the same invocation as long as that provider can write structured `AuditResult[]` output and hand control back to the bounded worker command.
150
+ Current implementation note:
151
+
152
+ - the backend fallback still supports explicit provider bridges such as `claude-code`, `opencode`, `subprocess-template`, and `vscode-task`
153
+ - those bridges are compatibility modes, not the intended default review owner
154
+ - the intended long-term workflow is documented in [docs/workflow-refactor-brief.md](/C:/Code/auditor-lambda/docs/workflow-refactor-brief.md)
140
155
 
141
156
  When additional evidence exists, pass it into the same wrapper:
142
157
 
@@ -149,6 +164,7 @@ audit-code --external-analyzer-results /path/to/external_analyzer_results.json
149
164
  Each response also refreshes `.audit-artifacts/operator-handoff.json` and `.audit-artifacts/operator-handoff.md` so operators can see the pending obligations, suggested import paths, and session-config continuation hint without reconstructing the state manually.
150
165
 
151
166
  Everything below is backend fallback guidance, not the primary product path.
167
+ Use it when the current host cannot keep review inside the active conversation, not as the first choice for semantic-review ownership.
152
168
 
153
169
  ## Provider matrix
154
170
 
@@ -166,19 +182,17 @@ This is the safest default backend when the repository is already available loca
166
182
 
167
183
  Use when Claude Code is installed and authenticated on the machine.
168
184
 
169
- The built-in adapter launches a fresh Claude Code print-mode session for each worker run.
170
- When audit-task review is pending, the provider prompt now asks Claude Code to write structured audit results and then hand back to the bounded worker command so the same wrapper invocation can continue.
185
+ The current implementation can launch a fresh Claude Code print-mode session for each worker run.
171
186
 
172
- Recommended when you want the audit supervisor to delegate bounded tasks into Claude Code without manually driving each step.
187
+ Treat this as a compatibility bridge only, not as the intended default review owner.
173
188
 
174
189
  ### opencode
175
190
 
176
191
  Use when OpenCode is installed and authenticated on the machine.
177
192
 
178
- The built-in adapter launches a fresh `opencode run ...` session for each worker run.
179
- When audit-task review is pending, the provider prompt now asks OpenCode to write structured audit results and then hand back to the bounded worker command so the same wrapper invocation can continue.
193
+ The current implementation can launch a fresh `opencode run ...` session for each worker run.
180
194
 
181
- Recommended when OpenCode is the preferred local agent surface.
195
+ Treat this as a compatibility bridge only, not as the intended default review owner.
182
196
 
183
197
  ### subprocess-template
184
198
 
@@ -195,11 +209,15 @@ Treat this as an advanced backend adapter rather than the default path.
195
209
 
196
210
  ### Claude Code
197
211
 
198
- Use the repo-local `audit-code` wrapper from the target repository root, or set `provider` to `claude-code` in `.audit-artifacts/session-config.json` so the supervisor delegates bounded worker runs into Claude Code.
212
+ Use `/audit-code` in the active conversation as the primary path.
213
+
214
+ Only use the repo-local `audit-code` wrapper with `provider: "claude-code"` in `.audit-artifacts/session-config.json` when you intentionally want backend fallback bridging into Claude Code.
199
215
 
200
216
  ### OpenCode
201
217
 
202
- Use the same repo-local `audit-code` wrapper, or set `provider` to `opencode` so the supervisor delegates bounded worker runs into OpenCode.
218
+ Use `/audit-code` in the active conversation as the primary path.
219
+
220
+ Only use the repo-local `audit-code` wrapper with `provider: "opencode"` when you intentionally want backend fallback bridging into OpenCode.
203
221
 
204
222
  ### VS Code
205
223
 
@@ -249,3 +267,5 @@ For a polished operator experience today:
249
267
  3. use `audit-code` as the repo-local backend fallback
250
268
  4. prefer `local-subprocess` unless you want interactive review to continue automatically through agent tasks
251
269
  5. use `subprocess-template` only when integrating a non-native editor or launcher surface
270
+
271
+ If you intentionally want the backend fallback to bridge semantic review into another process, re-run with an explicit `--provider` flag after configuring the matching section in `.audit-artifacts/session-config.json`.
@@ -36,7 +36,24 @@ That means the current release is suitable for a controlled alpha or beta skill-
36
36
 
37
37
  ## Near-term priorities
38
38
 
39
- ### 1. Verify the shipped host integrations end to end
39
+ ### 1. Realign review dispatch with the conversation-owned workflow
40
+
41
+ The highest-priority product refactor is to move semantic-review ownership back to the active conversation agent and to replace the current unit-first review fan-out with non-overlapping lens-aware review blocks.
42
+
43
+ Near-term work should focus on:
44
+
45
+ - making the active conversation agent the default owner of semantic review
46
+ - keeping `agent_task_batch_size` at one review block per task
47
+ - treating backend provider adapters as compatibility bridges rather than the default review owner
48
+ - replacing the current unit-first task planner with a non-overlapping lens-block planner
49
+ - deleting the stale audit state and rerunning the audit only after that refactor lands
50
+
51
+ The current handoff for this work is:
52
+
53
+ - `docs/workflow-refactor-brief.md`
54
+ - `docs/remediation-baseline.md`
55
+
56
+ ### 2. Verify the shipped host integrations end to end
40
57
 
41
58
  The biggest remaining gap is not raw feature presence anymore. It is host-by-host proof that the generated assets work in the actual products they target.
42
59
 
@@ -48,7 +65,7 @@ Near-term work should focus on:
48
65
  - validating the VS Code prompt, agent, and `.vscode/mcp.json` flow inside a real workspace
49
66
  - validating that the Antigravity planning-mode guidance is accurate and does not over-promise a native saved-workflow surface
50
67
 
51
- ### 2. Close the remaining host-native UX gaps
68
+ ### 3. Close the remaining host-native UX gaps
52
69
 
53
70
  The product goal is still conversational first, not fallback-CLI first, and some shipped surfaces are still guidance-heavy rather than truly native.
54
71
 
@@ -59,7 +76,7 @@ Near-term work should focus on:
59
76
  - deciding whether OpenCode and VS Code need any smaller UX refinements after smoke-testing, rather than assuming the first generated surfaces are final
60
77
  - keeping Antigravity framed as a workflow-and-artifacts host until Google documents a stable project-local config surface
61
78
 
62
- ### 3. Polish continuation through assisted review
79
+ ### 4. Polish continuation through assisted review
63
80
 
64
81
  The repo-local backend fallback still intentionally stops in blocked state under `local-subprocess`, but configured provider bridges can now continue the audit-task review phase automatically.
65
82
 
@@ -69,7 +86,7 @@ Near-term work should focus on:
69
86
  - less operator guesswork when a configured provider fails to return usable results
70
87
  - stronger host-specific guidance for provider-assisted bridges
71
88
 
72
- ### 4. Harden publish and release operations
89
+ ### 5. Harden publish and release operations
73
90
 
74
91
  The packaged install story is in place, but release operations still need finishing work.
75
92
 
package/docs/packaging.md CHANGED
@@ -31,6 +31,18 @@ npm install
31
31
  npm run verify:release
32
32
  ```
33
33
 
34
+ For live child-process output during packaged smoke debugging:
35
+
36
+ ```bash
37
+ AUDIT_CODE_VERBOSE=1 npm run smoke:packaged-audit-code
38
+ ```
39
+
40
+ For the linked-install variant:
41
+
42
+ ```bash
43
+ AUDIT_CODE_VERBOSE=1 npm run smoke:linked-audit-code
44
+ ```
45
+
34
46
  That script:
35
47
 
36
48
  - creates a tarball with `npm pack`
@@ -41,6 +53,8 @@ That script:
41
53
  - invokes the installed `audit-code` binary from `node_modules/.bin`
42
54
  - validates emitted JSON against `schemas/audit-code-v1alpha1.schema.json`
43
55
  - exercises the same evidence-import and completion flow used by the linked-command smoke test
56
+ - strips inherited `npm_config_*`, `NODE_AUTH_TOKEN`, and `NPM_TOKEN` values before nested npm operations so `npm publish --dry-run` does not accidentally suppress tarball generation or leak publish credentials into the smoke environment
57
+ - emits step-by-step progress plus a final success summary so CI logs show where the run failed or completed across both the linked and packaged smoke paths
44
58
 
45
59
  ## CI
46
60
 
@@ -78,11 +78,32 @@ For repo-local backend usage:
78
78
  - `provider: "auto"` is the explicit opt-in mode for best-effort routing across configured or detected backends
79
79
  - explicit provider names should remain available for operators who want a specific backend
80
80
 
81
+ ## Semantic review ownership
82
+
83
+ The intended semantic-review owner is the active conversation agent.
84
+
85
+ That means:
86
+
87
+ - `/audit-code` should hand review work to the current conversation or host agent session first
88
+ - if that active agent can delegate to subagents in parallel, that fan-out belongs to the host runtime rather than to repo-local backend defaults
89
+ - backend provider adapters are compatibility bridges for fallback CLI usage, not the default owner of review work
90
+ - session-config should not be the normal mechanism for redirecting semantic review into a second external LLM CLI
91
+
92
+ ## Task-planning rule
93
+
94
+ The intended review planner should:
95
+
96
+ - determine which files require which lenses
97
+ - partition unresolved review into non-overlapping review blocks
98
+ - prefer lens-homogeneous blocks when practical
99
+ - keep the default dispatch granularity to one review block per task
100
+
81
101
  ## Default context & model rules
82
102
 
83
103
  1. By default, the current ChatGPT project conversation and its files should be treated as the primary context.
84
104
  2. The user should not need to supply `--root`, provider names, or backend-specific settings in normal usage.
85
105
  3. For backend CLI delegation, let the chosen provider own its own model-selection behavior unless explicitly configured.
106
+ 4. Backend fallback settings should not cap the active conversation agent's own subagent parallelism model.
86
107
 
87
108
  ## Development rule
88
109
 
@@ -92,6 +113,7 @@ Future development should optimize for the native skill UX first:
92
113
  - packaged installs should help users reach the prompt asset for that conversation route
93
114
  - the CLI and supervisor are implementation details and fallback harnesses
94
115
  - provider adapters are backend internals, not the primary product concept
116
+ - semantic-review dispatch belongs to the active conversation agent, not to an externally spawned fallback provider by default
95
117
  - docs, tests, and examples should present the skill-first flow before any CLI flow
96
118
 
97
119
  If documentation or implementation details conflict, prefer the skill-first contract above over the CLI-first backend shape.
@@ -20,6 +20,8 @@ Anything below `dist/index.js` remains a backend or development interface rather
20
20
  ### Node and package runtime
21
21
 
22
22
  - Node `>=20` is the minimum supported runtime from `package.json`
23
+ - GitHub Actions currently exercises the test suite on Node `20` and Node `22`
24
+ - release and publish automation stays pinned to Node `22.14.0`
23
25
  - packaged installs must include:
24
26
  - `audit-code`
25
27
  - `audit-code-wrapper-lib.mjs`
package/docs/releasing.md CHANGED
@@ -13,7 +13,9 @@ That workflow already:
13
13
  - pins Node `22.14.0`
14
14
  - upgrades npm to `>=11.5.1`
15
15
  - runs `npm run verify:release` before any publish attempt
16
+ - previews the packed tarball with `npm pack --dry-run` before any live publish attempt
16
17
  - defaults semver prerelease versions to the `next` dist-tag unless manual dispatch overrides it
18
+ - uploads npm debug logs when a publish-path step fails
17
19
 
18
20
  ## One-time npm setup
19
21
 
@@ -39,6 +41,12 @@ npm publish --dry-run
39
41
 
40
42
  The local dry run is still valuable even though the real publish happens in GitHub Actions. It proves the packed artifact, lifecycle hooks, and publish metadata before you spend a release on a broken workflow run.
41
43
 
44
+ ## Supported Node lines
45
+
46
+ Routine CI currently exercises the repository on Node `20` and Node `22`.
47
+
48
+ Release and publish workflows stay pinned to Node `22.14.0` because that is the line this repository uses for npm Trusted Publishing and release smoke verification.
49
+
42
50
  ## GitHub release paths
43
51
 
44
52
  ### Manual dry run
@@ -68,6 +76,15 @@ This is the safest path for the first trusted-publishing release because it lets
68
76
 
69
77
  After the manual path is proven, publishing a GitHub Release will trigger the same workflow and publish the package.
70
78
 
79
+ ## Workflow troubleshooting
80
+
81
+ If a GitHub Actions run fails:
82
+
83
+ 1. download the uploaded `*-npm-logs` artifact from the failed run
84
+ 2. rerun `npm ci` and `npm run verify:release` locally from the same commit
85
+ 3. for publish failures, rerun `publish-package.yml` with `dry_run=true` before retrying a live publish
86
+ 4. if publish still fails, confirm npm Trusted Publishing is still configured for `publish-package.yml`
87
+
71
88
  ## Post-publish checks
72
89
 
73
90
  After a live publish, verify the result from a clean shell:
@@ -0,0 +1,75 @@
1
+ # Remediation Baseline
2
+
3
+ This document preserves the remediation work that is already in the source tree so the stale audit state can be discarded safely before a fresh rerun.
4
+
5
+ ## Safe reset boundary
6
+
7
+ After reviewing this document and [docs/workflow-refactor-brief.md](/C:/Code/auditor-lambda/docs/workflow-refactor-brief.md), it is safe to delete:
8
+
9
+ - `.audit-artifacts/`
10
+ - `audit-report.md`
11
+
12
+ Those files describe a stale audit run and should not be used as the primary workflow driver for the next implementation pass.
13
+
14
+ The source tree and tests are the durable baseline to keep.
15
+
16
+ ## Remediation already landed in the source tree
17
+
18
+ The current worktree already includes substantial remediation across the main audited areas.
19
+
20
+ - Fixtures and workflows were hardened across `tests/fixtures/simple-app/...`, `.github/workflows/...`, `scripts/smoke-linked-audit-code.mjs`, `scripts/smoke-packaged-audit-code.mjs`, and the related release/operator docs.
21
+ - Extractor path handling and classification behavior were tightened in `src/extractors/...` with dedicated regressions in `tests/extractors-remediation.test.mjs`.
22
+ - Schema-contract and validation coverage were improved across `schemas/...`, `tests/helpers/jsonSchemaAssert.mjs`, `src/validation/...`, `tests/schema-contracts.test.mjs`, and `tests/validation-remediation.test.mjs`.
23
+ - Orchestrator behavior was hardened in `src/orchestrator/...` with focused regressions in `tests/orchestrator-remediation.test.mjs` and `tests/orchestration.test.mjs`.
24
+ - Supervisor and provider behavior were improved in `src/supervisor/...`, `src/providers/...`, and their companion tests.
25
+ - CLI and IO behavior were tightened in `src/cli.ts`, `src/index.ts`, `src/io/...`, and the related remediation tests.
26
+ - Reporting and synthesis behavior were improved in `src/reporting/...` with `tests/reporting-remediation.test.mjs`.
27
+ - The generated repo-local install payload was refreshed so `.audit-code/install/claude-desktop/...` now matches the current `dist/`, `schemas/`, and `skills/audit-code` source of truth, and `.audit-code/install/manifest.json` now points `source_prompt_path` at the repo-local prompt asset instead of a machine-specific global npm path.
28
+
29
+ ## Verification already performed
30
+
31
+ The following verification was already recorded against the current remediation tree.
32
+
33
+ - `npm test` passed on 2026-04-22 with 106 passing tests.
34
+ - `npm run build` passed in the targeted remediation passes below.
35
+ - `node --test --test-isolation=none tests/validation-remediation.test.mjs tests/validate-command.test.mjs tests/field-trial-remediation.test.mjs tests/provider-auto-resolution.test.mjs tests/supervisor-remediation.test.mjs` passed.
36
+ - `node --test --test-isolation=none tests/cli-remediation.test.mjs tests/validate-command.test.mjs` passed.
37
+ - `node --test --test-isolation=none tests/extractors-remediation.test.mjs` passed.
38
+ - `node --test --test-isolation=none tests/io-remediation.test.mjs tests/cli-remediation.test.mjs tests/validate-command.test.mjs tests/staleness.test.mjs` passed.
39
+ - `node --test --test-isolation=none tests/adapters-remediation.test.mjs tests/reporting-remediation.test.mjs tests/field-trial-remediation.test.mjs` passed.
40
+ - `node --test --test-isolation=none tests/orchestration.test.mjs tests/orchestrator-remediation.test.mjs tests/reporting-remediation.test.mjs` passed.
41
+ - The manually repaired install payload now has hash parity between the committed Claude Desktop bundle and the canonical repo `dist/`, `schemas/`, and `skills/audit-code` files.
42
+
43
+ ## Environment limits observed during verification
44
+
45
+ The current sandbox still hits `spawn EPERM` for subprocess-heavy wrapper/provider coverage.
46
+
47
+ That means:
48
+
49
+ - broader wrapper/provider integration checks remain environment-limited here
50
+ - the stale audit rerun should not be treated as authoritative
51
+ - the workflow refactor should be completed before a fresh audit is attempted
52
+
53
+ ## Release status
54
+
55
+ Do not cut a release tag, push a release branch, or publish from the current stale audit state.
56
+
57
+ The correct order is:
58
+
59
+ 1. preserve the source changes already made
60
+ 2. refactor the workflow
61
+ 3. delete the stale audit state
62
+ 4. rerun the audit from a clean slate
63
+ 5. only then decide whether a release is ready
64
+
65
+ ## Fresh rerun checklist
66
+
67
+ When the workflow refactor is complete, the next context should:
68
+
69
+ 1. keep the current source and doc changes
70
+ 2. delete `.audit-artifacts/`
71
+ 3. delete `audit-report.md`
72
+ 4. run `npm run build`
73
+ 5. run the most relevant regression tests for the refactor
74
+ 6. start a fresh `/audit-code` run
75
+ 7. treat the new audit output as the release gate
package/docs/run-flow.md CHANGED
@@ -4,20 +4,29 @@ The canonical product route is `/audit-code` in conversation.
4
4
 
5
5
  This document describes the backend execution flow that supports that conversational route and the repo-local fallback wrapper.
6
6
 
7
- ## Current backend execution path
7
+ ## Intended review-dispatch path
8
8
 
9
9
  1. Build or import a repository manifest.
10
- 2. Build audit units from the repository manifest.
11
- 3. Initialize a coverage matrix from the file list.
12
- 4. Apply unit-to-file coverage requirements.
13
- 5. Build initial audit tasks.
14
- 6. Dispatch those tasks to LLM agents or other runtimes.
10
+ 2. Build units, flows, and other deterministic structure artifacts.
11
+ 3. Determine which files require which lenses.
12
+ 4. Partition unresolved file/lens obligations into non-overlapping review blocks.
13
+ 5. Hand one review block at a time to the active conversation agent.
14
+ 6. Let the active agent decide whether it wants to use subagents in parallel.
15
15
  7. Ingest structured audit results.
16
- 8. Apply reviewed ranges and completed lenses to the coverage matrix.
17
- 9. Build requeue tasks for missing lenses or uncovered ranges.
16
+ 8. Mark completed file/lens coverage in the coverage matrix.
17
+ 9. Build requeue only for still-missing coverage.
18
18
  10. Repeat until coverage rules are satisfied.
19
19
  11. Synthesize findings into merged outputs.
20
20
 
21
+ ## Current implementation note
22
+
23
+ The current TypeScript backend still has workflow drift:
24
+
25
+ - planning is still mostly unit-first rather than lens-block-first
26
+ - explicit backend providers can still end up owning semantic review in fallback mode
27
+
28
+ That drift is being tracked explicitly in [docs/workflow-refactor-brief.md](/C:/Code/auditor-lambda/docs/workflow-refactor-brief.md).
29
+
21
30
  ## Current backend capability
22
31
 
23
32
  The current TypeScript implementation already covers:
@@ -27,23 +36,26 @@ The current TypeScript implementation already covers:
27
36
  - reviewed-range ingestion from audit results
28
37
  - runtime validation update ingestion
29
38
  - synthesis and completion tracking
30
- - backend provider handoff for interactive or assisted review
39
+ - backend provider handoff for fallback or compatibility review flows
31
40
 
32
41
  ## Product interpretation
33
42
 
34
43
  - the conversation route should hide this state machine behind `/audit-code`
35
44
  - the repo-local `audit-code` wrapper is fallback infrastructure for operators and local harnesses
36
45
  - provider adapters and artifact plumbing are backend details, not the primary product story
46
+ - the active conversation agent should own semantic review by default
37
47
  - when fallback execution blocks, the wrapper should still leave behind explicit operator handoff files and suggested evidence-import paths
38
48
 
39
49
  ## Next backend implementation steps
40
50
 
41
51
  The next backend-focused work should support the conversation route more directly by:
42
52
 
43
- - reducing operator friction when the backend reaches a blocked handoff
44
- - improving continuation when interactive providers are configured
53
+ - realigning review planning around non-overlapping lens blocks
54
+ - moving semantic-review ownership back to the active conversation agent
55
+ - keeping backend provider bridges explicitly secondary
45
56
  - keeping evidence import and runtime-update handoff paths explicit and easier to follow
46
57
 
47
58
  Broader product priorities are tracked in:
48
59
 
60
+ - `docs/workflow-refactor-brief.md`
49
61
  - `docs/next-steps.md`
@@ -1,9 +1,14 @@
1
1
  # session-config
2
2
 
3
- This file only applies to the backend fallback CLI.
3
+ This file only applies to explicit backend fallback workflows.
4
4
 
5
5
  The canonical `/audit-code` conversation route should not require users to touch it.
6
6
 
7
+ It does not define who owns semantic review in the canonical conversation flow, and it is not enough by itself to transfer semantic review away from the active conversation agent.
8
+
9
+ In the intended product workflow, the active conversation agent owns review tasks and any subagent fan-out.
10
+ Use this file only when you intentionally need backend fallback behavior or an explicit compatibility bridge.
11
+
7
12
  Backend provider configuration lives at:
8
13
 
9
14
  ```text
@@ -35,8 +40,7 @@ audit-code validate
35
40
  "provider": "local-subprocess",
36
41
  "timeout_ms": 1800000,
37
42
  "ui_mode": "headless",
38
- "agent_task_batch_size": 4,
39
- "parallel_workers": 2
43
+ "agent_task_batch_size": 1
40
44
  }
41
45
  ```
42
46
 
@@ -51,6 +55,12 @@ Supported values:
51
55
  - `opencode`
52
56
  - `vscode-task`
53
57
 
58
+ Current implementation note:
59
+
60
+ - `claude-code`, `opencode`, `subprocess-template`, and `vscode-task` are backend compatibility bridges
61
+ - they are not the intended default owner of semantic review when the active conversation agent can handle the work directly
62
+ - to activate one of those bridges for semantic review, re-run the wrapper with an explicit `--provider <name>` flag
63
+
54
64
  ### `timeout_ms`
55
65
 
56
66
  Worker-run timeout in milliseconds.
@@ -70,10 +80,16 @@ How many audit tasks to include in one provider-assisted review batch.
70
80
 
71
81
  When this is greater than `1`, the generated worker prompt points at `current-tasks.json` / `pending-audit-tasks.json` and expects one `AuditResult` per assigned task.
72
82
 
83
+ The intended default review granularity remains one review block per task.
84
+
73
85
  ### `parallel_workers`
74
86
 
75
87
  How many provider-assisted review batches to launch in parallel when the selected provider supports it.
76
88
 
89
+ This setting only applies to explicit backend bridge launches.
90
+
91
+ It should not be treated as the source of truth for in-conversation subagent parallelism, which belongs to the active conversation agent or host runtime.
92
+
77
93
  ## Auto provider mode
78
94
 
79
95
  `auto` is an explicit opt-in mode.
@@ -98,6 +114,8 @@ No extra config is required.
98
114
 
99
115
  This mode covers deterministic worker runs locally and stops in a terminal blocked state once the remaining work requires imported audit results or an interactive provider.
100
116
 
117
+ This remains the safest fallback default while the semantic-review workflow is being realigned.
118
+
101
119
  ### `claude_code`
102
120
 
103
121
  ```json
@@ -116,7 +134,9 @@ Fields:
116
134
  - `command`: optional override for the Claude Code executable
117
135
  - `extra_args`: optional extra arguments appended before the built-in permission-skipping flag
118
136
 
119
- When audit-task review is pending, the generated provider prompt now asks Claude Code to write structured `AuditResult[]` output and then run the bounded worker command so the same `audit-code` invocation can keep advancing.
137
+ Current implementation support only.
138
+
139
+ Use this only when you intentionally want the backend fallback CLI to bridge review into an external Claude Code process, together with `audit-code --provider claude-code`.
120
140
 
121
141
  ### `opencode`
122
142
 
@@ -136,7 +156,9 @@ Fields:
136
156
  - `command`: optional override for the OpenCode executable
137
157
  - `extra_args`: optional additional arguments for `opencode run ...`
138
158
 
139
- When audit-task review is pending, the generated provider prompt now asks OpenCode to write structured `AuditResult[]` output and then run the bounded worker command so the same `audit-code` invocation can keep advancing.
159
+ Current implementation support only.
160
+
161
+ Use this only when you intentionally want the backend fallback CLI to bridge review into an external OpenCode process, together with `audit-code --provider opencode`.
140
162
 
141
163
  ### `subprocess_template`
142
164
 
@@ -157,6 +179,7 @@ Fields:
157
179
  - `env`: optional environment-variable overlay
158
180
 
159
181
  When you use this bridge for provider-assisted review, the launched process should write structured audit results to `task.audit_results_path` and then execute `task.worker_command`.
182
+ Activate it explicitly with `audit-code --provider subprocess-template`.
160
183
 
161
184
  ### `vscode_task`
162
185
 
@@ -172,6 +195,7 @@ When you use this bridge for provider-assisted review, the launched process shou
172
195
  ```
173
196
 
174
197
  This adapter is intentionally thin. It uses the same template expansion model as `subprocess-template`, but is named separately so the operator intent is explicit.
198
+ Activate it explicitly with `audit-code --provider vscode-task`.
175
199
 
176
200
  ## Template placeholders
177
201
 
@@ -215,6 +239,9 @@ This adapter is intentionally thin. It uses the same template expansion model as
215
239
  }
216
240
  ```
217
241
 
242
+ Use this only when you intentionally want backend fallback routing.
243
+ It is not the canonical semantic-review path.
244
+
218
245
  ### Delegate worker runs into Claude Code
219
246
 
220
247
  ```json
@@ -224,6 +251,12 @@ This adapter is intentionally thin. It uses the same template expansion model as
224
251
  }
225
252
  ```
226
253
 
254
+ Then start the backend bridge explicitly:
255
+
256
+ ```bash
257
+ audit-code --provider claude-code
258
+ ```
259
+
227
260
  ### Delegate worker runs into OpenCode
228
261
 
229
262
  ```json
@@ -233,6 +266,12 @@ This adapter is intentionally thin. It uses the same template expansion model as
233
266
  }
234
267
  ```
235
268
 
269
+ Then start the backend bridge explicitly:
270
+
271
+ ```bash
272
+ audit-code --provider opencode
273
+ ```
274
+
236
275
  ### Use a generic bash launcher bridge
237
276
 
238
277
  ```json
@@ -245,6 +284,12 @@ This adapter is intentionally thin. It uses the same template expansion model as
245
284
  }
246
285
  ```
247
286
 
287
+ Then start the backend bridge explicitly:
288
+
289
+ ```bash
290
+ audit-code --provider subprocess-template
291
+ ```
292
+
248
293
  ## Antigravity note
249
294
 
250
295
  A dedicated Antigravity adapter is not currently shipped.
@@ -6,6 +6,9 @@ The primary product contract is `/audit-code` in conversation.
6
6
 
7
7
  Everything here is fallback and implementation detail guidance for the repo-local backend surface.
8
8
 
9
+ In the intended workflow, the active conversation agent owns semantic review.
10
+ Provider adapters are compatibility bridges for backend fallback mode, not the default review owner.
11
+
9
12
  ## Repo-local backend surface
10
13
 
11
14
  From the target repository root:
@@ -55,6 +58,9 @@ audit-code --provider subprocess-template
55
58
  audit-code --provider vscode-task
56
59
  ```
57
60
 
61
+ Those `--provider` invocations are the explicit bridge handoff point.
62
+ Without an explicit `--provider` flag, the backend keeps semantic review with the active conversation agent and uses `local-subprocess` only for deterministic worker steps.
63
+
58
64
  ## Auto resolution rule
59
65
 
60
66
  When `provider` is set to `auto`, the backend resolves in this order:
@@ -81,3 +87,4 @@ See:
81
87
  ## Note
82
88
 
83
89
  Provider adapters are backend integrations, not the primary product concept.
90
+ Session config defines bridge settings, but the explicit `--provider` flag is what opts the backend into owning semantic-review dispatch.