auditor-lambda 0.3.2 → 0.3.4
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 +6 -1
- package/audit-code-wrapper-lib.mjs +78 -5
- package/dist/cli.js +205 -67
- package/dist/extractors/graph.d.ts +5 -1
- package/dist/extractors/graph.js +223 -3
- package/dist/extractors/pathPatterns.d.ts +3 -2
- package/dist/extractors/pathPatterns.js +97 -24
- package/dist/io/artifacts.d.ts +5 -0
- package/dist/io/artifacts.js +2 -0
- package/dist/io/json.js +3 -3
- package/dist/io/runArtifacts.js +4 -0
- package/dist/mcp/server.js +24 -11
- package/dist/orchestrator/advance.js +1 -1
- package/dist/orchestrator/dependencyMap.js +18 -0
- package/dist/orchestrator/internalExecutors.d.ts +1 -1
- package/dist/orchestrator/internalExecutors.js +120 -33
- package/dist/orchestrator/reviewPackets.d.ts +14 -0
- package/dist/orchestrator/reviewPackets.js +300 -0
- package/dist/orchestrator/selectiveDeepening.d.ts +14 -0
- package/dist/orchestrator/selectiveDeepening.js +392 -0
- package/dist/orchestrator/state.js +6 -1
- package/dist/orchestrator/taskBuilder.d.ts +16 -0
- package/dist/orchestrator/taskBuilder.js +68 -11
- package/dist/orchestrator.js +53 -2
- package/dist/prompts/renderWorkerPrompt.js +11 -4
- package/dist/providers/index.js +1 -1
- package/dist/supervisor/sessionConfig.js +1 -1
- package/dist/types/graph.d.ts +1 -0
- package/dist/types/reviewPlanning.d.ts +41 -0
- package/dist/types/reviewPlanning.js +1 -0
- package/dist/validation/artifacts.js +13 -0
- package/dist/validation/sessionConfig.js +1 -1
- package/docs/agent-integrations.md +17 -8
- package/docs/bootstrap-install.md +3 -0
- package/docs/dispatch-implementation-plan.md +179 -481
- package/docs/next-steps.md +13 -8
- package/docs/product-direction.md +5 -3
- package/docs/run-flow.md +23 -30
- package/docs/session-config.md +10 -3
- package/docs/supervisor.md +12 -4
- package/docs/workflow-refactor-brief.md +85 -147
- package/package.json +1 -1
- package/schemas/audit_results.schema.json +10 -0
- package/schemas/finding.schema.json +1 -15
- package/schemas/graph_bundle.schema.json +16 -0
- package/skills/audit-code/SKILL.md +12 -3
- package/skills/audit-code/audit-code.prompt.md +87 -57
|
@@ -1,22 +1,37 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Autonomous local loop code auditing
|
|
2
|
+
description: Autonomous local loop code auditing - advances deterministic audit state, delegates bounded review tasks, and ingests validated results
|
|
3
3
|
argument-hint: [target-dir]
|
|
4
|
-
allowed-tools: [Read, Write,
|
|
4
|
+
allowed-tools: [Read, Write, Bash, Glob, Grep, Agent]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# `/audit-code` Execution Directive
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
You are the audit-code orchestrator for this conversation. The user-facing
|
|
10
|
+
surface is only `/audit-code`; do not ask the user to choose backend commands,
|
|
11
|
+
providers, models, paths, or batching strategy during normal operation.
|
|
12
|
+
|
|
13
|
+
Your job is to advance the deterministic state machine, delegate bounded
|
|
14
|
+
semantic review when the host supports subagents, and let the backend validate
|
|
15
|
+
and ingest results mechanically.
|
|
16
|
+
|
|
17
|
+
## Core Guardrails
|
|
18
|
+
|
|
19
|
+
- Do not edit source files during semantic review. The deterministic
|
|
20
|
+
`auto_fixes_applied` executor may run formatter/remediation commands before
|
|
21
|
+
review; that is part of the backend workflow.
|
|
22
|
+
- Do not manually merge audit results, manually update coverage, or manually
|
|
23
|
+
edit audit state.
|
|
24
|
+
- Do not read result schemas or completed result payloads into context unless
|
|
25
|
+
a backend command fails and the error explicitly requires diagnosis.
|
|
26
|
+
- Do not inspect individual subagent result files after dispatch. Validation
|
|
27
|
+
and ingestion are backend responsibilities.
|
|
28
|
+
- Prefer subagent dispatch for semantic review whenever the host exposes an
|
|
29
|
+
Agent/subagent tool.
|
|
30
|
+
- If the host cannot dispatch subagents, complete exactly one assigned review
|
|
31
|
+
task, run the provided ingestion command, then stop. The user can run
|
|
32
|
+
`/audit-code` again to continue from fresh context.
|
|
33
|
+
|
|
34
|
+
## Step 1 - Advance Deterministic State
|
|
20
35
|
|
|
21
36
|
Run:
|
|
22
37
|
|
|
@@ -24,82 +39,97 @@ Run:
|
|
|
24
39
|
audit-code
|
|
25
40
|
```
|
|
26
41
|
|
|
27
|
-
|
|
42
|
+
Inside the `auditor-lambda` repository itself, use:
|
|
28
43
|
|
|
29
|
-
|
|
44
|
+
```bash
|
|
45
|
+
node audit-code.mjs
|
|
46
|
+
```
|
|
30
47
|
|
|
31
|
-
|
|
32
|
-
|--------|--------|
|
|
33
|
-
| `"complete"` | Go to **Step 6** |
|
|
34
|
-
| `"active"` | Deterministic progress was made — loop immediately back to Step 1 |
|
|
35
|
-
| `"blocked"` | LLM work needed — continue to Step 2 |
|
|
48
|
+
Parse only the command JSON envelope needed for routing:
|
|
36
49
|
|
|
37
|
-
|
|
50
|
+
- `audit_state.status`
|
|
51
|
+
- `handoff.active_review_run.run_id`
|
|
52
|
+
- `handoff.artifacts_dir`
|
|
53
|
+
- `handoff.active_review_run.task_path`
|
|
54
|
+
- `handoff.active_review_run.prompt_path`
|
|
55
|
+
- `handoff.active_review_run.pending_audit_tasks_path`
|
|
56
|
+
- `handoff.active_review_run.audit_results_path`
|
|
57
|
+
- `handoff.active_review_run.worker_command`
|
|
38
58
|
|
|
39
|
-
|
|
59
|
+
If status is `"active"`, deterministic progress was made. Run Step 1 again.
|
|
40
60
|
|
|
41
|
-
|
|
42
|
-
- `run_id` — from `handoff.active_review_run.run_id`
|
|
43
|
-
- `artifacts_dir` — from `handoff.artifacts_dir`
|
|
61
|
+
If status is `"complete"`, skip to Step 5.
|
|
44
62
|
|
|
45
|
-
|
|
63
|
+
If status is `"blocked"` and the blocker is not semantic review, report the
|
|
64
|
+
blocker verbatim and stop.
|
|
46
65
|
|
|
47
|
-
|
|
66
|
+
If status is `"blocked"` for semantic review, continue to Step 2.
|
|
48
67
|
|
|
49
|
-
|
|
68
|
+
## Step 2 - Dispatch Review Work
|
|
50
69
|
|
|
51
|
-
|
|
70
|
+
When the host supports subagents, prepare a dispatch plan:
|
|
52
71
|
|
|
53
72
|
```bash
|
|
54
73
|
audit-code prepare-dispatch --run-id <run_id> --artifacts-dir <artifacts_dir>
|
|
55
74
|
```
|
|
56
75
|
|
|
57
|
-
Read `<artifacts_dir>/runs/<run_id>/dispatch-plan.json`.
|
|
58
|
-
- `task_id` — task identifier
|
|
59
|
-
- `description` — short label for the Agent call
|
|
60
|
-
- `output_path` — where the subagent writes its result
|
|
61
|
-
- `prompt_path` — path to the complete subagent instructions file
|
|
76
|
+
Read only `<artifacts_dir>/runs/<run_id>/dispatch-plan.json`.
|
|
62
77
|
|
|
63
|
-
|
|
78
|
+
In a single message, launch one Agent/subagent call per dispatch-plan entry:
|
|
64
79
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
**In a single message**, fire one `Agent` call per entry in `dispatch-plan.json`:
|
|
68
|
-
|
|
69
|
-
```
|
|
80
|
+
```text
|
|
70
81
|
Agent({ description: entry.description, prompt: "Read and follow the audit instructions in: " + entry.prompt_path })
|
|
71
82
|
```
|
|
72
83
|
|
|
73
|
-
All calls
|
|
74
|
-
|
|
75
|
-
Each subagent reads its instruction file, reviews the assigned code, writes a validated JSON result to `output_path`, and self-validates. You do not need to inspect individual subagent output.
|
|
76
|
-
|
|
77
|
-
---
|
|
84
|
+
All subagent calls should be launched together. Wait for them to finish.
|
|
78
85
|
|
|
79
|
-
|
|
86
|
+
Subagents own bounded semantic review. They must read only their prompt and
|
|
87
|
+
assigned files, write exactly the requested audit result JSON to `output_path`,
|
|
88
|
+
run the validation command in their prompt, retry up to 3 times if validation
|
|
89
|
+
fails, and stop. They must not edit source files, remediate findings, create
|
|
90
|
+
extra task results, run unrelated audits, or write the worker `result.json`
|
|
91
|
+
control envelope.
|
|
80
92
|
|
|
81
|
-
|
|
93
|
+
Then run:
|
|
82
94
|
|
|
83
95
|
```bash
|
|
84
96
|
audit-code merge-and-ingest --run-id <run_id> --artifacts-dir <artifacts_dir>
|
|
85
97
|
```
|
|
86
98
|
|
|
87
|
-
|
|
99
|
+
If `merge-and-ingest` exits non-zero, stop immediately and report the exact
|
|
100
|
+
error. Do not improvise manual merging or state edits.
|
|
88
101
|
|
|
89
|
-
|
|
102
|
+
Loop back to Step 1.
|
|
90
103
|
|
|
91
|
-
|
|
104
|
+
## Step 3 - Single-Task Fallback
|
|
92
105
|
|
|
93
|
-
|
|
106
|
+
Use this path only when the host cannot dispatch subagents.
|
|
94
107
|
|
|
95
|
-
Read
|
|
108
|
+
Read the current review prompt named by `handoff.active_review_run.prompt_path`
|
|
109
|
+
or `.audit-artifacts/dispatch/current-prompt.md`, plus the matching task file
|
|
110
|
+
needed to find `audit_results_path` and `worker_command`.
|
|
96
111
|
|
|
97
|
-
|
|
112
|
+
Complete exactly one assigned review task. If a batch file lists multiple tasks,
|
|
113
|
+
choose the first pending task only. Read only that task's assigned files. Write
|
|
114
|
+
one valid `AuditResult` object, wrapped in a JSON array, to `audit_results_path`.
|
|
115
|
+
|
|
116
|
+
Run the exact `worker_command` from the task file. Then stop and summarize that
|
|
117
|
+
one bounded step. Do not loop into another semantic review task in the same
|
|
118
|
+
conversation turn.
|
|
119
|
+
|
|
120
|
+
## Step 4 - Backend Failure Handling
|
|
121
|
+
|
|
122
|
+
If `prepare-dispatch`, `merge-and-ingest`, or `worker_command` fails:
|
|
98
123
|
|
|
99
|
-
|
|
124
|
+
- stop immediately
|
|
125
|
+
- report the exact command and error output
|
|
126
|
+
- do not manually create prompts, split tasks, merge results, edit state, or
|
|
127
|
+
remediate application code
|
|
100
128
|
|
|
101
|
-
|
|
129
|
+
Invalid or missing subagent output is a blocker. It should not be silently
|
|
130
|
+
merged or treated as automatic progress.
|
|
102
131
|
|
|
103
|
-
|
|
132
|
+
## Step 5 - Present Results
|
|
104
133
|
|
|
105
|
-
|
|
134
|
+
When `audit_state.status` is `"complete"`, do not run the orchestrator again.
|
|
135
|
+
Read `audit-report.md` and present the completed audit with work blocks first.
|