auditor-lambda 0.1.0 → 0.2.2
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 +2 -1
- package/audit-code-wrapper-lib.mjs +205 -187
- package/dist/adapters/eslint.js +4 -2
- package/dist/adapters/npmAudit.js +1 -1
- package/dist/cli.js +296 -12
- package/dist/coverage.d.ts +0 -1
- package/dist/coverage.js +3 -34
- package/dist/extractors/bucketing.js +14 -35
- package/dist/extractors/disposition.js +8 -9
- package/dist/extractors/flows.js +14 -23
- package/dist/extractors/pathPatterns.d.ts +19 -0
- package/dist/extractors/pathPatterns.js +87 -0
- package/dist/extractors/surfaces.js +2 -7
- package/dist/io/artifacts.d.ts +23 -1
- package/dist/io/artifacts.js +3 -1
- package/dist/io/runArtifacts.js +1 -1
- package/dist/orchestrator/advance.js +1 -1
- package/dist/orchestrator/flowPlanning.d.ts +1 -1
- package/dist/orchestrator/flowPlanning.js +21 -28
- package/dist/orchestrator/internalExecutors.js +4 -7
- package/dist/orchestrator/planning.js +12 -20
- package/dist/orchestrator/resultIngestion.js +3 -2
- package/dist/orchestrator/runtimeValidation.js +5 -0
- package/dist/orchestrator/syntaxResolutionExecutor.js +10 -2
- package/dist/orchestrator/taskBuilder.d.ts +7 -2
- package/dist/orchestrator/taskBuilder.js +47 -52
- package/dist/prompts/renderWorkerPrompt.js +33 -0
- package/dist/providers/claudeCodeProvider.js +5 -0
- package/dist/providers/constants.d.ts +1 -0
- package/dist/providers/constants.js +1 -0
- package/dist/providers/index.js +9 -2
- package/dist/providers/spawnLoggedCommand.js +4 -0
- package/dist/reporting/mergeFindings.js +0 -7
- package/dist/reporting/rootCause.d.ts +0 -1
- package/dist/reporting/rootCause.js +0 -6
- package/dist/reporting/synthesis.js +18 -0
- package/dist/supervisor/operatorHandoff.d.ts +2 -0
- package/dist/supervisor/operatorHandoff.js +21 -9
- package/dist/supervisor/runLedger.js +6 -3
- package/dist/supervisor/sessionConfig.js +1 -0
- package/dist/types/flowCoverage.d.ts +1 -1
- package/dist/types/runLedger.d.ts +1 -1
- package/dist/types/runtimeValidation.d.ts +2 -1
- package/dist/types/sessionConfig.d.ts +2 -0
- package/dist/types/surfaces.d.ts +2 -1
- package/dist/types/workerSession.d.ts +4 -0
- package/dist/types.d.ts +0 -2
- package/dist/validation/auditResults.d.ts +11 -0
- package/dist/validation/auditResults.js +118 -0
- package/docs/agent-integrations.md +61 -56
- package/docs/agent-roles.md +69 -69
- package/docs/architecture.md +90 -90
- package/docs/artifacts.md +69 -69
- package/docs/bootstrap-install.md +1 -1
- package/docs/model-selection.md +86 -86
- package/docs/next-steps.md +11 -9
- package/docs/packaging.md +3 -3
- package/docs/pipeline.md +152 -152
- package/docs/production-readiness.md +6 -5
- package/docs/repo-layout.md +18 -18
- package/docs/run-flow.md +5 -5
- package/docs/session-config.md +216 -210
- package/docs/supervisor.md +70 -70
- package/docs/windows-setup.md +139 -139
- package/package.json +56 -56
- package/schemas/audit-code-v1alpha1.schema.json +80 -76
- package/schemas/audit_result.schema.json +54 -48
- package/schemas/audit_state.schema.json +2 -2
- package/schemas/audit_task.schema.json +60 -49
- package/schemas/blind_spot_register.schema.json +13 -3
- package/schemas/coverage_matrix.schema.json +14 -17
- package/schemas/critical_flows.schema.json +6 -3
- package/schemas/external_analyzer_results.schema.json +10 -4
- package/schemas/file_disposition.schema.json +33 -33
- package/schemas/finding.schema.json +86 -62
- package/schemas/flow_coverage.schema.json +53 -44
- package/schemas/graph_bundle.schema.json +12 -6
- package/schemas/merged_findings.schema.json +7 -2
- package/schemas/risk_register.schema.json +5 -1
- package/schemas/root_cause_clusters.schema.json +2 -5
- package/schemas/runtime_validation_report.schema.json +34 -34
- package/schemas/runtime_validation_tasks.schema.json +4 -1
- package/schemas/surface_manifest.schema.json +4 -1
- package/schemas/synthesis_report.schema.json +61 -61
- package/schemas/unit_manifest.schema.json +10 -3
- package/skills/audit-code/SKILL.md +37 -37
- package/skills/audit-code/audit-code.prompt.md +54 -54
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
const REQUIRED_FINDING_FIELDS = [
|
|
2
|
+
"id",
|
|
3
|
+
"title",
|
|
4
|
+
"category",
|
|
5
|
+
"severity",
|
|
6
|
+
"confidence",
|
|
7
|
+
"lens",
|
|
8
|
+
"summary",
|
|
9
|
+
];
|
|
10
|
+
const VALID_SEVERITIES = new Set(["critical", "high", "medium", "low", "info"]);
|
|
11
|
+
const VALID_CONFIDENCES = new Set(["high", "medium", "low"]);
|
|
12
|
+
function validateFinding(finding, label, taskId, resultIndex) {
|
|
13
|
+
const issues = [];
|
|
14
|
+
for (const field of REQUIRED_FINDING_FIELDS) {
|
|
15
|
+
const value = finding[field];
|
|
16
|
+
if (value === undefined || value === null || String(value).trim() === "") {
|
|
17
|
+
issues.push({
|
|
18
|
+
result_index: resultIndex,
|
|
19
|
+
task_id: taskId,
|
|
20
|
+
severity: "error",
|
|
21
|
+
field: `${label}.${field}`,
|
|
22
|
+
message: `Required field '${field}' is missing or empty.`,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (finding.severity && !VALID_SEVERITIES.has(finding.severity)) {
|
|
27
|
+
issues.push({
|
|
28
|
+
result_index: resultIndex,
|
|
29
|
+
task_id: taskId,
|
|
30
|
+
severity: "error",
|
|
31
|
+
field: `${label}.severity`,
|
|
32
|
+
message: `Invalid severity '${finding.severity}'. Must be one of: ${[...VALID_SEVERITIES].join(", ")}.`,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (finding.confidence && !VALID_CONFIDENCES.has(finding.confidence)) {
|
|
36
|
+
issues.push({
|
|
37
|
+
result_index: resultIndex,
|
|
38
|
+
task_id: taskId,
|
|
39
|
+
severity: "error",
|
|
40
|
+
field: `${label}.confidence`,
|
|
41
|
+
message: `Invalid confidence '${finding.confidence}'. Must be one of: ${[...VALID_CONFIDENCES].join(", ")}.`,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (!finding.affected_files || finding.affected_files.length === 0) {
|
|
45
|
+
issues.push({
|
|
46
|
+
result_index: resultIndex,
|
|
47
|
+
task_id: taskId,
|
|
48
|
+
severity: "error",
|
|
49
|
+
field: `${label}.affected_files`,
|
|
50
|
+
message: "affected_files is empty — at least one file location is required.",
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
for (let k = 0; k < finding.affected_files.length; k++) {
|
|
55
|
+
const af = finding.affected_files[k];
|
|
56
|
+
if (!af.path?.trim()) {
|
|
57
|
+
issues.push({
|
|
58
|
+
result_index: resultIndex,
|
|
59
|
+
task_id: taskId,
|
|
60
|
+
severity: "error",
|
|
61
|
+
field: `${label}.affected_files[${k}].path`,
|
|
62
|
+
message: "affected_files entry has an empty path.",
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (!finding.evidence || finding.evidence.length === 0) {
|
|
68
|
+
issues.push({
|
|
69
|
+
result_index: resultIndex,
|
|
70
|
+
task_id: taskId,
|
|
71
|
+
severity: "error",
|
|
72
|
+
field: `${label}.evidence`,
|
|
73
|
+
message: "evidence is empty — at least one quoted or referenced excerpt from the reviewed file is required for every finding.",
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
const hasSubstantiveEntry = finding.evidence.some((e) => e.trim().length > 0);
|
|
78
|
+
if (!hasSubstantiveEntry) {
|
|
79
|
+
issues.push({
|
|
80
|
+
result_index: resultIndex,
|
|
81
|
+
task_id: taskId,
|
|
82
|
+
severity: "error",
|
|
83
|
+
field: `${label}.evidence`,
|
|
84
|
+
message: "All evidence entries are empty strings.",
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return issues;
|
|
89
|
+
}
|
|
90
|
+
export function validateAuditResults(results, tasks) {
|
|
91
|
+
const issues = [];
|
|
92
|
+
const taskMap = new Map(tasks.map((t) => [t.task_id, t]));
|
|
93
|
+
for (let i = 0; i < results.length; i++) {
|
|
94
|
+
const result = results[i];
|
|
95
|
+
const taskId = result.task_id ?? `result[${i}]`;
|
|
96
|
+
if (!result.reviewed_ranges || result.reviewed_ranges.length === 0) {
|
|
97
|
+
issues.push({
|
|
98
|
+
result_index: i,
|
|
99
|
+
task_id: taskId,
|
|
100
|
+
severity: "error",
|
|
101
|
+
field: "reviewed_ranges",
|
|
102
|
+
message: "reviewed_ranges is empty — no proof of file reading was recorded. " +
|
|
103
|
+
"Each result must include the line ranges actually read.",
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
for (let j = 0; j < (result.findings ?? []).length; j++) {
|
|
107
|
+
const finding = result.findings[j];
|
|
108
|
+
const label = `findings[${j}]`;
|
|
109
|
+
issues.push(...validateFinding(finding, label, taskId, i));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return issues;
|
|
113
|
+
}
|
|
114
|
+
export function formatAuditResultIssues(issues) {
|
|
115
|
+
return issues
|
|
116
|
+
.map((issue) => ` [${issue.severity}] ${issue.task_id} / ${issue.field}: ${issue.message}`)
|
|
117
|
+
.join("\n");
|
|
118
|
+
}
|
|
@@ -80,7 +80,7 @@ Run `audit-code install` from the target repository root, then open `.audit-code
|
|
|
80
80
|
|
|
81
81
|
There is no verified project-local slash-command install surface for Claude Desktop in this repository today, so the intended path is:
|
|
82
82
|
|
|
83
|
-
1. import `.audit-code/install/audit-code.
|
|
83
|
+
1. import `.audit-code/install/audit-code.import.md` into Claude Desktop's prompt or instruction surface
|
|
84
84
|
2. invoke `/audit-code` conversationally inside Claude Desktop
|
|
85
85
|
|
|
86
86
|
### Antigravity
|
|
@@ -89,7 +89,7 @@ Run `audit-code install` from the target repository root, then open `.audit-code
|
|
|
89
89
|
|
|
90
90
|
There is no verified repo-local slash-command install surface for Antigravity in this repository today, so the intended path is:
|
|
91
91
|
|
|
92
|
-
1. import `.audit-code/install/audit-code.
|
|
92
|
+
1. import `.audit-code/install/audit-code.import.md` into Antigravity's prompt or instruction surface when available
|
|
93
93
|
2. invoke `/audit-code` conversationally inside Antigravity
|
|
94
94
|
3. fall back to `audit-code` from an Antigravity-managed terminal only when you intentionally need the repo-local backend wrapper
|
|
95
95
|
|
|
@@ -116,19 +116,19 @@ Use the backend wrapper only when you intentionally need the repo-local fallback
|
|
|
116
116
|
It:
|
|
117
117
|
|
|
118
118
|
- defaults artifacts to `<repo-root>/.audit-artifacts`
|
|
119
|
-
- persists audit continuity there
|
|
120
|
-
- calls `run-to-completion` by default
|
|
121
|
-
- creates fresh worker runs behind the scenes
|
|
119
|
+
- persists audit continuity there
|
|
120
|
+
- calls `run-to-completion` by default
|
|
121
|
+
- creates fresh worker runs behind the scenes
|
|
122
122
|
- returns a stable top-level JSON contract with `contract_version: "audit-code/v1alpha1"`
|
|
123
123
|
|
|
124
124
|
## Minimal repo-local flow
|
|
125
125
|
|
|
126
126
|
From the target repository root:
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
audit-code
|
|
130
|
-
```
|
|
131
|
-
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
audit-code
|
|
130
|
+
```
|
|
131
|
+
|
|
132
132
|
Inspect the returned JSON and continue invoking the same entrypoint until either:
|
|
133
133
|
|
|
134
134
|
- `next_likely_step === null`
|
|
@@ -136,8 +136,10 @@ Inspect the returned JSON and continue invoking the same entrypoint until either
|
|
|
136
136
|
Terminal interpretation:
|
|
137
137
|
|
|
138
138
|
- `audit_state.status === "complete"` means the audit finished end to end.
|
|
139
|
-
- `audit_state.status === "blocked"` means the wrapper exhausted automatic work and the remaining review needs imported results or
|
|
140
|
-
|
|
139
|
+
- `audit_state.status === "blocked"` means the wrapper exhausted automatic work and the remaining review still needs imported results or a provider-capable continuation path.
|
|
140
|
+
|
|
141
|
+
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.
|
|
142
|
+
|
|
141
143
|
When additional evidence exists, pass it into the same wrapper:
|
|
142
144
|
|
|
143
145
|
```bash
|
|
@@ -159,31 +161,34 @@ Use when you want the supervisor to stay entirely local.
|
|
|
159
161
|
This requires no external agent CLI. The supervisor launches fresh worker subprocesses that call the bounded `worker-run` entrypoint for deterministic stages.
|
|
160
162
|
|
|
161
163
|
When the remaining work is genuinely audit-task review, `local-subprocess` stops in a terminal blocked handoff instead of pretending more automatic progress is available.
|
|
162
|
-
|
|
163
|
-
This is the safest default backend when the repository is already available locally.
|
|
164
|
-
|
|
165
|
-
### claude-code
|
|
166
|
-
|
|
167
|
-
Use when Claude Code is installed and authenticated on the machine.
|
|
168
|
-
|
|
169
|
-
The built-in adapter launches a fresh Claude Code print-mode session for each worker run.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
164
|
+
|
|
165
|
+
This is the safest default backend when the repository is already available locally.
|
|
166
|
+
|
|
167
|
+
### claude-code
|
|
168
|
+
|
|
169
|
+
Use when Claude Code is installed and authenticated on the machine.
|
|
170
|
+
|
|
171
|
+
The built-in adapter launches a fresh Claude Code print-mode session for each worker run.
|
|
172
|
+
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.
|
|
173
|
+
|
|
174
|
+
Recommended when you want the audit supervisor to delegate bounded tasks into Claude Code without manually driving each step.
|
|
175
|
+
|
|
176
|
+
### opencode
|
|
177
|
+
|
|
178
|
+
Use when OpenCode is installed and authenticated on the machine.
|
|
179
|
+
|
|
180
|
+
The built-in adapter launches a fresh `opencode run ...` session for each worker run.
|
|
181
|
+
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.
|
|
182
|
+
|
|
183
|
+
Recommended when OpenCode is the preferred local agent surface.
|
|
184
|
+
|
|
185
|
+
### subprocess-template
|
|
186
|
+
|
|
187
|
+
Use when you need a generic bridge.
|
|
188
|
+
|
|
189
|
+
This is the escape hatch for editors, launchers, or agent shells that do not yet have a dedicated provider adapter. The supervisor renders a templated command and executes it as a fresh worker run.
|
|
190
|
+
For provider-assisted review stages, that bridge should write `task.audit_results_path` and then execute `task.worker_command`.
|
|
191
|
+
|
|
187
192
|
### vscode-task
|
|
188
193
|
|
|
189
194
|
Use when you already have a repository-local or machine-local task bridge and want the supervisor to call that bridge through a command template.
|
|
@@ -193,11 +198,11 @@ Treat this as an advanced backend adapter rather than the default path.
|
|
|
193
198
|
### Claude Code
|
|
194
199
|
|
|
195
200
|
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.
|
|
196
|
-
|
|
197
|
-
### OpenCode
|
|
198
|
-
|
|
199
|
-
Use the same repo-local `audit-code` wrapper, or set `provider` to `opencode` so the supervisor delegates bounded worker runs into OpenCode.
|
|
200
|
-
|
|
201
|
+
|
|
202
|
+
### OpenCode
|
|
203
|
+
|
|
204
|
+
Use the same repo-local `audit-code` wrapper, or set `provider` to `opencode` so the supervisor delegates bounded worker runs into OpenCode.
|
|
205
|
+
|
|
201
206
|
### VS Code
|
|
202
207
|
|
|
203
208
|
Run `audit-code install` once from the target repository root, then use `/audit-code` from chat.
|
|
@@ -205,11 +210,11 @@ Run `audit-code install` once from the target repository root, then use `/audit-
|
|
|
205
210
|
The backend fallback is still available from the integrated terminal and should keep `local-subprocess` unless you specifically need a task bridge.
|
|
206
211
|
|
|
207
212
|
If you already have a launcher or task surface that should own fresh worker windows, use `vscode-task` or `subprocess-template`.
|
|
208
|
-
|
|
209
|
-
### Google Antigravity
|
|
210
|
-
|
|
211
|
-
No dedicated Antigravity provider adapter is shipped today.
|
|
212
|
-
|
|
213
|
+
|
|
214
|
+
### Google Antigravity
|
|
215
|
+
|
|
216
|
+
No dedicated Antigravity provider adapter is shipped today.
|
|
217
|
+
|
|
213
218
|
Current recommended usage is one of these:
|
|
214
219
|
|
|
215
220
|
- use the skill-first conversational contract as the primary surface
|
|
@@ -218,14 +223,14 @@ Current recommended usage is one of these:
|
|
|
218
223
|
- use `subprocess-template` if you have a reliable Antigravity-side launcher bridge
|
|
219
224
|
|
|
220
225
|
That keeps the product usable in Antigravity now without pretending that a native adapter already exists.
|
|
221
|
-
|
|
222
|
-
## Model-selection rule
|
|
223
|
-
|
|
224
|
-
The product direction remains skill-first:
|
|
225
|
-
|
|
226
|
-
- in conversation, use the active conversation model by default
|
|
227
|
-
- for backend CLI delegation, let the chosen provider own its own model-selection behavior unless explicitly configured otherwise
|
|
228
|
-
|
|
226
|
+
|
|
227
|
+
## Model-selection rule
|
|
228
|
+
|
|
229
|
+
The product direction remains skill-first:
|
|
230
|
+
|
|
231
|
+
- in conversation, use the active conversation model by default
|
|
232
|
+
- for backend CLI delegation, let the chosen provider own its own model-selection behavior unless explicitly configured otherwise
|
|
233
|
+
|
|
229
234
|
## Practical recommendation
|
|
230
235
|
|
|
231
236
|
For a polished operator experience today:
|
|
@@ -233,5 +238,5 @@ For a polished operator experience today:
|
|
|
233
238
|
1. treat `/audit-code` as the canonical user-facing contract
|
|
234
239
|
2. use `audit-code install` first, and fall back to `audit-code prompt-path` only for hosts that still require manual prompt import
|
|
235
240
|
3. use `audit-code` as the repo-local backend fallback
|
|
236
|
-
4. prefer `local-subprocess` unless you
|
|
241
|
+
4. prefer `local-subprocess` unless you want interactive review to continue automatically through agent tasks
|
|
237
242
|
5. use `subprocess-template` only when integrating a non-native editor or launcher surface
|
package/docs/agent-roles.md
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
# Agent roles
|
|
2
|
-
|
|
3
|
-
## Principles
|
|
4
|
-
|
|
5
|
-
Each agent should consume bounded artifacts and return structured outputs. Agents should not invent process rules.
|
|
6
|
-
|
|
7
|
-
## Roles
|
|
8
|
-
|
|
9
|
-
### intake-normalizer
|
|
10
|
-
|
|
11
|
-
- validates repository intake artifacts
|
|
12
|
-
- flags suspicious exclusions
|
|
13
|
-
- confirms stack profile
|
|
14
|
-
|
|
15
|
-
### structural-mapper
|
|
16
|
-
|
|
17
|
-
- reviews extracted units, surfaces, and graph artifacts
|
|
18
|
-
- resolves ambiguous file classifications
|
|
19
|
-
- flags missing boundaries
|
|
20
|
-
|
|
21
|
-
### blind-spot-mapper
|
|
22
|
-
|
|
23
|
-
- identifies repo-specific blind spots tools may miss
|
|
24
|
-
- flags hidden operational or security-critical surfaces
|
|
25
|
-
- proposes additional lenses or dynamic checks
|
|
26
|
-
|
|
27
|
-
### correctness-auditor
|
|
28
|
-
|
|
29
|
-
- checks whether code behavior appears to match intent
|
|
30
|
-
- focuses on edge cases, defaults, assumptions, and branch handling
|
|
31
|
-
|
|
32
|
-
### architecture-auditor
|
|
33
|
-
|
|
34
|
-
- inspects layering, boundaries, coupling, abstraction fit, and dependency direction
|
|
35
|
-
|
|
36
|
-
### security-auditor
|
|
37
|
-
|
|
38
|
-
- inspects trust boundaries, auth/authz, validation, secret handling, risky sinks, and exploitability
|
|
39
|
-
|
|
40
|
-
### reliability-auditor
|
|
41
|
-
|
|
42
|
-
- inspects retries, timeouts, idempotency, partial failures, crash consistency, and concurrency risk
|
|
43
|
-
|
|
44
|
-
### performance-auditor
|
|
45
|
-
|
|
46
|
-
- inspects hot paths, repeated work, query inefficiency, algorithmic issues, memory pressure, and scalability risk
|
|
47
|
-
|
|
48
|
-
### data-integrity-auditor
|
|
49
|
-
|
|
50
|
-
- inspects invariants, migrations, transactional boundaries, schema drift, consistency, and race conditions
|
|
51
|
-
|
|
52
|
-
### test-auditor
|
|
53
|
-
|
|
54
|
-
- inspects test adequacy, missing negative-path coverage, brittle tests, and false confidence
|
|
55
|
-
|
|
56
|
-
### operability-auditor
|
|
57
|
-
|
|
58
|
-
- inspects logging, metrics, tracing, debuggability, startup validation, and runtime observability
|
|
59
|
-
|
|
60
|
-
### cross-cutting-auditor
|
|
61
|
-
|
|
62
|
-
- audits repo-wide themes such as auth, retries, migrations, config validation, feature flags, and secrets flow
|
|
63
|
-
|
|
64
|
-
### synthesizer
|
|
65
|
-
|
|
66
|
-
- merges duplicate findings
|
|
67
|
-
- clusters root causes
|
|
68
|
-
- prioritizes fixes
|
|
69
|
-
- identifies quick wins vs structural work
|
|
1
|
+
# Agent roles
|
|
2
|
+
|
|
3
|
+
## Principles
|
|
4
|
+
|
|
5
|
+
Each agent should consume bounded artifacts and return structured outputs. Agents should not invent process rules.
|
|
6
|
+
|
|
7
|
+
## Roles
|
|
8
|
+
|
|
9
|
+
### intake-normalizer
|
|
10
|
+
|
|
11
|
+
- validates repository intake artifacts
|
|
12
|
+
- flags suspicious exclusions
|
|
13
|
+
- confirms stack profile
|
|
14
|
+
|
|
15
|
+
### structural-mapper
|
|
16
|
+
|
|
17
|
+
- reviews extracted units, surfaces, and graph artifacts
|
|
18
|
+
- resolves ambiguous file classifications
|
|
19
|
+
- flags missing boundaries
|
|
20
|
+
|
|
21
|
+
### blind-spot-mapper
|
|
22
|
+
|
|
23
|
+
- identifies repo-specific blind spots tools may miss
|
|
24
|
+
- flags hidden operational or security-critical surfaces
|
|
25
|
+
- proposes additional lenses or dynamic checks
|
|
26
|
+
|
|
27
|
+
### correctness-auditor
|
|
28
|
+
|
|
29
|
+
- checks whether code behavior appears to match intent
|
|
30
|
+
- focuses on edge cases, defaults, assumptions, and branch handling
|
|
31
|
+
|
|
32
|
+
### architecture-auditor
|
|
33
|
+
|
|
34
|
+
- inspects layering, boundaries, coupling, abstraction fit, and dependency direction
|
|
35
|
+
|
|
36
|
+
### security-auditor
|
|
37
|
+
|
|
38
|
+
- inspects trust boundaries, auth/authz, validation, secret handling, risky sinks, and exploitability
|
|
39
|
+
|
|
40
|
+
### reliability-auditor
|
|
41
|
+
|
|
42
|
+
- inspects retries, timeouts, idempotency, partial failures, crash consistency, and concurrency risk
|
|
43
|
+
|
|
44
|
+
### performance-auditor
|
|
45
|
+
|
|
46
|
+
- inspects hot paths, repeated work, query inefficiency, algorithmic issues, memory pressure, and scalability risk
|
|
47
|
+
|
|
48
|
+
### data-integrity-auditor
|
|
49
|
+
|
|
50
|
+
- inspects invariants, migrations, transactional boundaries, schema drift, consistency, and race conditions
|
|
51
|
+
|
|
52
|
+
### test-auditor
|
|
53
|
+
|
|
54
|
+
- inspects test adequacy, missing negative-path coverage, brittle tests, and false confidence
|
|
55
|
+
|
|
56
|
+
### operability-auditor
|
|
57
|
+
|
|
58
|
+
- inspects logging, metrics, tracing, debuggability, startup validation, and runtime observability
|
|
59
|
+
|
|
60
|
+
### cross-cutting-auditor
|
|
61
|
+
|
|
62
|
+
- audits repo-wide themes such as auth, retries, migrations, config validation, feature flags, and secrets flow
|
|
63
|
+
|
|
64
|
+
### synthesizer
|
|
65
|
+
|
|
66
|
+
- merges duplicate findings
|
|
67
|
+
- clusters root causes
|
|
68
|
+
- prioritizes fixes
|
|
69
|
+
- identifies quick wins vs structural work
|
package/docs/architecture.md
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
# Architecture
|
|
2
|
-
|
|
3
|
-
## Objective
|
|
4
|
-
|
|
5
|
-
`auditor-lambda` is a portable code-auditing framework for arbitrary repositories. It separates deterministic extraction from bounded LLM judgment so that large or mixed-language codebases can be audited systematically.
|
|
6
|
-
|
|
7
|
-
## Design principles
|
|
8
|
-
|
|
9
|
-
1. Tool outputs first
|
|
10
|
-
2. Artifact-driven orchestration
|
|
11
|
-
3. Bounded LLM tasks
|
|
12
|
-
4. Explicit coverage accounting
|
|
13
|
-
5. Multi-pass review for critical code
|
|
14
|
-
6. Strict schemas for interoperability
|
|
15
|
-
|
|
16
|
-
## System layers
|
|
17
|
-
|
|
18
|
-
### 1. Intake
|
|
19
|
-
|
|
20
|
-
- file discovery
|
|
21
|
-
- stack detection
|
|
22
|
-
- ignore handling
|
|
23
|
-
- normalization
|
|
24
|
-
|
|
25
|
-
### 2. Extractors
|
|
26
|
-
|
|
27
|
-
- service and package detection
|
|
28
|
-
- route, job, command, workflow extraction
|
|
29
|
-
- file bucketing
|
|
30
|
-
- graph extraction
|
|
31
|
-
|
|
32
|
-
### 3. Mechanical analyzers
|
|
33
|
-
|
|
34
|
-
- lint
|
|
35
|
-
- typecheck
|
|
36
|
-
- tests
|
|
37
|
-
- test coverage
|
|
38
|
-
- secret scanning
|
|
39
|
-
- dependency scanning
|
|
40
|
-
- static security scanning
|
|
41
|
-
- complexity and duplication metrics
|
|
42
|
-
|
|
43
|
-
### 4. Orchestrator
|
|
44
|
-
|
|
45
|
-
- builds audit units
|
|
46
|
-
- assigns passes and lenses
|
|
47
|
-
- chunks large files
|
|
48
|
-
- tracks line coverage and pass overlap
|
|
49
|
-
- requeues uncovered ranges
|
|
50
|
-
|
|
51
|
-
### 5. LLM agents
|
|
52
|
-
|
|
53
|
-
- ambiguous classification
|
|
54
|
-
- blind-spot mapping
|
|
55
|
-
- per-lens audits
|
|
56
|
-
- cross-cutting audits
|
|
57
|
-
- synthesis
|
|
58
|
-
|
|
59
|
-
### 6. Validation
|
|
60
|
-
|
|
61
|
-
- targeted runtime checks
|
|
62
|
-
- startup/config probes
|
|
63
|
-
- adversarial repros
|
|
64
|
-
|
|
65
|
-
### 7. Reporting
|
|
66
|
-
|
|
67
|
-
- normalized findings
|
|
68
|
-
- coverage matrices
|
|
69
|
-
- root-cause clustering
|
|
70
|
-
- remediation planning
|
|
71
|
-
|
|
72
|
-
## Core pipeline
|
|
73
|
-
|
|
74
|
-
1. Intake and normalize repository
|
|
75
|
-
2. Extract structure and graph artifacts
|
|
76
|
-
3. Run mechanical analyzers
|
|
77
|
-
4. Build audit units and risk register
|
|
78
|
-
5. Run blind-spot mapping
|
|
79
|
-
6. Run lens-based unit audits
|
|
80
|
-
7. Run cross-cutting audits
|
|
81
|
-
8. Run dynamic validation on targeted cases
|
|
82
|
-
9. Verify file and line coverage
|
|
83
|
-
10. Synthesize findings and remediation plan
|
|
84
|
-
|
|
85
|
-
## Portability rules
|
|
86
|
-
|
|
87
|
-
- Tool-specific collectors should write into tool-agnostic JSON artifacts.
|
|
88
|
-
- LLM prompts should consume artifacts, not raw repos by default.
|
|
89
|
-
- All review work should be attributable to files, line ranges, lenses, and passes.
|
|
90
|
-
- Coverage gaps should be machine-detectable.
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
|
|
5
|
+
`auditor-lambda` is a portable code-auditing framework for arbitrary repositories. It separates deterministic extraction from bounded LLM judgment so that large or mixed-language codebases can be audited systematically.
|
|
6
|
+
|
|
7
|
+
## Design principles
|
|
8
|
+
|
|
9
|
+
1. Tool outputs first
|
|
10
|
+
2. Artifact-driven orchestration
|
|
11
|
+
3. Bounded LLM tasks
|
|
12
|
+
4. Explicit coverage accounting
|
|
13
|
+
5. Multi-pass review for critical code
|
|
14
|
+
6. Strict schemas for interoperability
|
|
15
|
+
|
|
16
|
+
## System layers
|
|
17
|
+
|
|
18
|
+
### 1. Intake
|
|
19
|
+
|
|
20
|
+
- file discovery
|
|
21
|
+
- stack detection
|
|
22
|
+
- ignore handling
|
|
23
|
+
- normalization
|
|
24
|
+
|
|
25
|
+
### 2. Extractors
|
|
26
|
+
|
|
27
|
+
- service and package detection
|
|
28
|
+
- route, job, command, workflow extraction
|
|
29
|
+
- file bucketing
|
|
30
|
+
- graph extraction
|
|
31
|
+
|
|
32
|
+
### 3. Mechanical analyzers
|
|
33
|
+
|
|
34
|
+
- lint
|
|
35
|
+
- typecheck
|
|
36
|
+
- tests
|
|
37
|
+
- test coverage
|
|
38
|
+
- secret scanning
|
|
39
|
+
- dependency scanning
|
|
40
|
+
- static security scanning
|
|
41
|
+
- complexity and duplication metrics
|
|
42
|
+
|
|
43
|
+
### 4. Orchestrator
|
|
44
|
+
|
|
45
|
+
- builds audit units
|
|
46
|
+
- assigns passes and lenses
|
|
47
|
+
- chunks large files
|
|
48
|
+
- tracks line coverage and pass overlap
|
|
49
|
+
- requeues uncovered ranges
|
|
50
|
+
|
|
51
|
+
### 5. LLM agents
|
|
52
|
+
|
|
53
|
+
- ambiguous classification
|
|
54
|
+
- blind-spot mapping
|
|
55
|
+
- per-lens audits
|
|
56
|
+
- cross-cutting audits
|
|
57
|
+
- synthesis
|
|
58
|
+
|
|
59
|
+
### 6. Validation
|
|
60
|
+
|
|
61
|
+
- targeted runtime checks
|
|
62
|
+
- startup/config probes
|
|
63
|
+
- adversarial repros
|
|
64
|
+
|
|
65
|
+
### 7. Reporting
|
|
66
|
+
|
|
67
|
+
- normalized findings
|
|
68
|
+
- coverage matrices
|
|
69
|
+
- root-cause clustering
|
|
70
|
+
- remediation planning
|
|
71
|
+
|
|
72
|
+
## Core pipeline
|
|
73
|
+
|
|
74
|
+
1. Intake and normalize repository
|
|
75
|
+
2. Extract structure and graph artifacts
|
|
76
|
+
3. Run mechanical analyzers
|
|
77
|
+
4. Build audit units and risk register
|
|
78
|
+
5. Run blind-spot mapping
|
|
79
|
+
6. Run lens-based unit audits
|
|
80
|
+
7. Run cross-cutting audits
|
|
81
|
+
8. Run dynamic validation on targeted cases
|
|
82
|
+
9. Verify file and line coverage
|
|
83
|
+
10. Synthesize findings and remediation plan
|
|
84
|
+
|
|
85
|
+
## Portability rules
|
|
86
|
+
|
|
87
|
+
- Tool-specific collectors should write into tool-agnostic JSON artifacts.
|
|
88
|
+
- LLM prompts should consume artifacts, not raw repos by default.
|
|
89
|
+
- All review work should be attributable to files, line ranges, lenses, and passes.
|
|
90
|
+
- Coverage gaps should be machine-detectable.
|