@dtlabs/ai-toolkit 0.1.5 โ†’ 0.1.7

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.
@@ -0,0 +1,120 @@
1
+ # Procedure: Assessment Findings Gate
2
+
3
+ After intervention documents are generated, present findings to the user and obtain explicit acknowledgement before closing the pipeline. The pipeline is read-only โ€” no remediation code is written.
4
+
5
+ ## Gate presentation
6
+
7
+ ```
8
+ ๐Ÿ“Š Assessment Complete โ€” {PREFIX}
9
+ โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
10
+ Assessment results:
11
+ Generic quality: [KPI summary scores]
12
+ Layer violations: N CRITICAL, N HIGH, N MEDIUM
13
+ Concurrency hazards: N CRITICAL, N HIGH
14
+ [other assessments]
15
+
16
+ Interventions proposed: N total
17
+ CRITICAL: N (immediate attention)
18
+ HIGH: N (next sprint)
19
+ MEDIUM: N (planned cycle)
20
+ LOW: N (backlog)
21
+
22
+ Interventions Index: docs/assessments/{PREFIX}/{PREFIX}-Interventions-Index.md
23
+
24
+ Remediation Effort Estimate (from {PREFIX}-Effort-Estimate.md)
25
+ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
26
+ CRITICAL: N ร— 8h = Xh
27
+ HIGH: N ร— 4h = Xh
28
+ MEDIUM: N ร— 2h = Xh
29
+ LOW: N ร— 1h = Xh
30
+ Total estimated (human sequential): Xh
31
+ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
32
+ ```
33
+
34
+ ## Step 5a โ€” Mandatory acknowledgement
35
+
36
+ Output the following hard-stop message and **wait for a text reply from the user**. Do NOT use `AskUserQuestion` โ€” it cannot be answered through the agent relay chain.
37
+
38
+ ```
39
+ โ›” FINDINGS GATE โ€” STEP 1 OF 2 โ€” HARD STOP
40
+
41
+ Please review the Interventions Index above.
42
+
43
+ Reply with "Acknowledged" (or any text) to confirm you have reviewed the findings.
44
+
45
+ The pipeline CANNOT continue until you reply directly.
46
+ ```
47
+
48
+ Accept any non-empty text reply as acknowledgement. Record the timestamp.
49
+
50
+ ## Step 5b โ€” Optional intervention flagging
51
+
52
+ Immediately after acknowledgement, output:
53
+
54
+ ```
55
+ FINDINGS GATE โ€” STEP 2 OF 2
56
+
57
+ Which interventions (if any) do you want to flag for feature delivery?
58
+
59
+ Reply with one of:
60
+ "None" โ€” no interventions flagged
61
+ "INT-001, INT-003, ..." โ€” comma-separated list of INT-NNN identifiers
62
+
63
+ Flagged interventions will be recorded in {PREFIX}-Approvals.md.
64
+ Any intervention can be actioned later via /define-feature referencing its INT-NNN document.
65
+ ```
66
+
67
+ **Validation:** For each INT-NNN the user provides, verify it exists in `{PREFIX}-Interventions-Index.md`. If any identifier is unknown, report it and re-prompt Step 5b without proceeding:
68
+
69
+ ```
70
+ Unknown identifier(s): INT-099
71
+ Please re-enter โ€” only identifiers from {PREFIX}-Interventions-Index.md are valid.
72
+ ```
73
+
74
+ Re-prompt until all listed identifiers are valid, or the user replies "None".
75
+
76
+ ## Approvals file format
77
+
78
+ Write `{PREFIX}-Approvals.md` in the assessment directory **only after both steps complete successfully**. Never write a partial file.
79
+
80
+ ```markdown
81
+ # Findings Acknowledgement โ€” {PREFIX}
82
+
83
+ ## Assessment Reviewed
84
+
85
+ | Document | Status | Date | Notes |
86
+ |----------|--------|------|-------|
87
+ | {PREFIX}-Generic-Assessment.md | Acknowledged | {date} | โ€” |
88
+ | {PREFIX}-Interventions-Index.md | Acknowledged | {date} | โ€” |
89
+
90
+ ## Interventions Flagged for Feature Delivery
91
+
92
+ | Intervention | Flagged | Date | Notes |
93
+ |---|---|---|---|
94
+ | INT-001 โ€” {slug} | Yes | {date} | โ€” |
95
+ | INT-002 โ€” {slug} | No | {date} | Not selected |
96
+ ```
97
+
98
+ Rules:
99
+ - Every intervention from `{PREFIX}-Interventions-Index.md` must appear โ€” one row per intervention
100
+ - "Flagged: Yes" for each INT-NNN the user explicitly named in Step 5b
101
+ - "Flagged: No" for all others, with Notes = "Not selected"
102
+ - If zero interventions were flagged, add a note below the table: `> No interventions selected for feature delivery.`
103
+ - If zero interventions exist (empty index), write the table header only and add: `> No interventions proposed โ€” zero findings identified.`
104
+
105
+ ## Process log entries
106
+
107
+ ```
108
+ [timestamp] Phase 5 gate: presented findings (N interventions)
109
+ [timestamp] Phase 5 gate: Step 5a โ€” user acknowledged findings
110
+ [timestamp] Phase 5 gate: Step 5b โ€” user flagged: INT-001, INT-003 (or "none")
111
+ [timestamp] Phase 5 gate: wrote {PREFIX}-Approvals.md
112
+ ```
113
+
114
+ ## Rules
115
+
116
+ - **Never skip this gate** โ€” it is mandatory regardless of finding count
117
+ - **Never write a partial Approvals file** โ€” both steps must complete before writing
118
+ - **`--force` does not bypass the gate** โ€” it re-presents the gate and overwrites the existing Approvals file
119
+ - **Log every gate event** in the process log (gate opened, step 5a complete, step 5b result, file written)
120
+ - **No remediation** โ€” this gate never triggers branch creation, agent dispatch, commits, or PRs
@@ -10,6 +10,7 @@ Write `{PREFIX}-Token-Estimate.md` in the feature directory after Work Breakdown
10
10
  | Agent system prompt weight โ€” haiku | ~2,000 tokens |
