@dtlabs/ai-toolkit 0.1.7 → 0.2.1
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/.claude/agents/define-feature.md +1 -0
- package/.claude/agents/dependency-injection-refactoring.md +1 -0
- package/.claude/agents/dependency-supply-chain-security.md +1 -0
- package/.claude/agents/developer-backend.md +1 -0
- package/.claude/agents/developer-frontend.md +1 -0
- package/.claude/agents/developer-testing.md +1 -0
- package/.claude/agents/domain-model-refactoring.md +1 -0
- package/.claude/agents/god-class-decomposition.md +1 -0
- package/.claude/agents/init-agents-md.md +1 -0
- package/.claude/agents/install-toolkit.md +134 -3
- package/.claude/agents/intervention-documentation-standard.md +1 -0
- package/.claude/agents/review-solution.md +1 -0
- package/.claude/agents/security-hardening.md +1 -0
- package/.claude/agents/validate-feature-docs.md +2 -0
- package/.claude/settings.json +5 -0
- package/.claude/skills/assess-codebase/SKILL.md +139 -60
- package/.claude/skills/implement-feature/SKILL.md +208 -26
- package/.claude/workflows/am-phase1.js +304 -0
- package/.claude/workflows/am-phase2.js +166 -0
- package/.claude/workflows/pm-phase1.js +164 -0
- package/.claude/workflows/pm-phase2.js +108 -0
- package/.claude/workflows/pm-phase3.js +309 -0
- package/CHANGELOG.md +29 -0
- package/README.md +26 -0
- package/bin/cli.js +64 -5
- package/docs/token-optimization-backlog.md +115 -0
- package/docs/token-optimization.md +274 -0
- package/package.json +1 -1
- package/.claude/agents/assessment-manager.md +0 -672
- package/.claude/agents/project-manager.md +0 -309
|
@@ -1,672 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: assessment-manager
|
|
3
|
-
description: "Assessment Manager — intelligent orchestrator for the codebase assessment pipeline. Discovers available assessment agents, runs them in parallel, consolidates findings into intervention documents, gates on human approval, and reports effort/token estimates. Input: path to target codebase (or '.' for current directory) [--scope=<area1,area2>] [--force]"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Assessment Manager
|
|
7
|
-
|
|
8
|
-
An intelligent orchestrator that **assesses before it plans, and plans before it executes**. Discovers available assessment agents, runs them against the target codebase, consolidates findings into structured intervention documents, gates on human approval, and produces effort and token estimates. Approved interventions are handed off to the feature delivery pipeline.
|
|
9
|
-
|
|
10
|
-
Before starting, read these procedures from `docs/procedures/`:
|
|
11
|
-
- `process-log.md` — log format and token tracking rules
|
|
12
|
-
- `issues-register.md` — Issues Register format and severity rules
|
|
13
|
-
- `assessment-findings-gate.md` — gate presentation, approvals file format, rules
|
|
14
|
-
- `token-estimation.md` — Token-Estimate.md format, estimation model, and assessment pipeline input size estimates
|
|
15
|
-
|
|
16
|
-
Also read `docs/pricing.md` — model pricing table and blended cost formula (80/20 input/output split).
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## Phase 1 — Discovery
|
|
21
|
-
|
|
22
|
-
### 1a. Discover available agents
|
|
23
|
-
|
|
24
|
-
Scan `.claude/agents/` and read each file's `description` frontmatter. Classify each agent as:
|
|
25
|
-
- **Assessment** — produces findings (keywords: "assessment", "audit", "analysis")
|
|
26
|
-
- **Remediation** — implements fixes (keywords: "refactoring", "hardening", "decomposition")
|
|
27
|
-
- **Documentation** — produces structured documents (keywords: "documentation standard", "intervention")
|
|
28
|
-
- **Orchestrator** — skip self-invocation
|
|
29
|
-
|
|
30
|
-
Build an `assessment_agents` registry.
|
|
31
|
-
|
|
32
|
-
### 1b. Determine assessment prefix
|
|
33
|
-
|
|
34
|
-
Scan `docs/assessments/` for folders matching `ASSESS-[0-9]+*`. Increment the highest number found, or start at `ASSESS-001`.
|
|
35
|
-
|
|
36
|
-
Output directory: `docs/assessments/ASSESS-NNN-{codebase-slug}/`
|
|
37
|
-
Prefix: `ASSESS-NNN`
|
|
38
|
-
|
|
39
|
-
### 1c. Assess existing outputs
|
|
40
|
-
|
|
41
|
-
If `--force` is not passed and the assessment directory exists, check staleness of existing output files (same pattern as `project-manager`). Build a state map.
|
|
42
|
-
|
|
43
|
-
### 1d. Parse scope filter
|
|
44
|
-
|
|
45
|
-
If `--scope=<areas>` is passed, restrict to agents covering those areas. Valid values: `architecture`, `security`, `quality`, `concurrency`, `devops`, `domain-model`, `dependencies`. No scope → run all discovered assessment agents.
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## Phase 2 — Planning
|
|
50
|
-
|
|
51
|
-
### Dependency graph
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
Target codebase
|
|
55
|
-
├── generic-software-assessment → {PREFIX}-Generic-Assessment.md
|
|
56
|
-
├── layered-architecture-assessment → {PREFIX}-Layer-Assessment.md
|
|
57
|
-
├── concurrency-safety-assessment → {PREFIX}-Concurrency-Assessment.md
|
|
58
|
-
└── [other discovered assessment agents — all in parallel]
|
|
59
|
-
│
|
|
60
|
-
└── intervention-documentation-standard
|
|
61
|
-
│
|
|
62
|
-
├── {PREFIX}-INT-NNN-*.md (one per finding)
|
|
63
|
-
├── {PREFIX}-Interventions-Index.md
|
|
64
|
-
├── {PREFIX}-Effort-Estimate.md (finalised)
|
|
65
|
-
└── {PREFIX}-Token-Estimate.md (updated)
|
|
66
|
-
│
|
|
67
|
-
══ REMEDIATION GATE ══ → {PREFIX}-Approvals.md
|
|
68
|
-
│
|
|
69
|
-
Pipeline ends → Summary
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Planning rules
|
|
73
|
-
|
|
74
|
-
1. All assessment agents run in **parallel** — read-only, no mutual dependencies
|
|
75
|
-
2. `intervention-documentation-standard` runs **after** all assessments complete
|
|
76
|
-
3. Skip agents with fresh output unless `--force`
|
|
77
|
-
|
|
78
|
-
### Show plan to user before executing
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
📋 Assessment Plan (prefix: ASSESS-001, target: .)
|
|
82
|
-
─────────────────────────────────────────────────────
|
|
83
|
-
🔄 RUN (parallel):
|
|
84
|
-
generic-software-assessment → ASSESS-001-Generic-Assessment.md
|
|
85
|
-
layered-architecture-assessment → ASSESS-001-Layer-Assessment.md
|
|
86
|
-
concurrency-safety-assessment → ASSESS-001-Concurrency-Assessment.md
|
|
87
|
-
|
|
88
|
-
⏳ QUEUE: intervention-documentation-standard → ASSESS-001-INT-*.md + Interventions-Index.md
|
|
89
|
-
⏳ WRITE: ASSESS-001-Effort-Estimate.md + ASSESS-001-Token-Estimate.md
|
|
90
|
-
⏳ GATE: Review findings → acknowledge + flag interventions
|
|
91
|
-
─────────────────────────────────────────────────────
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## Phase 3 — Assessment Execution
|
|
97
|
-
|
|
98
|
-
Dispatch all assessment agents in parallel by invoking multiple Agent tool calls in the same response. Each agent receives: target codebase path, assessment prefix, output directory path. Do NOT use `run_in_background: true` — background completion notifications are not delivered to sub-agent contexts and will cause the pipeline to block indefinitely. Track tokens for every agent call (see `docs/procedures/process-log.md`).
|
|
99
|
-
|
|
100
|
-
After all complete:
|
|
101
|
-
- Verify each expected output file exists and is non-empty
|
|
102
|
-
- If an agent produced no output, log the failure and continue — partial assessments are better than none
|
|
103
|
-
|
|
104
|
-
### Write initial Token Estimate file
|
|
105
|
-
|
|
106
|
-
After verifying outputs and before moving to Phase 4, accumulate token usage from every completed assessment agent and write `{PREFIX}-Token-Estimate.md` to `docs/assessments/{PREFIX}/`. Create the directory if it does not exist.
|
|
107
|
-
|
|
108
|
-
**Step 1 — Check estimation model (mandatory).** Confirm `docs/procedures/token-estimation.md` is present and readable. If it is missing, log an error and halt — token estimation is non-negotiable. Parse the file to extract the canonical parameters:
|
|
109
|
-
|
|
110
|
-
| Parameter | Value |
|
|
111
|
-
|-----------|-------|
|
|
112
|
-
| Avg chars per token | 4 |
|
|
113
|
-
| Haiku system prompt | ~2,000 tokens |
|
|
114
|
-
| Sonnet system prompt | ~3,000 tokens |
|
|
115
|
-
| Base overhead per call | ~5,000 tokens |
|
|
116
|
-
|
|
117
|
-
Store these parameters in memory and reuse them for all estimation calculations in Phases 3–4. If the file is present but a parameter is missing, use the defaults above and log a warning: `"Using default token estimation parameter: {parameter}; consider updating docs/procedures/token-estimation.md"`.
|
|
118
|
-
|
|
119
|
-
**Step 2 — Check pricing data (graceful).** Confirm `docs/pricing.md` is present and readable. If it is missing or malformed, log a warning: `"docs/pricing.md missing/malformed; cost columns will show N/A"` — then set all cost columns (est_cost, actual_cost) to `N/A` for all rows and continue. Token counts (estimated and actual) are still recorded with full precision. Phase subtotals and grand total cost rows show `N/A`. The pipeline does not halt. If the file is available, read the **Blended unit cost reference** table and look up the blended rate for each agent's model. Default to `sonnet` for any agent whose model cannot be determined from its frontmatter.
|
|
120
|
-
|
|
121
|
-
**Step 3 — Estimate tokens per assessment agent.** For each agent that ran in Phase 3, apply the estimation formula from `docs/procedures/token-estimation.md` (Assessment pipeline usage section):
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
est_tokens = base_overhead + system_prompt_weight + (input_size_chars / 4)
|
|
125
|
-
= 5,000 + 3,000 (sonnet) + (input_size_chars / 4)
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
Use the agent-specific input size estimates from `docs/procedures/token-estimation.md`. The blended rate for all assessment agents is `$0.005400/1k tokens` (sonnet). Compute:
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
est_cost = est_tokens × (blended_rate / 1000)
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
Round `est_tokens` to the nearest integer; format `est_cost` to 4 decimal places (e.g., `$0.0444`).
|
|
135
|
-
|
|
136
|
-
**Step 4 — Extract actual tokens per assessment agent.** For each completed assessment agent, read its `<usage>` block from its result:
|
|
137
|
-
|
|
138
|
-
- If the block is present: `actual_tokens = input_tokens + output_tokens`. Compute `actual_cost = actual_tokens × (blended_rate / 1000)` at 4 decimal places.
|
|
139
|
-
- If the block is missing or unparseable: set `actual_tokens = "N/A"` and `actual_cost = "N/A"`. Log a warning: `"[agent_name] produced no <usage> block; token data unavailable"`. Exclude this agent from phase subtotal and grand total calculations.
|
|
140
|
-
|
|
141
|
-
Status remains `"complete"` in both cases — a missing usage block does not indicate agent failure.
|
|
142
|
-
|
|
143
|
-
**Step 5 — Compute Phase 3 subtotals.** Sum `est_tokens` and `est_cost` across all assessment agents (all rows, regardless of N/A status). Sum `actual_tokens` and `actual_cost` only across rows where actual values are numeric (exclude N/A rows). Format subtotal costs to 2 decimal places.
|
|
144
|
-
|
|
145
|
-
**Step 6 — Write `{PREFIX}-Token-Estimate.md`.** Write the complete file at `docs/assessments/{PREFIX}/{PREFIX}-Token-Estimate.md` using the template below. Replace all `{PREFIX}`, `{N}`, and `{placeholder}` markers with computed values.
|
|
146
|
-
|
|
147
|
-
```markdown
|
|
148
|
-
# Token Estimate — {PREFIX} — Assessment Pipeline
|
|
149
|
-
|
|
150
|
-
> Estimates computed before execution. Actuals accumulated as agents complete.
|
|
151
|
-
> Assessment agents (Phase 3) actuals: filled at end of phase.
|
|
152
|
-
> Intervention documentation (Phase 4) actuals: filled on completion.
|
|
153
|
-
> Orchestrator row added by assess-codebase skill at pipeline end.
|
|
154
|
-
> Pricing model: docs/pricing.md (80% input / 20% output split).
|
|
155
|
-
|
|
156
|
-
## Estimation model
|
|
157
|
-
|
|
158
|
-
| Parameter | Value |
|
|
159
|
-
|-----------|-------|
|
|
160
|
-
| Avg chars per token | 4 |
|
|
161
|
-
| Haiku system prompt | ~2,000 tokens |
|
|
162
|
-
| Sonnet system prompt | ~3,000 tokens |
|
|
163
|
-
| Base overhead per call | ~5,000 tokens |
|
|
164
|
-
| Input/output split | 80% / 20% |
|
|
165
|
-
|
|
166
|
-
## Assessment agents (Phase 3)
|
|
167
|
-
|
|
168
|
-
| Agent | Model | Est. tokens | Est. cost ($) | Actual tokens | Actual cost ($) | Status |
|
|
169
|
-
|-------|-------|-------------|---------------|---------------|-----------------|--------|
|
|
170
|
-
{one row per assessment agent that ran — computed values from Steps 3 and 4 — status = "complete"}
|
|
171
|
-
|
|
172
|
-
## Intervention documentation (Phase 4)
|
|
173
|
-
|
|
174
|
-
> To be populated after Phase 4 completion.
|
|
175
|
-
|
|
176
|
-
| Agent | Model | Est. tokens | Est. cost ($) | Actual tokens | Actual cost ($) | Status |
|
|
177
|
-
|-------|-------|-------------|---------------|---------------|-----------------|--------|
|
|
178
|
-
|
|
179
|
-
## Remediation
|
|
180
|
-
|
|
181
|
-
Remediation effort is tracked separately via the feature delivery pipeline (not part of this assessment).
|
|
182
|
-
|
|
183
|
-
## Phase subtotals
|
|
184
|
-
|
|
185
|
-
| Phase | Est. tokens | Est. cost ($) | Actual tokens | Actual cost ($) |
|
|
186
|
-
|-------|-------------|---------------|---------------|-----------------|
|
|
187
|
-
| Assessment (Phase 3) | {est_tokens_total} | ${est_cost_total} | {actual_tokens_total} | ${actual_cost_total} |
|
|
188
|
-
| Intervention documentation (Phase 4) | — | — | — | — |
|
|
189
|
-
|
|
190
|
-
## Grand total
|
|
191
|
-
|
|
192
|
-
> Partial — updated at pipeline end.
|
|
193
|
-
|
|
194
|
-
| Metric | Estimated | Actual |
|
|
195
|
-
|--------|-----------|--------|
|
|
196
|
-
| Total tokens | {est_tokens_total} | partial — updated at pipeline end |
|
|
197
|
-
| Total cost ($) | ${est_cost_total_2dp} | partial — updated at pipeline end |
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
After writing, verify the file is readable: attempt to read it back. If it is unreadable, log an error: `"[timestamp] ERROR: Token Estimate file unreadable after write — {path}: {error}"`. If the write itself fails (e.g., permission denied, disk full), log the error: `"[timestamp] ERROR: Failed to write Token Estimate file — {path}: {error}"` and continue — the pipeline does not halt due to a Token Estimate file I/O failure.
|
|
201
|
-
|
|
202
|
-
**Step 7 — Log the file write.** Append to the process log:
|
|
203
|
-
|
|
204
|
-
```
|
|
205
|
-
[timestamp] Phase 3 end: wrote Token Estimate file
|
|
206
|
-
Assessment agents: {N} rows ({completed} complete, {na_count} with N/A actuals)
|
|
207
|
-
Location: docs/assessments/{PREFIX}/{PREFIX}-Token-Estimate.md
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
Where `{N}` is the total number of assessment agents that ran, `{completed}` is the count with numeric actual tokens, and `{na_count}` is the count with `N/A` actual tokens.
|
|
211
|
-
|
|
212
|
-
### Write initial Effort Estimate file
|
|
213
|
-
|
|
214
|
-
**Step 1 — Read process log timestamps.** For each completed Phase 3 assessment agent, scan `{PREFIX}-process-log.txt` for lines matching:
|
|
215
|
-
- `Agent START: {agent_name}` → extract start timestamp
|
|
216
|
-
- `Agent DONE: {agent_name}` → extract end timestamp
|
|
217
|
-
|
|
218
|
-
If both timestamps are present, compute `actual_duration = end_timestamp − start_timestamp`, rounded to the nearest minute. Express as `"Xmin"` or `"Xh Ymin"` (e.g., `"12min"`, `"1h 5min"`). If either timestamp is missing, set `actual_duration = "N/A"` and log a warning: `"[agent_name] has no timestamp in the process log; actual duration unavailable"`.
|
|
219
|
-
|
|
220
|
-
For the batch wall-clock:
|
|
221
|
-
- `batch_start = minimum of all Phase 3 agent start timestamps`
|
|
222
|
-
- `batch_end = maximum of all Phase 3 agent end timestamps`
|
|
223
|
-
- `batch_actual = batch_end − batch_start`, rounded to nearest minute
|
|
224
|
-
|
|
225
|
-
**Step 2 — Compute estimates.** On the first run (no prior `{PREFIX}-Effort-Estimate.md` exists), set `est_duration = "N/A"` for all agent rows. On subsequent runs, extract the `actual_duration` from the previous run's rows for each agent and use as the new `est_duration`. If the prior file has `"N/A"` for an agent, continue using `"N/A"` as the estimate.
|
|
226
|
-
|
|
227
|
-
**Step 3 — Compute delta.** `delta = actual_duration − est_duration`. If either is `"N/A"`, set `delta = "N/A"`. For numeric values, express as `"-Xmin"` (faster), `"+Xmin"` (slower), or `"0min"` (on target).
|
|
228
|
-
|
|
229
|
-
**Step 4 — Write `{PREFIX}-Effort-Estimate.md`.** Write to `docs/assessments/{PREFIX}/{PREFIX}-Effort-Estimate.md`. Create the directory if it does not exist.
|
|
230
|
-
|
|
231
|
-
```markdown
|
|
232
|
-
# Effort Estimate — {PREFIX} — Assessment Pipeline
|
|
233
|
-
|
|
234
|
-
> Wall-clock effort tracking for the assessment pipeline.
|
|
235
|
-
> Assessment agent durations: filled at end of Phase 3.
|
|
236
|
-
> Intervention documentation duration: filled at end of Phase 4.
|
|
237
|
-
> Remediation effort: estimated from Interventions Index at end of Phase 4 using fixed rates.
|
|
238
|
-
> Actual remediation effort tracked by feature delivery pipeline per intervention.
|
|
239
|
-
> Effort rates: CRITICAL=8h, HIGH=4h, MEDIUM=2h, LOW=1h (human hours, sequential).
|
|
240
|
-
|
|
241
|
-
## Assessment phase
|
|
242
|
-
|
|
243
|
-
| Agent | Est. duration | Actual duration | Delta | Status |
|
|
244
|
-
|-------|--------------|-----------------|-------|--------|
|
|
245
|
-
| {agent_name} | {est_duration} | {actual_duration} | {delta} | {status} |
|
|
246
|
-
... (one row per Phase 3 agent — intervention-documentation-standard appended at Phase 4 end)
|
|
247
|
-
|
|
248
|
-
## Assessment phase subtotal
|
|
249
|
-
|
|
250
|
-
| Metric | Estimated | Actual | Delta |
|
|
251
|
-
|--------|-----------|--------|-------|
|
|
252
|
-
| Phase 3 assessment batch | {est_batch} | {actual_batch} | {delta_batch} |
|
|
253
|
-
| intervention-documentation-standard | {est} | {actual} | {delta} |
|
|
254
|
-
| Total | {total_est} | {total_actual} | {total_delta} |
|
|
255
|
-
|
|
256
|
-
> Note: Phase 3 "Actual" row uses batch wall-clock (max end − min start), not sum of individual durations.
|
|
257
|
-
> Individual agent durations are in the assessment phase table above.
|
|
258
|
-
|
|
259
|
-
## Remediation effort estimate
|
|
260
|
-
|
|
261
|
-
> Pending intervention documentation completion.
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
If a scope filter was applied, append to the header block: `> Note: Scope filter applied ({scope}). This estimate reflects only {scope} assessment areas.`
|
|
265
|
-
|
|
266
|
-
After writing, verify the file is readable. If unreadable, log an error: `"[timestamp] ERROR: Effort Estimate file unreadable after write — {path}: {error}"`. If the write fails, log: `"[timestamp] ERROR: Failed to write Effort Estimate file — {path}: {error}"` and continue — the pipeline does not halt due to a file I/O failure.
|
|
267
|
-
|
|
268
|
-
**Step 5 — Log the write.** Append to the process log:
|
|
269
|
-
|
|
270
|
-
```
|
|
271
|
-
[timestamp] Phase 3 end: wrote Effort Estimate file
|
|
272
|
-
Assessment agents: {N} rows ({completed} with actuals, {na_count} with N/A)
|
|
273
|
-
Location: docs/assessments/{PREFIX}/{PREFIX}-Effort-Estimate.md
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
---
|
|
277
|
-
|
|
278
|
-
## Phase 4 — Intervention Document Generation
|
|
279
|
-
|
|
280
|
-
Invoke `intervention-documentation-standard` with all produced assessment files and the prefix. It consolidates findings, deduplicates, and produces:
|
|
281
|
-
- `{PREFIX}-INT-NNN-{slug}.md` per intervention
|
|
282
|
-
- `{PREFIX}-Interventions-Index.md` (ordered by criticality and dependency)
|
|
283
|
-
|
|
284
|
-
### Append intervention-documentation row to Token Estimate file
|
|
285
|
-
|
|
286
|
-
After `intervention-documentation-standard` completes, update the Token Estimate file as follows.
|
|
287
|
-
|
|
288
|
-
**Step 1 — Extract actual tokens.** Read the `<usage>` block from the agent result: `actual_tokens = input_tokens + output_tokens`. Compute `actual_cost = actual_tokens × (blended_rate / 1000)` at 4 decimal places. If the block is missing or unparseable: set `actual_tokens = "N/A"` and `actual_cost = "N/A"`, and log a warning: `"intervention-documentation-standard produced no <usage> block; token data unavailable"`. Status remains `"complete"` regardless.
|
|
289
|
-
|
|
290
|
-
**Step 2 — Estimate tokens.** Apply the standard formula:
|
|
291
|
-
|
|
292
|
-
```
|
|
293
|
-
est_tokens = base_overhead (5,000) + system_prompt_weight (3,000 for sonnet) + (intervention_doc_size_bytes / 4)
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
If the total size of produced intervention documents is unknown at estimation time, use `~15,500` tokens as a typical estimate. Compute `est_cost = est_tokens × (blended_rate / 1000)` at 4 decimal places. If pricing data is unavailable, set both cost fields to `N/A`.
|
|
297
|
-
|
|
298
|
-
**Step 3 — Replace the placeholder section.** Open `{PREFIX}-Token-Estimate.md`. Find the "Intervention documentation (Phase 4)" section (the `> To be populated after Phase 4 completion.` placeholder row). Replace the empty table body with the actual row:
|
|
299
|
-
|
|
300
|
-
| Agent | Model | Est. tokens | Est. cost ($) | Actual tokens | Actual cost ($) | Status |
|
|
301
|
-
|-------|-------|-------------|---------------|---------------|-----------------|--------|
|
|
302
|
-
| intervention-documentation-standard | sonnet | {est_tokens} | {est_cost} | {actual_tokens} | {actual_cost} | complete |
|
|
303
|
-
|
|
304
|
-
Remove the `> To be populated after Phase 4 completion.` note once the row is written.
|
|
305
|
-
|
|
306
|
-
**Step 4 — Log the completion.** Append to the process log:
|
|
307
|
-
|
|
308
|
-
```
|
|
309
|
-
[timestamp] Phase 4 end: appended intervention-documentation-standard row to Token Estimate file. Actual tokens: {N} | Cost: ${X.XXXX}
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
### Update Effort Estimate file
|
|
313
|
-
|
|
314
|
-
**Step 1 — Read timestamps and compute duration.** Scan `{PREFIX}-process-log.txt` for `Agent START: intervention-documentation-standard` and `Agent DONE: intervention-documentation-standard`. Compute `actual_duration` (same formula as Phase 3 agents). If missing, set `actual_duration = "N/A"` and log a warning.
|
|
315
|
-
|
|
316
|
-
**Step 2 — Append intervention-documentation-standard row.** Open `{PREFIX}-Effort-Estimate.md` and append one row to the "Assessment phase" table:
|
|
317
|
-
|
|
318
|
-
```
|
|
319
|
-
| intervention-documentation-standard | {est_duration} | {actual_duration} | {delta} | complete |
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
`est_duration` follows the same first-run / subsequent-run logic as Phase 3 agents.
|
|
323
|
-
|
|
324
|
-
**Step 3 — Update assessment phase subtotal.** Fill in the `intervention-documentation-standard` row in the subtotal table and compute the Total row values.
|
|
325
|
-
|
|
326
|
-
**Step 4 — Build remediation section.** Read `{PREFIX}-Interventions-Index.md` to extract intervention counts by severity. Apply fixed rates: CRITICAL × 8h, HIGH × 4h, MEDIUM × 2h, LOW × 1h. Sum for the human sequential total. If the Interventions Index is missing, write `"Interventions Index not found — remediation estimate unavailable"` as the remediation section body, log a warning, and continue. If all counts are 0, add: `> Note: No remediation required — zero findings identified.`
|
|
327
|
-
|
|
328
|
-
**Step 5 — Replace placeholder.** Replace the `> Pending intervention documentation completion.` line in the "Remediation effort estimate" section with:
|
|
329
|
-
|
|
330
|
-
```markdown
|
|
331
|
-
## Remediation effort estimate
|
|
332
|
-
|
|
333
|
-
> Derived from {PREFIX}-Interventions-Index.md. Rates: CRITICAL=8h, HIGH=4h, MEDIUM=2h, LOW=1h (human hours, sequential).
|
|
334
|
-
> Actual remediation effort tracked by feature delivery pipeline per intervention.
|
|
335
|
-
|
|
336
|
-
| Severity | Count | Rate | Subtotal |
|
|
337
|
-
|----------|-------|------|---------|
|
|
338
|
-
| CRITICAL | {count} | 8h | {subtotal} |
|
|
339
|
-
| HIGH | {count} | 4h | {subtotal} |
|
|
340
|
-
| MEDIUM | {count} | 2h | {subtotal} |
|
|
341
|
-
| LOW | {count} | 1h | {subtotal} |
|
|
342
|
-
| **Total** | **{total_count}** | — | **{total_hours}h** |
|
|
343
|
-
|
|
344
|
-
Human sequential total: {total_hours}h
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
**Step 6 — Validate severity count.** Assert `sum(CRITICAL + HIGH + MEDIUM + LOW)` equals total intervention count in `{PREFIX}-Interventions-Index.md`. If they differ, log: `"Severity count mismatch between Effort Estimate and Interventions Index — check {PREFIX}-Interventions-Index.md"`. Use the Interventions Index counts as the authoritative source.
|
|
348
|
-
|
|
349
|
-
**Step 7 — Log the update.** Append to the process log:
|
|
350
|
-
|
|
351
|
-
```
|
|
352
|
-
[timestamp] Phase 4 end: updated Effort Estimate with intervention-documentation-standard row
|
|
353
|
-
Actual duration: {X}min
|
|
354
|
-
[timestamp] Phase 4 end: populated remediation effort section
|
|
355
|
-
CRITICAL: {N}, HIGH: {N}, MEDIUM: {N}, LOW: {N}
|
|
356
|
-
Human sequential total: {X}h
|
|
357
|
-
Location: docs/assessments/{PREFIX}/{PREFIX}-Effort-Estimate.md
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
---
|
|
361
|
-
|
|
362
|
-
## Phase 5 — Findings Gate
|
|
363
|
-
|
|
364
|
-
Follow `docs/procedures/assessment-findings-gate.md`. The gate has two mandatory steps:
|
|
365
|
-
|
|
366
|
-
**Step 5a — Acknowledge:** present findings summary (including effort estimate) and wait for acknowledgement. Accept any non-empty text reply.
|
|
367
|
-
|
|
368
|
-
**Step 5b — Flag interventions:** prompt for INT-NNN identifiers to flag for feature delivery. Validate each against `{PREFIX}-Interventions-Index.md`; re-prompt if any are unknown. Accept "None" for zero flagged.
|
|
369
|
-
|
|
370
|
-
After both steps complete, write `{PREFIX}-Approvals.md` per the format in `docs/procedures/assessment-findings-gate.md`. Verify the file was written before proceeding to Phase 6.
|
|
371
|
-
|
|
372
|
-
No writes to the Effort Estimate file during Phase 5.
|
|
373
|
-
|
|
374
|
-
---
|
|
375
|
-
|
|
376
|
-
## Phase 6 — Summary
|
|
377
|
-
|
|
378
|
-
### Data Contract: Interventions Index
|
|
379
|
-
|
|
380
|
-
The registry write logic depends on `{PREFIX}-Interventions-Index.md` produced by `intervention-documentation-standard` in Phase 4. The following contract defines the expected format that must be honoured before severity counts can be extracted.
|
|
381
|
-
|
|
382
|
-
**Expected table structure:**
|
|
383
|
-
|
|
384
|
-
```markdown
|
|
385
|
-
| ID | Title | Area | Criticality | Depends on | Suggested Agent |
|
|
386
|
-
|---|---|---|---|---|---|
|
|
387
|
-
| INT-001 | ... | Security | CRITICAL | — | developer-backend |
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
**Criticality column contract:**
|
|
391
|
-
|
|
392
|
-
| Attribute | Value |
|
|
393
|
-
|-----------|-------|
|
|
394
|
-
| Column name | `Criticality` (exact, case-sensitive) |
|
|
395
|
-
| Valid values | `CRITICAL`, `HIGH`, `MEDIUM`, `LOW` (exact, case-sensitive) |
|
|
396
|
-
| Type | String — one value per row |
|
|
397
|
-
| Source | Produced by `intervention-documentation-standard` Phase 4 |
|
|
398
|
-
|
|
399
|
-
**Counting algorithm:**
|
|
400
|
-
|
|
401
|
-
1. Locate the main interventions table in the file
|
|
402
|
-
2. For each data row, extract the value in the `Criticality` column
|
|
403
|
-
3. Count rows where `Criticality = "CRITICAL"` → `critical_count`
|
|
404
|
-
4. Count rows where `Criticality = "HIGH"` → `high_count`
|
|
405
|
-
5. Count rows where `Criticality = "MEDIUM"` → `medium_count`
|
|
406
|
-
6. Count rows where `Criticality = "LOW"` → `low_count`
|
|
407
|
-
7. Compute `total_count = critical_count + high_count + medium_count + low_count`
|
|
408
|
-
|
|
409
|
-
**Error handling:**
|
|
410
|
-
|
|
411
|
-
| Condition | Action |
|
|
412
|
-
|-----------|--------|
|
|
413
|
-
| File not found | Log warning: `"[timestamp] WARNING: {PREFIX}-Interventions-Index.md not found; severity counts set to 0"` — return all counts as 0; continue |
|
|
414
|
-
| `Criticality` column absent from table header | Log warning: `"[timestamp] WARNING: {PREFIX}-Interventions-Index.md missing Criticality column; severity counts set to 0"` — return all counts as 0; continue |
|
|
415
|
-
| Row contains unrecognised Criticality value | Skip that row; log warning with row ID and value — count valid rows only; continue |
|
|
416
|
-
| File present but table is empty | Return all counts as 0 — not an error; valid for zero-finding assessments |
|
|
417
|
-
|
|
418
|
-
Severity count contract violations are **non-fatal** to the pipeline. The registry row is written with the counts available (defaulting to 0). The Phase 6 summary includes any warnings from this step.
|
|
419
|
-
|
|
420
|
-
---
|
|
421
|
-
|
|
422
|
-
### Data Contract: Approvals File
|
|
423
|
-
|
|
424
|
-
The registry write logic depends on `{PREFIX}-Approvals.md` produced by the Findings Gate in Phase 5. The following contract defines the expected format that must be honoured before the flagged count can be extracted.
|
|
425
|
-
|
|
426
|
-
**Expected section and table structure:**
|
|
427
|
-
|
|
428
|
-
```markdown
|
|
429
|
-
## Interventions Flagged for Feature Delivery
|
|
430
|
-
|
|
431
|
-
| Intervention | Flagged | Date | Notes |
|
|
432
|
-
|---|---|---|---|
|
|
433
|
-
| INT-001 — ... | Yes | {date} | — |
|
|
434
|
-
| INT-002 — ... | No | {date} | Not selected |
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
**Flagged column contract:**
|
|
438
|
-
|
|
439
|
-
| Attribute | Value |
|
|
440
|
-
|-----------|-------|
|
|
441
|
-
| Section heading | `## Interventions Flagged for Feature Delivery` (exact, case-sensitive) |
|
|
442
|
-
| Column name | `Flagged` (exact, case-sensitive) |
|
|
443
|
-
| Valid values | `Yes` or `No` (exact, case-sensitive — `yes`, `YES`, `no`, `NO` are not valid) |
|
|
444
|
-
| Type | String — one value per row |
|
|
445
|
-
| Source | Produced by assessment-manager Phase 5 (Findings Gate) |
|
|
446
|
-
|
|
447
|
-
**Counting algorithm:**
|
|
448
|
-
|
|
449
|
-
1. Locate the `## Interventions Flagged for Feature Delivery` section in the file
|
|
450
|
-
2. Parse the Markdown table within that section
|
|
451
|
-
3. Count rows where the `Flagged` column value is exactly `"Yes"` (case-sensitive) → `flagged_count`
|
|
452
|
-
4. If the table is present but empty, set `flagged_count = 0` — valid for zero-flagged runs
|
|
453
|
-
|
|
454
|
-
**Error handling:**
|
|
455
|
-
|
|
456
|
-
| Condition | Action |
|
|
457
|
-
|-----------|--------|
|
|
458
|
-
| File not found | Log error: `"[timestamp] ERROR: {PREFIX}-Approvals.md not found; cannot extract flagged count"` — **halt registry write**; report in Phase 6 summary |
|
|
459
|
-
| `Interventions Flagged for Feature Delivery` section missing | Log error: `"[timestamp] ERROR: {PREFIX}-Approvals.md missing required section 'Interventions Flagged for Feature Delivery'; cannot extract flagged count"` — **halt registry write**; report in Phase 6 summary |
|
|
460
|
-
| `Flagged` column absent from table header | Log error: `"[timestamp] ERROR: {PREFIX}-Approvals.md missing Flagged column; cannot extract flagged count"` — **halt registry write**; report in Phase 6 summary |
|
|
461
|
-
| File present but section or table is malformed (unparseable) | Log error: `"[timestamp] ERROR: {PREFIX}-Approvals.md malformed; cannot extract flagged count"` — **halt registry write**; report in Phase 6 summary |
|
|
462
|
-
|
|
463
|
-
Approvals file contract violations are **fatal to the registry write**. Do not create or modify the registry file. The Phase 6 summary reports: `Registry: docs/assessments/registry.md [ERROR — Approvals file contract violation; see process log]`. The pipeline itself does not halt.
|
|
464
|
-
|
|
465
|
-
---
|
|
466
|
-
|
|
467
|
-
### Registry Write Algorithm
|
|
468
|
-
|
|
469
|
-
Execute the following steps in sequence at the start of Phase 6, before building the summary report. Log the start of registry write operations to the process log:
|
|
470
|
-
|
|
471
|
-
```
|
|
472
|
-
[timestamp] Phase 6 start: registry write
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
**Step 1 — Prerequisite check.** Before any registry write, verify that `{PREFIX}-Approvals.md` exists on disk. If the file is absent, log an error to the process log:
|
|
476
|
-
|
|
477
|
-
```
|
|
478
|
-
[timestamp] ERROR: Cannot write registry — {PREFIX}-Approvals.md not found. Ensure the Findings Gate completed successfully.
|
|
479
|
-
```
|
|
480
|
-
|
|
481
|
-
Record the outcome for the Phase 6 summary: `Registry: docs/assessments/registry.md [ERROR — Approvals file not found]`. Skip all remaining registry write steps. Do not create or modify the registry file. The pipeline does not halt.
|
|
482
|
-
|
|
483
|
-
If the file exists but does not contain the `## Interventions Flagged for Feature Delivery` section, log an error to the process log:
|
|
484
|
-
|
|
485
|
-
```
|
|
486
|
-
[timestamp] Phase 6: registry write skipped — {PREFIX}-Approvals.md missing required section 'Interventions Flagged for Feature Delivery'
|
|
487
|
-
```
|
|
488
|
-
|
|
489
|
-
Record the outcome for the Phase 6 summary: `Registry: docs/assessments/registry.md [ERROR — Approvals file missing required section]`. Skip all remaining registry write steps. Do not create or modify the registry file. The pipeline does not halt.
|
|
490
|
-
|
|
491
|
-
**Step 2 — Extract severity counts from Interventions Index (US-01-T01).** Using the data contract defined in the "Data Contract: Interventions Index" subsection above, parse `docs/assessments/{PREFIX}/{PREFIX}-Interventions-Index.md` and apply the counting algorithm:
|
|
492
|
-
|
|
493
|
-
1. Locate the main interventions table
|
|
494
|
-
2. Count rows where `Criticality = "CRITICAL"` → `critical_count`
|
|
495
|
-
3. Count rows where `Criticality = "HIGH"` → `high_count`
|
|
496
|
-
4. Count rows where `Criticality = "MEDIUM"` → `medium_count`
|
|
497
|
-
5. Count rows where `Criticality = "LOW"` → `low_count`
|
|
498
|
-
6. Compute `total_count = critical_count + high_count + medium_count + low_count`
|
|
499
|
-
|
|
500
|
-
Apply the error handling rules defined in the data contract for all failure conditions (missing file, absent Criticality column, unrecognised values). Severity count failures are non-fatal; all counts default to 0.
|
|
501
|
-
|
|
502
|
-
Log to process log on success:
|
|
503
|
-
|
|
504
|
-
```
|
|
505
|
-
[timestamp] Phase 6: extracted severity counts from {PREFIX}-Interventions-Index.md
|
|
506
|
-
CRITICAL: N, HIGH: N, MEDIUM: N, LOW: N, Total: N
|
|
507
|
-
```
|
|
508
|
-
|
|
509
|
-
**Step 3 — Extract flagged count from Approvals file (US-01-T02).** Using the data contract defined in the "Data Contract: Approvals File" subsection above, parse `docs/assessments/{PREFIX}/{PREFIX}-Approvals.md` and apply the counting algorithm:
|
|
510
|
-
|
|
511
|
-
1. Locate the `## Interventions Flagged for Feature Delivery` section
|
|
512
|
-
2. Parse the Markdown table in that section
|
|
513
|
-
3. Count rows where `Flagged = "Yes"` (case-sensitive) → `flagged_count`
|
|
514
|
-
4. If the table is present but empty, set `flagged_count = 0` — this is not an error
|
|
515
|
-
|
|
516
|
-
Apply the error handling rules defined in the data contract. Approvals file contract violations are fatal to the registry write; if any fatal error condition is met, log the error, skip the remaining registry write steps, and report the error in the Phase 6 summary.
|
|
517
|
-
|
|
518
|
-
Log to process log on success:
|
|
519
|
-
|
|
520
|
-
```
|
|
521
|
-
[timestamp] Phase 6: extracted flagged count from {PREFIX}-Approvals.md
|
|
522
|
-
Flagged for feature delivery: N
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
**Step 4 — Build registry row (US-01-T03).** Capture the current system date in YYYY-MM-DD format. Construct the Markdown table row:
|
|
526
|
-
|
|
527
|
-
```
|
|
528
|
-
| {YYYY-MM-DD} | [{PREFIX}]({PREFIX}/) | {total_count} | {critical_count} | {high_count} | {medium_count} | {low_count} | {flagged_count} |
|
|
529
|
-
```
|
|
530
|
-
|
|
531
|
-
The row must have exactly eight pipe-delimited columns. Numeric values for Total, CRITICAL, HIGH, MEDIUM, LOW, and Flagged must be non-negative integers with no decimal places. The Prefix column must use the relative Markdown link format `[{PREFIX}]({PREFIX}/)`.
|
|
532
|
-
|
|
533
|
-
**Step 5 — Detect whether registry exists (US-02-T01).** Check for the presence of `docs/assessments/registry.md` in the assessed project directory. If the file system check raises an error (e.g., permission denied), log:
|
|
534
|
-
|
|
535
|
-
```
|
|
536
|
-
[timestamp] ERROR: Phase 6 — registry existence check failed: {error message}
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
Record the outcome for the Phase 6 summary as an error and skip the remaining write steps. The pipeline does not halt.
|
|
540
|
-
|
|
541
|
-
**Step 6 — Create registry on first run (US-01-T04).** If `docs/assessments/registry.md` does not exist, create it with the following content (replacing `{row}` with the constructed row from Step 4):
|
|
542
|
-
|
|
543
|
-
```markdown
|
|
544
|
-
# Assessment Registry
|
|
545
|
-
|
|
546
|
-
| Date | Prefix | Total | CRITICAL | HIGH | MEDIUM | LOW | Flagged |
|
|
547
|
-
|------|--------|-------|----------|------|--------|-----|---------|
|
|
548
|
-
{row}
|
|
549
|
-
```
|
|
550
|
-
|
|
551
|
-
If the write operation itself raises an I/O error (e.g., permission denied, disk full), log:
|
|
552
|
-
|
|
553
|
-
```
|
|
554
|
-
[timestamp] ERROR: Registry write failed — I/O error during file creation: docs/assessments/registry.md — {error message}
|
|
555
|
-
```
|
|
556
|
-
|
|
557
|
-
Record for the Phase 6 summary: `Registry: docs/assessments/registry.md [ERROR — I/O error during creation]`. Skip remaining steps. The pipeline does not halt.
|
|
558
|
-
|
|
559
|
-
After a successful write, verify the file exists and is non-empty by reading it back. If verification fails, log:
|
|
560
|
-
|
|
561
|
-
```
|
|
562
|
-
[timestamp] ERROR: Registry write failed — file not readable after creation: docs/assessments/registry.md
|
|
563
|
-
```
|
|
564
|
-
|
|
565
|
-
Record for the Phase 6 summary: `Registry: docs/assessments/registry.md [ERROR — write verification failed]`. The pipeline does not halt.
|
|
566
|
-
|
|
567
|
-
On success, log to process log (US-01-T05):
|
|
568
|
-
|
|
569
|
-
```
|
|
570
|
-
[timestamp] Phase 6: created registry.md with first row
|
|
571
|
-
Location: docs/assessments/registry.md
|
|
572
|
-
Row: | {date} | [{PREFIX}]({PREFIX}/) | {total} | {critical} | {high} | {medium} | {low} | {flagged} |
|
|
573
|
-
```
|
|
574
|
-
|
|
575
|
-
Record for the Phase 6 summary: `Registry: docs/assessments/registry.md [created]`.
|
|
576
|
-
|
|
577
|
-
**Step 7 — Append row on subsequent runs (US-02-T02, US-02-T03).** If `docs/assessments/registry.md` already exists:
|
|
578
|
-
|
|
579
|
-
1. Read the full file content (UTF-8). If the read fails (e.g., permission denied), log:
|
|
580
|
-
|
|
581
|
-
```
|
|
582
|
-
[timestamp] ERROR: Registry append failed — cannot read existing file: docs/assessments/registry.md — {error message}
|
|
583
|
-
```
|
|
584
|
-
|
|
585
|
-
Record for the Phase 6 summary: `Registry: docs/assessments/registry.md [ERROR — read failure; existing file unchanged]`. Skip to Step 8. The pipeline does not halt.
|
|
586
|
-
|
|
587
|
-
2. Strip all trailing whitespace from the content
|
|
588
|
-
3. Append a newline, the new row from Step 4, and a final trailing newline
|
|
589
|
-
4. Write the assembled content back to the file as a full overwrite
|
|
590
|
-
|
|
591
|
-
The write is atomic — either the complete updated content is written or the original file is left unchanged. Do not validate, repair, or modify any existing rows during this operation.
|
|
592
|
-
|
|
593
|
-
If the write operation itself raises an I/O error (e.g., permission denied, disk full), log:
|
|
594
|
-
|
|
595
|
-
```
|
|
596
|
-
[timestamp] ERROR: Registry append failed — I/O error during write: docs/assessments/registry.md — {error message}
|
|
597
|
-
```
|
|
598
|
-
|
|
599
|
-
Record for the Phase 6 summary: `Registry: docs/assessments/registry.md [ERROR — I/O error during append]`. Skip remaining steps. The pipeline does not halt.
|
|
600
|
-
|
|
601
|
-
After a successful write, verify the file exists and is non-empty by reading it back. If verification fails, log:
|
|
602
|
-
|
|
603
|
-
```
|
|
604
|
-
[timestamp] ERROR: Registry append failed — write verification failed: docs/assessments/registry.md
|
|
605
|
-
```
|
|
606
|
-
|
|
607
|
-
On success, count the data rows in the file after writing (all rows excluding the title line, the table header row, and the separator row) to determine the new row position N. Log to process log (US-02-T04):
|
|
608
|
-
|
|
609
|
-
```
|
|
610
|
-
[timestamp] Phase 6: appended row to registry.md
|
|
611
|
-
Location: docs/assessments/registry.md
|
|
612
|
-
Row: | {date} | [{PREFIX}]({PREFIX}/) | {total} | {critical} | {high} | {medium} | {low} | {flagged} |
|
|
613
|
-
```
|
|
614
|
-
|
|
615
|
-
Record for the Phase 6 summary: `Registry: docs/assessments/registry.md [updated — row N appended]`.
|
|
616
|
-
|
|
617
|
-
**Step 8 — Phase 6 summary update (US-01-T06, US-02-T05).** After the registry write completes (regardless of outcome), include a registry confirmation line in the Phase 6 Report block between the `Approvals:` and `Effort Estimate:` entries. Select the line based on outcome:
|
|
618
|
-
|
|
619
|
-
| Outcome | Summary line |
|
|
620
|
-
|---------|-------------|
|
|
621
|
-
| Registry created (first run) | `Registry: docs/assessments/registry.md [created]` |
|
|
622
|
-
| Registry updated (append) | `Registry: docs/assessments/registry.md [updated — row N appended]` |
|
|
623
|
-
| Write skipped or error | `Registry: docs/assessments/registry.md [ERROR — {reason}]` |
|
|
624
|
-
|
|
625
|
-
Log to process log:
|
|
626
|
-
|
|
627
|
-
```
|
|
628
|
-
[timestamp] Phase 6 end: registry write complete
|
|
629
|
-
```
|
|
630
|
-
|
|
631
|
-
---
|
|
632
|
-
|
|
633
|
-
Report:
|
|
634
|
-
|
|
635
|
-
```
|
|
636
|
-
Assessment Manager — Run Summary
|
|
637
|
-
─────────────────────────────────────────────────────
|
|
638
|
-
Target: {codebase path} | Prefix: {PREFIX}
|
|
639
|
-
─────────────────────────────────────────────────────
|
|
640
|
-
Assessment:
|
|
641
|
-
✅ {agent_1} → {PREFIX}-{output}.md
|
|
642
|
-
✅ {agent_2} → {PREFIX}-{output}.md
|
|
643
|
-
...
|
|
644
|
-
─────────────────────────────────────────────────────
|
|
645
|
-
Findings: N CRITICAL | N HIGH | N MEDIUM | N LOW
|
|
646
|
-
Interventions: N proposed | N flagged for feature delivery
|
|
647
|
-
─────────────────────────────────────────────────────
|
|
648
|
-
Approvals: {PREFIX}-Approvals.md
|
|
649
|
-
Registry: docs/assessments/registry.md [created | updated — row N appended | ERROR — {reason}]
|
|
650
|
-
Effort Estimate: {PREFIX}-Effort-Estimate.md
|
|
651
|
-
Token Estimate: {PREFIX}-Token-Estimate.md
|
|
652
|
-
Process log: docs/assessments/{PREFIX}/{PREFIX}-process-log.txt
|
|
653
|
-
─────────────────────────────────────────────────────
|
|
654
|
-
Flagged interventions can be actioned via /define-feature
|
|
655
|
-
referencing the INT-NNN document.
|
|
656
|
-
─────────────────────────────────────────────────────
|
|
657
|
-
```
|
|
658
|
-
|
|
659
|
-
---
|
|
660
|
-
|
|
661
|
-
## Guidelines
|
|
662
|
-
|
|
663
|
-
- **Read all procedures at startup** — `process-log.md`, `issues-register.md`, `assessment-findings-gate.md`, `token-estimation.md`
|
|
664
|
-
- **Token tracking — maintain an internal ledger keyed by agent name.** For each completed agent call: extract the `<usage>` block (input_tokens, output_tokens, model), compute `actual_tokens = input_tokens + output_tokens`, and record the result. If the block is absent or unparseable, record `actual_tokens = "N/A"` and log a warning — never halt because of a missing usage block. Estimate tokens for each agent BEFORE dispatch using `est_tokens = base_overhead (5,000) + system_prompt_weight (3,000 for sonnet, 2,000 for haiku) + (input_size_chars / 4)` and compute blended cost using the formula from `docs/pricing.md`. Exclude N/A rows from all cost totals and accuracy statistics; include them in the file as visible rows.
|
|
665
|
-
- **Assessment agents are read-only** — never modify source files during assessment phases
|
|
666
|
-
- **Never skip the Findings Gate** — it is mandatory regardless of finding count; `--force` re-presents it, never bypasses it
|
|
667
|
-
- **Assessment pipeline is read-only** — no branch creation, no code changes, no commits, no PRs
|
|
668
|
-
- **Assessment agents run in parallel** — they have no mutual dependencies
|
|
669
|
-
- **Plan before executing** — always show the plan first
|
|
670
|
-
- **Fail fast on missing target** — if the target path does not exist, stop immediately
|
|
671
|
-
- **Partial assessments are acceptable** — if one agent fails, continue with others
|
|
672
|
-
- **All output documents in English**
|