auditor-lambda 0.3.19 → 0.3.21

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.
@@ -1,46 +1,17 @@
1
1
  ---
2
- description: Autonomous local loop code auditing - advances deterministic audit state, delegates bounded review tasks, and ingests validated results
2
+ description: Autonomous local loop code auditing - loads one backend-rendered audit step at a time
3
3
  argument-hint: [target-dir]
4
4
  allowed-tools: [Read, Bash, Glob, Grep, Agent]
5
5
  ---
6
6
 
7
- # `/audit-code` Execution Directive
7
+ # `/audit-code` Loader
8
8
 
9
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.
10
+ surface is `/audit-code`, but the backend owns every audit workflow branch.
12
11
 
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.
12
+ ## Loader
16
13
 
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
- - CRITICAL: Do not use your `Read` tool to read `entry.prompt_path` or JSON schemas into your own context window. The subagent will read them. Pass the path literally.
29
- - Prefer subagent dispatch for semantic review whenever the host exposes an
30
- Agent/subagent tool.
31
- - Treat the user's `/audit-code` request as explicit authorization to launch
32
- review subagents in parallel. Do not ask for a separate delegation request
33
- before using available Agent/subagent tools.
34
- - Do not use `browser_subagent` for semantic review of source code unless the
35
- task explicitly requires browser-based validation.
36
- - If the host cannot dispatch subagents, complete exactly one assigned review
37
- task, run the provided ingestion command, then stop. The user can run
38
- `/audit-code` again to continue from fresh context.
39
-
40
- ## Step 1 - Advance Deterministic State
41
-
42
- First, make sure the repository has the minimal local assets required by the
43
- current host:
14
+ First, make sure the repository has current local audit assets:
44
15
 
45
16
  ```bash
46
17
  audit-code ensure --quiet
@@ -52,115 +23,24 @@ Inside the `auditor-lambda` repository itself, use:
52
23
  node audit-code.mjs ensure --quiet
53
24
  ```
54
25
 
55
- Then run:
26
+ Then ask the backend for exactly one next step:
56
27
 
57
28
  ```bash
58
- audit-code
29
+ audit-code next-step
59
30
  ```
60
31
 
61
32
  Inside the `auditor-lambda` repository itself, use:
62
33
 
63
34
  ```bash
64
- node audit-code.mjs
35
+ node audit-code.mjs next-step
65
36
  ```
66
37
 
67
- Parse only the command JSON envelope needed for routing:
68
-
69
- - `audit_state.status`
70
- - `handoff.active_review_run.run_id`
71
- - `handoff.artifacts_dir`
72
- - `handoff.active_review_run.task_path`
73
- - `handoff.active_review_run.prompt_path`
74
- - `handoff.active_review_run.pending_audit_tasks_path`
75
- - `handoff.active_review_run.audit_results_path`
76
- - `handoff.active_review_run.worker_command`
77
-
78
- If status is `"active"`, deterministic progress was made. Run Step 1 again.
79
-
80
- If status is `"complete"`, skip to Step 5.
81
-
82
- If status is `"blocked"` and the blocker is not semantic review, report the
83
- blocker verbatim and stop.
84
-
85
- If status is `"blocked"` for semantic review, continue to Step 2.
86
-
87
- ## Step 2 - Dispatch Review Work
88
-
89
- When the host supports subagents, prepare a dispatch plan by default:
90
-
91
- ```bash
92
- audit-code prepare-dispatch --run-id <run_id> --artifacts-dir <artifacts_dir>
93
- ```
94
-
95
- Read only `<artifacts_dir>/runs/<run_id>/dispatch-plan.json`.
96
-
97
- In a single message, launch one Agent/subagent call per dispatch-plan entry:
98
-
99
- ```text
100
- Agent({ description: entry.description, prompt: "Read and follow the audit instructions in: " + entry.prompt_path })
101
- ```
102
-
103
- Do NOT use your `Read` tool to load `entry.prompt_path` into your context window. The subagent has its own context window and will read the file.
104
-
105
- If the host supports per-subagent model selection, use `entry.model_hint.tier`
106
- as a provider-neutral routing hint (`small`, `standard`, or `deep`). Map it to
107
- available host models without asking the user to choose model names. If model
108
- selection is unavailable, ignore the hint and dispatch normally.
109
-
110
- If the host supports per-subagent tool restrictions, give review subagents no
111
- Write tool and allow shell access only for the `audit-code submit-packet`
112
- command printed in their prompt.
113
-
114
- All subagent calls should be launched together. Wait for them to finish.
115
-
116
- Subagents own bounded semantic review. They must read only their prompt and
117
- assigned files, produce the requested `AuditResult[]`, pipe it to the
118
- `submit-packet` command in their prompt, retry up to 3 times if submission
119
- fails, and stop. The backend command validates and writes the packet-owned
120
- result artifacts. They must not use direct file writes, edit source files,
121
- remediate findings, create extra task results, run unrelated audits, or write
122
- the worker `result.json` control envelope.
123
-
124
- Then run:
125
-
126
- ```bash
127
- audit-code merge-and-ingest --run-id <run_id> --artifacts-dir <artifacts_dir>
128
- ```
129
-
130
- If `merge-and-ingest` exits non-zero, stop immediately and report the exact
131
- error. Do not improvise manual merging or state edits.
132
-
133
- Loop back to Step 1.
134
-
135
- ## Step 3 - Single-Task Fallback
136
-
137
- Use this path only when the host cannot dispatch subagents.
138
-
139
- Read the current review prompt named by `handoff.active_review_run.prompt_path`
140
- or `.audit-artifacts/dispatch/current-prompt.md`, plus the matching task file
141
- needed to find `audit_results_path` and `worker_command`.
142
-
143
- Complete exactly one assigned review task. If a batch file lists multiple tasks,
144
- choose the first pending task only. Read only that task's assigned files. Write
145
- one valid `AuditResult` object, wrapped in a JSON array, to `audit_results_path`.
146
-
147
- Run the exact `worker_command` from the task file. Then stop and summarize that
148
- one bounded step. Do not loop into another semantic review task in the same
149
- conversation turn.
150
-
151
- ## Step 4 - Backend Failure Handling
152
-
153
- If `prepare-dispatch`, `merge-and-ingest`, or `worker_command` fails:
154
-
155
- - stop immediately
156
- - report the exact command and error output
157
- - do not manually create prompts, split tasks, merge results, edit state, or
158
- remediate application code
159
-
160
- Invalid or missing subagent output is a blocker. It should not be silently
161
- merged or treated as automatic progress.
38
+ Read the returned JSON only far enough to find `prompt_path`, then read and
39
+ follow only that prompt. Do not read packet prompts, schemas, command catalogs,
40
+ or handoff files unless the current step prompt explicitly instructs you to do
41
+ so.
162
42
 
163
- ## Step 5 - Present Results
43
+ When a step prompt tells you to continue, run `audit-code next-step` again and
44
+ follow only the newly returned `prompt_path`.
164
45
 
165
- When `audit_state.status` is `"complete"`, do not run the orchestrator again.
166
- Read `audit-report.md` and present the completed audit with work blocks first.
46
+ Stop when the current step prompt tells you to stop.