11
11
  | Agent system prompt weight โ€” sonnet | ~3,000 tokens |
12
12
  | Base overhead per agent call | ~5,000 tokens |
13
+ | Input/output split | 80% / 20% |
13
14
 
14
15
  ## Cost estimation
15
16
 
@@ -98,10 +99,10 @@ The 80/20 input/output split is defined in `docs/pricing.md` โ€” update there if
98
99
 
99
100
  ## Estimation accuracy by agent type
100
101
 
101
- | Agent type | Invocations | Avg est. tokens | Avg actual tokens | Avg delta | Trend |
102
- |-----------|------------|----------------|------------------|-----------|-------|
103
- | haiku agents | N | N | N | ยฑN | over/under/on-target |
104
- | sonnet agents | N | N | N | ยฑN | over/under/on-target |
102
+ | Model | Count | Avg est. tokens | Avg actual tokens | Avg delta | Trend |
103
+ |-------|-------|----------------|------------------|-----------|-------|
104
+ | haiku | N | N | N | ยฑN | โ†‘/โ†“/โ†’ |
105
+ | sonnet | N | N | N | ยฑN | โ†‘/โ†“/โ†’ |
105
106
 
106
107
  ## Grand Total
107
108
 
@@ -117,7 +118,38 @@ The 80/20 input/output split is defined in `docs/pricing.md` โ€” update there if
117
118
  - One row per invocation โ€” rework invocations get a "(rework)" suffix
118
119
  - Delta (tokens): negative = fewer tokens than estimated, positive = more
119
120
  - Cost: computed with blended formula from `docs/pricing.md`; use 4 decimal places for per-agent rows, 2 decimal places for totals
120
- - Trend: over-target if avg delta > +20%, under-target if < -20%, otherwise on-target
121
+ - Trend: "โ†‘" if avg delta > +5% of avg est, "โ†“" if avg delta < -5% of avg est, otherwise "โ†’"
121
122
  - Duration: convert `duration_ms` to minutes/seconds
122
123
  - Model: read from agent frontmatter, default to `sonnet` if not set
123
124
  - Missing `<usage>` block โ†’ write `N/A`, exclude from accuracy stats and cost totals
