auditor-lambda 0.3.12 → 0.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -24
- package/audit-code-wrapper-lib.mjs +52 -53
- package/dist/cli.js +43 -6
- package/dist/coverage.js +3 -1
- package/dist/extractors/disposition.js +8 -1
- package/dist/extractors/graph.d.ts +3 -1
- package/dist/extractors/graph.js +1147 -67
- package/dist/extractors/graphManifestEdges.d.ts +14 -0
- package/dist/extractors/graphManifestEdges.js +1158 -0
- package/dist/extractors/graphPathUtils.d.ts +5 -0
- package/dist/extractors/graphPathUtils.js +75 -0
- package/dist/extractors/pathPatterns.d.ts +1 -0
- package/dist/extractors/pathPatterns.js +3 -0
- package/dist/io/artifacts.d.ts +10 -1
- package/dist/io/artifacts.js +23 -3
- package/dist/orchestrator/internalExecutors.d.ts +4 -0
- package/dist/orchestrator/internalExecutors.js +35 -6
- package/dist/orchestrator/reviewPackets.js +1003 -31
- package/dist/orchestrator/syntaxResolutionExecutor.js +34 -0
- package/dist/types/externalAnalyzer.d.ts +9 -0
- package/dist/types/graph.d.ts +3 -0
- package/dist/types/reviewPlanning.d.ts +39 -0
- package/docs/contracts.md +215 -0
- package/docs/development.md +210 -0
- package/docs/handoff.md +204 -0
- package/docs/history.md +40 -0
- package/docs/operator-guide.md +189 -0
- package/docs/product.md +185 -0
- package/docs/release.md +131 -0
- package/package.json +1 -1
- package/schemas/audit_plan_metrics.schema.json +347 -0
- package/schemas/external_analyzer_results.schema.json +35 -0
- package/schemas/graph_bundle.schema.json +47 -2
- package/schemas/review_packets.schema.json +160 -0
- package/skills/audit-code/SKILL.md +7 -3
- package/skills/audit-code/audit-code.prompt.md +4 -1
- package/docs/agent-integrations.md +0 -317
- package/docs/agent-roles.md +0 -69
- package/docs/architecture.md +0 -90
- package/docs/artifacts.md +0 -36
- package/docs/bootstrap-install.md +0 -139
- package/docs/contract.md +0 -54
- package/docs/dispatch-implementation-plan.md +0 -302
- package/docs/field-trial-bug-report.md +0 -237
- package/docs/github-copilot.md +0 -66
- package/docs/model-selection.md +0 -97
- package/docs/next-steps.md +0 -202
- package/docs/packaging.md +0 -120
- package/docs/pipeline.md +0 -152
- package/docs/product-direction.md +0 -154
- package/docs/production-launch-bar.md +0 -92
- package/docs/production-readiness.md +0 -58
- package/docs/releasing.md +0 -145
- package/docs/remediation-baseline.md +0 -75
- package/docs/repo-layout.md +0 -30
- package/docs/run-flow.md +0 -56
- package/docs/session-config.md +0 -319
- package/docs/supervisor.md +0 -100
- package/docs/usage.md +0 -215
- package/docs/windows-setup.md +0 -146
- package/docs/workflow-refactor-brief.md +0 -124
package/docs/artifacts.md
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Core Artifacts
|
|
2
|
-
|
|
3
|
-
This document follows [audit-goals.md](C:/Code/auditor-lambda/spec/audit-goals.md).
|
|
4
|
-
|
|
5
|
-
## Incomplete-run artifacts
|
|
6
|
-
|
|
7
|
-
During an incomplete or blocked audit, `.audit-artifacts/` may contain:
|
|
8
|
-
|
|
9
|
-
- `repo_manifest.json`
|
|
10
|
-
- `file_disposition.json`
|
|
11
|
-
- `unit_manifest.json`
|
|
12
|
-
- `graph_bundle.json`
|
|
13
|
-
- `surface_manifest.json`
|
|
14
|
-
- `critical_flows.json`
|
|
15
|
-
- `flow_coverage.json`
|
|
16
|
-
- `risk_register.json`
|
|
17
|
-
- `coverage_matrix.json`
|
|
18
|
-
- `runtime_validation_tasks.json` when deterministic runtime validation is planned
|
|
19
|
-
- `runtime_validation_report.json` when runtime validation has executed or been updated
|
|
20
|
-
- `external_analyzer_results.json`
|
|
21
|
-
- `audit_tasks.json`
|
|
22
|
-
- `audit_results.jsonl`
|
|
23
|
-
- `requeue_tasks.json`
|
|
24
|
-
- dispatch files for the currently active worker task
|
|
25
|
-
|
|
26
|
-
## Scope rule
|
|
27
|
-
|
|
28
|
-
Excluded files remain visible in deterministic intake/disposition where useful,
|
|
29
|
-
but they must not create audit work. This includes logs, licenses, lockfiles,
|
|
30
|
-
generated artifacts, vendored artifacts, binaries, and trivial non-code files.
|
|
31
|
-
|
|
32
|
-
## Completion rule
|
|
33
|
-
|
|
34
|
-
These artifacts are transient implementation state only. When the audit
|
|
35
|
-
completes, `.audit-artifacts/` is removed and only repo-root `audit-report.md`
|
|
36
|
-
remains.
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
# Bootstrap install
|
|
2
|
-
|
|
3
|
-
The intended user setup is one global package install:
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
npm install -g auditor-lambda
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
That makes the `audit-code` command available from any repository. Package
|
|
10
|
-
install also seeds user-level command or skill assets for hosts we can update
|
|
11
|
-
safely, including the Claude command file and Codex skill bundle.
|
|
12
|
-
|
|
13
|
-
After that, the normal user flow is to invoke `/audit-code` in a supported host.
|
|
14
|
-
The prompt starts by running:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
audit-code ensure --quiet
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
`ensure` is idempotent. From the target repository root, it writes the
|
|
21
|
-
repo-local `/audit-code` surfaces only when they are missing or stale.
|
|
22
|
-
|
|
23
|
-
The explicit repair or compatibility command remains:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
audit-code install
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
That command always rewrites the repo-local `/audit-code` surfaces we can
|
|
30
|
-
automate today. `audit-code ensure --force` is the equivalent self-bootstrap
|
|
31
|
-
entrypoint when you want forced refresh semantics.
|
|
32
|
-
The generated manifest records the canonical prompt and skill source paths so
|
|
33
|
-
host surfaces can be checked against one shared source of truth instead of
|
|
34
|
-
drifting independently.
|
|
35
|
-
|
|
36
|
-
After bootstrap, run:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
audit-code verify-install
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
That smoke-tests the generated host assets plus the shared repo-local MCP launcher without waiting for a full editor walkthrough.
|
|
43
|
-
|
|
44
|
-
## What it writes
|
|
45
|
-
|
|
46
|
-
Installed shared surfaces:
|
|
47
|
-
|
|
48
|
-
- `.audit-code/install/audit-code.import.md`
|
|
49
|
-
- `.audit-code/install/SKILL.md`
|
|
50
|
-
- `.audit-code/install/GETTING-STARTED.md`
|
|
51
|
-
- `.audit-code/install/manifest.json`
|
|
52
|
-
- `.audit-code/install/run-mcp-server.mjs`
|
|
53
|
-
- `.audit-artifacts/session-config.json` when no backend fallback config exists yet
|
|
54
|
-
|
|
55
|
-
Installed host-specific surfaces:
|
|
56
|
-
|
|
57
|
-
- Codex:
|
|
58
|
-
- `.codex/skills/audit-code/*`
|
|
59
|
-
- `AGENTS.md` managed block when needed
|
|
60
|
-
- `.audit-code/install/codex/MCP-SETUP.md`
|
|
61
|
-
- `.audit-code/install/codex/RE-AUDIT-AUTOMATION.md`
|
|
62
|
-
- Claude Desktop:
|
|
63
|
-
- `.audit-code/install/claude-desktop/PROJECT-TEMPLATE.md`
|
|
64
|
-
- `.audit-code/install/claude-desktop/remote-mcp-connector.json`
|
|
65
|
-
- `.audit-code/install/claude-desktop/auditor-lambda.dxt`
|
|
66
|
-
- `.audit-code/install/claude-desktop/auditor-lambda.mcpb`
|
|
67
|
-
- OpenCode:
|
|
68
|
-
- `.opencode/commands/audit-code.md`
|
|
69
|
-
- `.opencode/skills/audit-code/*`
|
|
70
|
-
- `opencode.json`
|
|
71
|
-
- `AGENTS.md` managed block when needed
|
|
72
|
-
- VS Code:
|
|
73
|
-
- `.github/prompts/audit-code.prompt.md`
|
|
74
|
-
- `.github/copilot-instructions.md`
|
|
75
|
-
- `.github/agents/auditor.agent.md`
|
|
76
|
-
- `.vscode/mcp.json`
|
|
77
|
-
- Antigravity:
|
|
78
|
-
- `.audit-code/install/antigravity/PLANNING-MODE.md`
|
|
79
|
-
- `AGENTS.md` managed block when needed
|
|
80
|
-
|
|
81
|
-
The generated `GETTING-STARTED.md` now includes dedicated quick-start sections for:
|
|
82
|
-
|
|
83
|
-
- Codex
|
|
84
|
-
- Claude Desktop
|
|
85
|
-
- OpenCode
|
|
86
|
-
- VS Code
|
|
87
|
-
- Antigravity
|
|
88
|
-
|
|
89
|
-
## Goal
|
|
90
|
-
|
|
91
|
-
After bootstrap, the user should be able to open a supported host surface in the repository and invoke:
|
|
92
|
-
|
|
93
|
-
```text
|
|
94
|
-
/audit-code
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
without supplying extra root paths, provider flags, or model-selection arguments, or connect through the shared MCP server when the host prefers tool-driven integration.
|
|
98
|
-
|
|
99
|
-
## What is fully automated today
|
|
100
|
-
|
|
101
|
-
- global `npm install -g auditor-lambda` seeds user-level Claude command and
|
|
102
|
-
Codex skill assets when filesystem permissions allow it
|
|
103
|
-
- `/audit-code` runs `audit-code ensure --quiet` before advancing the audit
|
|
104
|
-
- shared installer output, manifest generation, and repo-local MCP launcher generation
|
|
105
|
-
- default backend fallback session-config creation when no config exists yet
|
|
106
|
-
- Codex skill-bundle and AGENTS-oriented install output
|
|
107
|
-
- OpenCode command, skill, prompt, and config generation
|
|
108
|
-
- VS Code prompt, custom-agent, instruction, and MCP config generation
|
|
109
|
-
- Claude Desktop project-template, remote-connector, and local bundle generation
|
|
110
|
-
- Antigravity planning-mode guidance generation
|
|
111
|
-
|
|
112
|
-
## What is not fully automated today
|
|
113
|
-
|
|
114
|
-
- product-level smoke validation for the generated Codex, Claude Desktop, OpenCode, VS Code, and Antigravity assets
|
|
115
|
-
- one-click proof that the generated Claude Desktop bundle installs cleanly in a real Desktop environment
|
|
116
|
-
- documented Antigravity artifact round-tripping back through `import_results` and `import_runtime_updates`
|
|
117
|
-
|
|
118
|
-
For those gaps, the bootstrap command now writes the repo-local assets and guidance, but the final operator experience still needs end-to-end host verification.
|
|
119
|
-
|
|
120
|
-
Use `.audit-code/install/GETTING-STARTED.md` as the low-guess repo-local handoff, and treat `.audit-code/install/manifest.json` as the machine-readable source of truth for what was generated.
|
|
121
|
-
|
|
122
|
-
## Narrow compatibility alias
|
|
123
|
-
|
|
124
|
-
The older host-specific helper still exists:
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
audit-code install-host --host copilot
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
Use it only when you intentionally want the smaller Copilot-only install path instead of the default bootstrap.
|
|
131
|
-
|
|
132
|
-
## Remaining steps
|
|
133
|
-
|
|
134
|
-
The installer foundation is now in place. The remaining work is:
|
|
135
|
-
|
|
136
|
-
1. smoke-test each claimed host in the real product, not only via file-generation tests
|
|
137
|
-
2. tighten `GETTING-STARTED.md` and host-specific setup docs where those smoke tests show friction
|
|
138
|
-
3. prove the Claude Desktop local bundle install path operationally
|
|
139
|
-
4. document Antigravity artifact-import workflows more concretely
|
package/docs/contract.md
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# audit-code Response Contract
|
|
2
|
-
|
|
3
|
-
This document follows [audit-goals.md](C:/Code/auditor-lambda/spec/audit-goals.md).
|
|
4
|
-
|
|
5
|
-
## Canonical output
|
|
6
|
-
|
|
7
|
-
The authoritative completed-audit output is repo-root `audit-report.md`.
|
|
8
|
-
|
|
9
|
-
Until completion, the wrapper response remains a JSON envelope with:
|
|
10
|
-
|
|
11
|
-
- `contract_version`
|
|
12
|
-
- `audit_state`
|
|
13
|
-
- `selected_obligation`
|
|
14
|
-
- `selected_executor`
|
|
15
|
-
- `progress_made`
|
|
16
|
-
- `artifacts_written`
|
|
17
|
-
- `progress_summary`
|
|
18
|
-
- `next_likely_step`
|
|
19
|
-
- `handoff`
|
|
20
|
-
|
|
21
|
-
## AuditResult contract
|
|
22
|
-
|
|
23
|
-
Workers submit `AuditResult[]` shaped by `schemas/audit_result.schema.json`.
|
|
24
|
-
|
|
25
|
-
Important rules:
|
|
26
|
-
|
|
27
|
-
- `file_coverage` is required and must include every assigned file.
|
|
28
|
-
- `file_coverage` must not include files outside the assigned task.
|
|
29
|
-
- `file_coverage[].total_lines` must match the current file line count.
|
|
30
|
-
- `task_id`, `unit_id`, `pass_id`, and `lens` must match the assigned task.
|
|
31
|
-
- each finding lens must match the assigned task lens.
|
|
32
|
-
- `findings[].affected_files` must be objects, not strings.
|
|
33
|
-
- `findings[].evidence` must be an array of plain strings.
|
|
34
|
-
- lens steward tasks are tagged `lens_verification`; they must emit
|
|
35
|
-
`findings: []` plus `verification` metadata. Suggested `verification.followup_tasks`
|
|
36
|
-
are treated as bounded follow-up requests, not direct findings.
|
|
37
|
-
|
|
38
|
-
Use `audit-code validate-results --results <file>` before ingestion to validate
|
|
39
|
-
results against the active task manifest.
|
|
40
|
-
|
|
41
|
-
## Internal artifacts during incomplete runs
|
|
42
|
-
|
|
43
|
-
The engine may keep resumable artifacts under `.audit-artifacts/`, including:
|
|
44
|
-
|
|
45
|
-
- intake/structure/planning artifacts
|
|
46
|
-
- `audit_tasks.json`
|
|
47
|
-
- `audit_results.jsonl`
|
|
48
|
-
- `requeue_tasks.json`
|
|
49
|
-
- `runtime_validation_tasks.json`
|
|
50
|
-
- `runtime_validation_report.json` when runtime validation is planned
|
|
51
|
-
- dispatch files for the active worker task
|
|
52
|
-
|
|
53
|
-
These artifacts are internal and transient. On successful completion, they are
|
|
54
|
-
cleared out and only `audit-report.md` remains.
|
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
# Dispatch Automation Reference
|
|
2
|
-
|
|
3
|
-
This document describes the implemented review-dispatch path for `/audit-code`.
|
|
4
|
-
The original dispatch plan was one agent per audit task. The current path keeps
|
|
5
|
-
the existing `AuditTask` and `AuditResult` contracts, but groups related tasks
|
|
6
|
-
into review packets so a worker can read a coherent file set once and submit
|
|
7
|
-
one validated result for each assigned task through a backend-owned write path.
|
|
8
|
-
|
|
9
|
-
## Current Workflow
|
|
10
|
-
|
|
11
|
-
```text
|
|
12
|
-
1. audit-code
|
|
13
|
-
-> advances deterministic state until semantic review is needed
|
|
14
|
-
-> emits a blocked handoff with active_review_run.run_id
|
|
15
|
-
|
|
16
|
-
2. audit-code prepare-dispatch --run-id <run_id> --artifacts-dir <artifacts_dir>
|
|
17
|
-
-> reads pending-audit-tasks.json and review planning artifacts
|
|
18
|
-
-> writes a slim dispatch-plan.json
|
|
19
|
-
-> writes backend-owned dispatch-result-map.json
|
|
20
|
-
-> writes one packet prompt per dispatch-plan entry
|
|
21
|
-
-> prints one compact JSON envelope
|
|
22
|
-
|
|
23
|
-
3. Conversation orchestrator reads only dispatch-plan.json
|
|
24
|
-
-> launches one subagent per packet
|
|
25
|
-
-> each subagent reads its packet prompt and assigned files
|
|
26
|
-
-> each subagent pipes AuditResult[] to the submit-packet command in the prompt
|
|
27
|
-
-> submit-packet validates and writes only backend-assigned result files
|
|
28
|
-
-> each subagent replies: valid: <packet_id>, findings=<n>
|
|
29
|
-
|
|
30
|
-
4. audit-code merge-and-ingest --run-id <run_id> --artifacts-dir <artifacts_dir>
|
|
31
|
-
-> validates that every assigned task has exactly one valid result
|
|
32
|
-
-> rejects missing, unknown, duplicate, malformed, or out-of-scope results
|
|
33
|
-
-> writes audit-results.json as the existing AuditResult[] shape
|
|
34
|
-
-> ingests accepted results through the normal result_ingestion_executor
|
|
35
|
-
-> prints one compact JSON envelope
|
|
36
|
-
|
|
37
|
-
5. Repeat `audit-code` until complete.
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
The parent orchestrator should not read prompt files, pending tasks, completed
|
|
41
|
-
task result payloads, or source files during the packet dispatch path unless a
|
|
42
|
-
backend command fails and the error requires diagnosis.
|
|
43
|
-
|
|
44
|
-
## Planning Artifacts
|
|
45
|
-
|
|
46
|
-
Planning writes two packet-specific artifacts alongside the existing task and
|
|
47
|
-
coverage artifacts:
|
|
48
|
-
|
|
49
|
-
- `review_packets.json`: deterministic packets derived from current
|
|
50
|
-
`AuditTask` records.
|
|
51
|
-
- `audit_plan_metrics.json`: task count, packet count, repeated file/line
|
|
52
|
-
estimates, largest packet, and estimated agent-count reduction.
|
|
53
|
-
|
|
54
|
-
Packets preserve task identity. They change the worker-facing unit of work, not
|
|
55
|
-
the backend-owned validation or ingestion contract.
|
|
56
|
-
|
|
57
|
-
## Packet Construction
|
|
58
|
-
|
|
59
|
-
Packet planning is deterministic and compatibility-preserving:
|
|
60
|
-
|
|
61
|
-
- tasks sharing the same file set and scope are grouped across lenses
|
|
62
|
-
- tiny homogeneous test files are batched before dispatch
|
|
63
|
-
- graph edges from imports, calls, and references can merge related task groups
|
|
64
|
-
- heuristic container edges do not force packet expansion
|
|
65
|
-
- packet chunking respects task-count and line-budget limits
|
|
66
|
-
- a single file that exceeds the packet target is isolated rather than split
|
|
67
|
-
- high-priority packets sort ahead of lower-priority packets
|
|
68
|
-
|
|
69
|
-
Generated packets include:
|
|
70
|
-
|
|
71
|
-
```json
|
|
72
|
-
{
|
|
73
|
-
"packet_id": "src-auth:security-correctness:packet-1-...",
|
|
74
|
-
"task_ids": ["src-auth:security", "src-auth:correctness"],
|
|
75
|
-
"lenses": ["security", "correctness"],
|
|
76
|
-
"file_paths": ["src/api/auth.ts", "src/lib/session.ts"],
|
|
77
|
-
"total_lines": 70,
|
|
78
|
-
"estimated_tokens": 1180
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## `prepare-dispatch` Output
|
|
83
|
-
|
|
84
|
-
Command:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
audit-code prepare-dispatch --run-id <run_id> --artifacts-dir <artifacts_dir>
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Artifacts:
|
|
91
|
-
|
|
92
|
-
- `<artifacts_dir>/runs/<run_id>/dispatch-plan.json`
|
|
93
|
-
- `<artifacts_dir>/runs/<run_id>/dispatch-result-map.json`
|
|
94
|
-
- `<artifacts_dir>/runs/<run_id>/task-results/<packet_id>.prompt.md`
|
|
95
|
-
- `<artifacts_dir>/runs/<run_id>/task-results/<packet_id>.anchors.json`,
|
|
96
|
-
only for isolated large-file packets
|
|
97
|
-
- `<artifacts_dir>/runs/<run_id>/dispatch-warnings.json`, only when warnings
|
|
98
|
-
exist
|
|
99
|
-
|
|
100
|
-
The command prints a compact JSON envelope:
|
|
101
|
-
|
|
102
|
-
```json
|
|
103
|
-
{
|
|
104
|
-
"run_id": "run-1",
|
|
105
|
-
"dispatch_plan_path": ".audit-artifacts/runs/run-1/dispatch-plan.json",
|
|
106
|
-
"packet_count": 4,
|
|
107
|
-
"task_count": 18,
|
|
108
|
-
"largest_packet": {
|
|
109
|
-
"packet_id": "src-auth:security-correctness:packet-1-...",
|
|
110
|
-
"total_lines": 1320,
|
|
111
|
-
"estimated_tokens": 6180
|
|
112
|
-
},
|
|
113
|
-
"warning_count": 0,
|
|
114
|
-
"dispatch_warnings_path": null
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
`dispatch-plan.json` entries are intentionally small:
|
|
119
|
-
|
|
120
|
-
```json
|
|
121
|
-
{
|
|
122
|
-
"packet_id": "src-auth:security-correctness:packet-1-...",
|
|
123
|
-
"description": "Audit 2 file(s), 2 task(s), 2 lens(es) (~70 lines)",
|
|
124
|
-
"prompt_path": ".audit-artifacts/runs/run-1/task-results/src-auth_security-correctness_packet-1_ab12cd34ef56.prompt.md",
|
|
125
|
-
"complexity": {
|
|
126
|
-
"priority": "high",
|
|
127
|
-
"task_count": 2,
|
|
128
|
-
"file_count": 2,
|
|
129
|
-
"total_lines": 70,
|
|
130
|
-
"estimated_tokens": 1180,
|
|
131
|
-
"lenses": ["security", "correctness"],
|
|
132
|
-
"tags": ["critical_flow"],
|
|
133
|
-
"large_file_mode": false
|
|
134
|
-
},
|
|
135
|
-
"model_hint": {
|
|
136
|
-
"tier": "deep",
|
|
137
|
-
"reasons": ["high_priority", "critical_flow"]
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
The orchestrator should launch one subagent per entry with the entry
|
|
143
|
-
description and a prompt that tells the subagent to read and follow
|
|
144
|
-
`entry.prompt_path`.
|
|
145
|
-
If the host supports per-subagent model selection, it may map
|
|
146
|
-
`entry.model_hint.tier` (`small`, `standard`, or `deep`) to local model names.
|
|
147
|
-
These hints are provider-neutral; the backend does not hardcode model names or
|
|
148
|
-
require model selection during normal use.
|
|
149
|
-
|
|
150
|
-
## Large File Mode
|
|
151
|
-
|
|
152
|
-
The workflow does not impose a hard single-file size limit. When a packet is
|
|
153
|
-
large because it contains one large file, `prepare-dispatch` keeps that file in
|
|
154
|
-
an isolated packet and writes a mechanical anchor summary next to the packet
|
|
155
|
-
prompt. The anchor summary may include:
|
|
156
|
-
|
|
157
|
-
- file boundaries
|
|
158
|
-
- imports and exports
|
|
159
|
-
- top-level symbols
|
|
160
|
-
- route-like declarations
|
|
161
|
-
- risk keywords
|
|
162
|
-
- graph edges
|
|
163
|
-
- external analyzer signals
|
|
164
|
-
|
|
165
|
-
The packet prompt points the worker at the anchor file and asks for targeted
|
|
166
|
-
reads/searches within the assigned file. The backend still validates and writes
|
|
167
|
-
results through `submit-packet`. This keeps large-file review bounded by
|
|
168
|
-
mechanically generated structure without slicing files into arbitrary line
|
|
169
|
-
ranges.
|
|
170
|
-
|
|
171
|
-
## Packet Prompt Contract
|
|
172
|
-
|
|
173
|
-
Each packet prompt tells the worker to:
|
|
174
|
-
|
|
175
|
-
- review the packet once
|
|
176
|
-
- read only the listed repo-relative files
|
|
177
|
-
- produce one JSON object per listed task
|
|
178
|
-
- pipe one JSON array to the prompt's `submit-packet` command
|
|
179
|
-
- preserve the existing `AuditResult` fields:
|
|
180
|
-
`task_id`, `unit_id`, `pass_id`, `lens`, `file_coverage`, `findings`
|
|
181
|
-
- keep `file_coverage[]` as `{ path, total_lines }`
|
|
182
|
-
- keep every finding lens equal to the task lens
|
|
183
|
-
- avoid direct file writes, source edits, remediation, extra task results, and
|
|
184
|
-
unrelated audits
|
|
185
|
-
- reply exactly `valid: <packet_id>, findings=<total finding count>` after the
|
|
186
|
-
submit command accepts the packet
|
|
187
|
-
|
|
188
|
-
This keeps packet review efficient while leaving merge and ingestion
|
|
189
|
-
mechanically deterministic.
|
|
190
|
-
|
|
191
|
-
## Submission and Validation
|
|
192
|
-
|
|
193
|
-
Packet submission is exposed through:
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
audit-code submit-packet --run-id <run_id> --packet-id <packet_id> --artifacts-dir <artifacts_dir>
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
The command reads `AuditResult[]` from stdin, validates the complete assigned
|
|
200
|
-
packet, and writes only the backend-assigned per-task result paths from
|
|
201
|
-
`dispatch-result-map.json`. This keeps result writes out of the LLM prompt and
|
|
202
|
-
prevents swapped or unknown task result files from being ingested.
|
|
203
|
-
|
|
204
|
-
Per-task validation is exposed through:
|
|
205
|
-
|
|
206
|
-
```bash
|
|
207
|
-
audit-code validate-result --run-id <run_id> --task-id <task_id> --artifacts-dir <artifacts_dir>
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
Generated packet prompts may pass run ids, packet ids, task ids, and artifact paths through
|
|
211
|
-
base64url flags such as `--run-id-b64`, `--packet-id-b64`, `--task-id-b64`, and
|
|
212
|
-
`--artifacts-dir-b64` when raw values could contain shell-sensitive characters.
|
|
213
|
-
|
|
214
|
-
The validator checks the result against the assigned task set and enforces the
|
|
215
|
-
mechanical constraints that matter for ingestion:
|
|
216
|
-
|
|
217
|
-
- required `AuditResult` and finding fields
|
|
218
|
-
- finding lens matches the task lens
|
|
219
|
-
- cited and affected paths are in assigned coverage
|
|
220
|
-
- line spans do not exceed known `total_lines`
|
|
221
|
-
- result fields conform to the shipped schemas
|
|
222
|
-
|
|
223
|
-
Workers should retry rejected submissions up to the bounded retry count in the prompt.
|
|
224
|
-
|
|
225
|
-
## `merge-and-ingest` Output
|
|
226
|
-
|
|
227
|
-
Command:
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
audit-code merge-and-ingest --run-id <run_id> --artifacts-dir <artifacts_dir>
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
Merge behavior:
|
|
234
|
-
|
|
235
|
-
- validates every backend-assigned result-map path
|
|
236
|
-
- rejects unexpected JSON files under `task-results/`
|
|
237
|
-
- rejects task IDs that appear in the wrong assigned result path
|
|
238
|
-
- rejects duplicate task results
|
|
239
|
-
- rejects unknown task IDs
|
|
240
|
-
- rejects missing assigned task results
|
|
241
|
-
- writes `failed-tasks.json` and exits non-zero when any assigned result is
|
|
242
|
-
missing or invalid
|
|
243
|
-
- writes `audit-results.json` only from passing results
|
|
244
|
-
- invokes the normal result ingestion path only after the assigned set is clean
|
|
245
|
-
|
|
246
|
-
On success the command prints one compact JSON envelope:
|
|
247
|
-
|
|
248
|
-
```json
|
|
249
|
-
{
|
|
250
|
-
"run_id": "run-1",
|
|
251
|
-
"status": "completed",
|
|
252
|
-
"accepted_count": 18,
|
|
253
|
-
"rejected_count": 0,
|
|
254
|
-
"finding_count": 3,
|
|
255
|
-
"audit_results_path": ".audit-artifacts/runs/run-1/audit-results.json",
|
|
256
|
-
"selected_executor": "result_ingestion_executor",
|
|
257
|
-
"progress_made": true,
|
|
258
|
-
"progress_summary": "Ingested 18 audit result entries and refreshed dependent artifacts.",
|
|
259
|
-
"next_likely_step": "runtime_validation"
|
|
260
|
-
}
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
If the command exits non-zero, the orchestrator should stop and report the exact
|
|
264
|
-
error instead of manually editing task results or audit state.
|
|
265
|
-
|
|
266
|
-
## Selective Deepening
|
|
267
|
-
|
|
268
|
-
Result ingestion may add follow-up `AuditTask` records for bounded selective
|
|
269
|
-
deepening. Triggers include:
|
|
270
|
-
|
|
271
|
-
- high-severity findings
|
|
272
|
-
- low-confidence or ambiguous findings
|
|
273
|
-
- conflicting conclusions across related results
|
|
274
|
-
- high-risk no-finding sampling unless explicitly marked unnecessary
|
|
275
|
-
- runtime-validation disagreement
|
|
276
|
-
|
|
277
|
-
When follow-up tasks are added, the backend refreshes `review_packets.json` and
|
|
278
|
-
`audit_plan_metrics.json`. The next dispatch cycle handles those tasks through
|
|
279
|
-
the same packet contract.
|
|
280
|
-
|
|
281
|
-
## Compatibility Notes
|
|
282
|
-
|
|
283
|
-
- `AuditTask` remains the planning and coverage identity.
|
|
284
|
-
- `AuditResult[]` remains the ingestion shape.
|
|
285
|
-
- The older `.audit-artifacts/dispatch/current-*` files still exist for
|
|
286
|
-
repo-local backend fallback and single-task handoff flows.
|
|
287
|
-
- Backend provider adapters remain compatibility bridges. The canonical
|
|
288
|
-
`/audit-code` flow expects the active conversation orchestrator to dispatch
|
|
289
|
-
packet subagents when the host supports them.
|
|
290
|
-
- The `dispatch/` directory is packaged because `lens-definitions.json` and
|
|
291
|
-
validation support are part of the installed packet workflow.
|
|
292
|
-
|
|
293
|
-
## Verification
|
|
294
|
-
|
|
295
|
-
Run the normal project gate:
|
|
296
|
-
|
|
297
|
-
```bash
|
|
298
|
-
npm test
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
Focused packet coverage lives in `tests/review-packets.test.mjs` and
|
|
302
|
-
`tests/audit-code-wrapper.test.mjs`.
|