125
+
126
+ ## Assessment pipeline usage
127
+
128
+ The `assessment-manager` agent reads this procedure at Phase 3 start before dispatching assessment agents, in the same way that `project-manager` reads it before dispatching implementation agents. If this file is missing, the assessment pipeline halts with an error โ€” this is the only non-graceful failure mode in the pipeline.
129
+
130
+ ### Assessment agent input size estimates
131
+
132
+ All assessment agents and the `intervention-documentation-standard` agent run on **sonnet** โ€” use the `$0.005400/1k tokens` blended rate from `docs/pricing.md`.
133
+
134
+ Apply the standard formula with the code input sizes below:
135
+
136
+ ```
137
+ est_tokens = base_overhead + system_prompt_weight + (input_size_chars / 4)
138
+ = 5,000 + 3,000 (sonnet) + (input_size_chars / 4)
139
+ ```
140
+
141
+ | Agent | Approx. input size | Input tokens (chars รท 4) | Est. total tokens |
142
+ |-------|--------------------|--------------------------|-------------------|
143
+ | generic-software-assessment | ~80,000 chars of code | ~20,000 | ~28,000 |
144
+ | layered-architecture-assessment | ~50,000 chars of code | ~12,500 | ~20,500 |
145
+ | concurrency-safety-assessment | ~40,000 chars of code | ~10,000 | ~18,000 |
146
+ | other assessment agents | ~30,000 chars of code | ~7,500 | ~15,500 |
147
+ | intervention-documentation-standard | ~30,000 chars of assessment findings | ~7,500 | ~15,500 |
148
+
149
+ ### Remediation agents
150
+
151
+ Remediation agents receive an intervention document (~20,000 chars, ~5,000 tokens for the doc portion) plus relevant code sections. Use the intervention doc portion as the base input estimate and add code section tokens using the standard formula. Typical total range: 13,000โ€“25,000 tokens depending on intervention scope.
152
+
153
+ ### Orchestrator (assessment-manager)
154
+
155
+ Estimate as the sum of all child agent result sizes (as input) plus process log writes (as output), following the same orchestrator rule as `project-manager`. Use **80,000 tokens** as a conservative baseline for a full pipeline run (assessment + intervention documentation + remediation phases combined).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dtlabs/ai-toolkit",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "AI Toolkit โ€” reusable agents and procedures for developers to build AI-powered applications.",
5
5
  "files": [
6
6
  "docs/",
@@ -1,60 +0,0 @@
1
- # Procedure: Assessment Remediation Gate
2
-
3
- After intervention documents are generated, present findings to the user and obtain explicit approval before any remediation code is written.
4
-
5
- ## Gate presentation
6
-
7
- ```
8
- ๐Ÿ“Š Assessment Complete โ€” ASSESS-001
9
- โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
10
- Assessment results:
11
- Generic quality: [KPI summary scores]
12
- Layer violations: N CRITICAL, N HIGH, N MEDIUM
13
- Concurrency hazards: N CRITICAL, N HIGH
14
- [other assessments]
15
-
16
- Interventions proposed: N total
17
- CRITICAL: N (immediate attention)
18
- HIGH: N (next sprint)
19
- MEDIUM: N (planned cycle)
20
- LOW: N (backlog)
21
-
22
- Interventions Index: docs/assessments/ASSESS-001/ASSESS-001-Interventions-Index.md
23
- ```
24
-
25
- Use `AskUserQuestion`:
26
- - **"Approve all"** โ€” all proposed interventions approved
27
- - **"Approve CRITICAL only"** โ€” only CRITICAL severity approved
28
- - **"Select interventions"** โ€” user specifies INT-NNN to approve (comma-separated)
29
- - **"Assessment only"** โ€” stop here, no remediation
30
-
31
- If the user selects **"Assessment only"**, skip to the Summary phase.
32
-
33
- ## Approvals file format
34
-
35
- Write `{PREFIX}-Approvals.md` in the assessment directory:
36
-
37
- ```markdown
38
- # Approval Record โ€” {PREFIX}
39
-
40
- ## Assessment Approvals
41
-
42
- | Document | Status | Date | Notes |
43
- |----------|--------|------|-------|
44
- | {PREFIX}-Generic-Assessment.md | โœ… Reviewed | {date} | โ€” |
45
- | {PREFIX}-Interventions-Index.md | โœ… Reviewed | {date} | โ€” |
46
-
47
- ## Remediation Scope
48
-
49
- | Intervention | Approved | Date | Notes |
50
- |---|---|---|---|
51
- | INT-001 โ€” sql-injection-hardening | โœ… Approved | {date} | โ€” |
52
- | INT-002 โ€” god-class-decomposition | โœ… Approved | {date} | โ€” |
53
- | INT-003 โ€” di-refactoring | โŒ Deferred | {date} | Out of current sprint scope |
54
- ```
55
-
56
- ## Rules
57
-
58
- - **Never skip this gate** โ€” remediation cannot start without explicit approval
59
- - **Log the approval outcome** in the process log
60
- - **Record every decision** including deferred interventions and the reason