@softspark/ai-toolkit 3.1.0 → 3.2.0

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,5 +1,5 @@
1
1
  {
2
- "last_run": "2026-04-28T09:44:52Z",
2
+ "last_run": "2026-05-04T08:36:05Z",
3
3
  "schema_version": 1,
4
4
  "tools": {
5
5
  "aider": {
@@ -24,10 +24,11 @@
24
24
  }
25
25
  },
26
26
  "augment": {
27
- "docs_hash": "7e632fc04e405f60",
27
+ "docs_hash": "f6b4c7fd64936879",
28
28
  "headings": [
29
29
  "Agent",
30
30
  "Code Completions",
31
+ "Documentation Index",
31
32
  "Introduction",
32
33
  "Next Edit",
33
34
  "\u200bAuggie CLI",
@@ -57,9 +58,10 @@
57
58
  }
58
59
  },
59
60
  "claude-code": {
60
- "docs_hash": "e51d7d44c72cd522",
61
+ "docs_hash": "7d2930e5f97e4126",
61
62
  "headings": [
62
63
  "Claude Code overview",
64
+ "Documentation Index",
63
65
  "\u200bGet started",
64
66
  "\u200bNext steps",
65
67
  "\u200bUse Claude Code everywhere",
@@ -102,15 +104,16 @@
102
104
  "slash command": true,
103
105
  "sub-agent": true
104
106
  },
105
- "version": "2.1.121 (Claude Code)"
107
+ "version": "2.1.126 (Claude Code)"
106
108
  },
107
109
  "cline": {
108
- "docs_hash": "0c69984492abf906",
110
+ "docs_hash": "eec0384d180243aa",
109
111
  "headings": [
110
112
  "Cline CLI",
111
113
  "Cline Documentation",
112
114
  "Core Workflows",
113
115
  "Customization",
116
+ "Documentation Index",
114
117
  "Features",
115
118
  "Install Cline",
116
119
  "MCP Servers",
@@ -135,7 +138,7 @@
135
138
  }
136
139
  },
137
140
  "codex-cli": {
138
- "docs_hash": "9e188e7e454523b6",
141
+ "docs_hash": "5a4b2d4eeee1d675",
139
142
  "headings": [
140
143
  "About",
141
144
  "Contributing",
@@ -154,7 +157,7 @@
154
157
  "Packages 0",
155
158
  "Provide feedback",
156
159
  "Quickstart",
157
- "Releases 744",
160
+ "Releases 757",
158
161
  "Repository files navigation",
159
162
  "Resources",
160
163
  "Saved searches",
@@ -187,12 +190,12 @@
187
190
  "version": "codex-cli 0.125.0"
188
191
  },
189
192
  "cursor": {
190
- "docs_hash": "56983669e33487e2",
193
+ "docs_hash": "4c3678f1353e012f",
191
194
  "headings": [],
192
195
  "markers": {
193
196
  ".cursor/rules": false,
194
197
  "AGENTS.md": false,
195
- "Agent Mode": false,
198
+ "Agent Mode": true,
196
199
  "Composer": true,
197
200
  "cursorrules": false,
198
201
  "hooks.json": false,
@@ -203,7 +206,7 @@
203
206
  }
204
207
  },
205
208
  "gemini-cli": {
206
- "docs_hash": "fa8989b65df2bb73",
209
+ "docs_hash": "20c254199b42f18c",
207
210
  "headings": [
208
211
  "Breadcrumbs",
209
212
  "Directory actions",
@@ -242,7 +245,7 @@
242
245
  }
243
246
  },
244
247
  "github-copilot": {
245
- "docs_hash": "c2100e9dca8dce0d",
248
+ "docs_hash": "6467b14babd06b26",
246
249
  "headings": [
247
250
  "About Copilot auto model selection",
248
251
  "About Copilot integrations",
@@ -290,7 +293,7 @@
290
293
  }
291
294
  },
292
295
  "opencode": {
293
- "docs_hash": "5c0f3f9c9b031f49",
296
+ "docs_hash": "c8c233106f166444",
294
297
  "headings": [
295
298
  "Add features",
296
299
  "Ask questions",
@@ -351,12 +354,13 @@
351
354
  }
352
355
  },
353
356
  "windsurf": {
354
- "docs_hash": "9cadd867b0cec6da",
357
+ "docs_hash": "167ee1fc000f03d9",
355
358
  "headings": [
356
359
  "Advanced",
357
360
  "App Deploys",
358
361
  "Cascade",
359
362
  "Context Awareness",
363
+ "Documentation Index",
360
364
  "MCP",
361
365
  "Memories",
362
366
  "Recommended Plugins",
package/bin/ai-toolkit.js CHANGED
@@ -51,6 +51,7 @@ const SCRIPT_COMMANDS = {
51
51
  'evaluate': { script: 'evaluate_skills.py', toolkitCwd: true },
52
52
  'stats': { script: 'stats.py' },
53
53
  'compile-slm': { script: 'compile_slm.py' },
54
+ 'pack-codebase': { script: 'pack_codebase.py' },
54
55
  };
55
56
 
56
57
  // ---------------------------------------------------------------------------
@@ -106,6 +107,7 @@ const COMMANDS = {
106
107
  'opencode-json': 'Merge .mcp.json servers into opencode.json',
107
108
  'agents-md': 'Regenerate AGENTS.md from agent definitions',
108
109
  'compile-slm': 'Compile toolkit into a minimal SLM system prompt (--budget, --model-size, --dry-run)',
110
+ 'pack-codebase': 'Pack the current codebase into a single AI-friendly markdown file (--budget, --include, --exclude, --dry-run)',
109
111
  'llms-txt': 'Generate llms.txt and llms-full.txt',
110
112
  'generate-all': 'Generate all platform configs at once (agents, cursor, windsurf, copilot, gemini, cline, roo, aider, augment, antigravity, codex, opencode, llms)',
111
113
  help: 'Show this help message',
@@ -0,0 +1,117 @@
1
+ ---
2
+ title: "Spike: F2 MCP Context Trim — Hook Feasibility & Path Decision"
3
+ category: planning
4
+ service: ai-toolkit
5
+ tags:
6
+ - mcp
7
+ - hooks
8
+ - claude-code
9
+ - spike
10
+ - feasibility
11
+ doc_type: spike
12
+ status: completed
13
+ created: "2026-05-04"
14
+ last_updated: "2026-05-04"
15
+ completed: "2026-05-04"
16
+ shipped_in: "v3.2.0 (decision only — implementation deferred to v4.0)"
17
+ description: "Spike conclusion for Feature 2 of the output-token-discipline plan. Determines whether Claude Code hooks can modify MCP tool descriptions before they reach the LLM. Result: hooks operate per-call, not on tool list metadata. Full feature requires an MCP proxy server (multi-day scope). Outcome: F2 deferred to v4.0 with own dedicated PRD."
18
+ ---
19
+
20
+ # Spike: F2 MCP Context Trim — Hook Feasibility & Path Decision
21
+
22
+ ## Question
23
+
24
+ Can Claude Code's hook system modify MCP **tool descriptions** that get included in the model's system prompt, or do hooks only intercept individual tool **calls**?
25
+
26
+ ## Method
27
+
28
+ Reviewed local sources only (RAG MCP offline at spike time):
29
+
30
+ 1. `app/skills/hook-creator/SKILL.md` — exhaustive list of supported hook events and their data shapes
31
+ 2. `app/hooks/guard-destructive.sh`, `app/hooks/guard-path.sh` — actual examples reading `tool_input` from stdin
32
+ 3. `app/skills/mcp-builder/SKILL.md` — MCP server-side conventions
33
+ 4. `~/.claude/.mcp.json` — user's installed MCP servers (Context7, sequential-thinking, filesystem, rag-mcp, memory, jira-mcp)
34
+
35
+ ## Findings
36
+
37
+ ### Hook events that touch tool data
38
+
39
+ | Event | Modifies tool list? | Modifies tool input? | Notes |
40
+ |-------|--------------------|--------------------|-------|
41
+ | `PreToolUse` | no | no (only block via exit 2) | Reads `tool_input.*`, decides allow/deny |
42
+ | `PostToolUse` | no | no | Sees result for logging / feedback |
43
+ | `PermissionRequest` | no | yes (`updatedInput`) | Can rewrite a single call's args |
44
+ | `Elicitation` | no | n/a | Intercepts MCP UI prompts, not tool list |
45
+ | `SessionStart` | no | n/a | Context injection only |
46
+ | `InstructionsLoaded` | no | n/a | Verifies CLAUDE.md presence |
47
+
48
+ **No event exposes the MCP `tools/list` response or the system-prompt tool catalog**. The tool catalog is materialized once per MCP server connection from the server's own `tools/list` reply.
49
+
50
+ ### Why this matters
51
+
52
+ The compression target was the bulk of MCP tool descriptions sitting in every model turn's system prompt. Examples from the user's installed servers:
53
+
54
+ - `dart-mcp-server` — ~30 tools with multi-paragraph descriptions
55
+ - `filesystem` — verbose paths and example sections
56
+ - `pencil` — "IMPORTANT" stanzas repeated across tools
57
+ - `jira-mcp` — long `Use this tool to...` boilerplate
58
+
59
+ At ~100 tools across 7 servers in this user's config, easily 8–15k tokens of pure description text. Real waste, but Claude Code does not let a hook touch it.
60
+
61
+ ### What would actually work
62
+
63
+ To compress MCP tool descriptions before they reach the LLM, exactly two architectures are viable:
64
+
65
+ 1. **Local MCP proxy server** between Claude Code and each target server. The proxy re-implements `tools/list` to rewrite descriptions on the fly while passing through `tools/call`. Requires JSON-RPC 2.0 over stdio + SSE per server, per-server config in `~/.claude/.mcp.json`, and a process supervisor for the proxies. Multi-day scope. Failure mode: a buggy proxy breaks all MCP-dependent skills.
66
+ 2. **Source-side fork**: ship pre-trimmed copies of common MCP servers (`@softspark/jira-mcp-trim`, etc.) — high maintenance burden, doesn't help users with custom servers.
67
+
68
+ Neither is a "minimal change" by the standards of this plan.
69
+
70
+ ## Decision (final, 2026-05-04)
71
+
72
+ **Drop F2 from v3.2.0 entirely. Defer the full MCP proxy approach to v4.0** with its own dedicated PRD and architecture spike.
73
+
74
+ The spike originally surfaced a smaller "F2-lite observability tool" alternative (read-only inventory + suggestions). After review, the user chose to drop both options from v3.2.0:
75
+
76
+ - v3.2.0 ships F1 + F3 + F3.5 only (output modes, token telemetry, default statusline)
77
+ - F2 work — including any observability-first prototype — moves wholesale to v4.0 milestone
78
+ - Reasoning: keep v3.2.0 release scope tight; v4.0 owns MCP-cost story end-to-end with proper proxy architecture
79
+
80
+ ## Alternatives considered
81
+
82
+ | Option | Pros | Cons | Verdict |
83
+ |--------|------|------|---------|
84
+ | Build full MCP proxy in v3.2.0 | Achieves original compression goal | Multi-day work, single-bug-breaks-all-MCP failure mode, would block release | Rejected — too big for current release |
85
+ | Pre-install rewrite of `.mcp.json` | One-shot, no runtime cost | MCP spec sources descriptions from server, not config — wouldn't actually take effect | Rejected — does not work |
86
+ | F2-lite observability tool in v3.2.0 | Low risk, gives users data | Not the original target; partial value; mixes two milestones | Rejected by user — keep v3.2.0 focused |
87
+ | **Defer F2 entirely to v4.0** | Clean release boundaries; v4.0 owns MCP story end-to-end with full proxy scope | Token waste in MCP descriptions stays invisible to users until v4.0 | **Selected** |
88
+
89
+ ## What was delivered in v3.2.0 (F1 + F3 + F3.5)
90
+
91
+ The output-discipline goal is partially addressed by what shipped:
92
+
93
+ - **Output modes** (F1) cut conversational response tokens 60–80% on the shipped fixture set
94
+ - **Real token telemetry** (F3) lets users see actual cost per session — including the MCP description overhead, even if they cannot yet trim it
95
+ - **Default statusline** (F3.5) surfaces that cost continuously
96
+
97
+ Users now have visibility into the MCP-description waste this spike identified, even though automated compression has to wait for v4.0.
98
+
99
+ ## What goes into v4.0
100
+
101
+ Tracked as an active PRD: [`kb/planning/mcp-context-trim-v4-prd.md`](../../planning/mcp-context-trim-v4-prd.md). It carries forward:
102
+
103
+ 1. Compression heuristics from the original F2 design (migrated out of the archived plan into the live PRD)
104
+ 2. Local MCP proxy server architecture: JSON-RPC 2.0 over stdio + SSE per server, process supervisor, per-server config in `~/.softspark/ai-toolkit/mcp-proxy/`
105
+ 3. Rollback / opt-out story — a buggy proxy must not break MCP-dependent skills
106
+ 4. Failure mode — proxy down → fall through to direct MCP server, with telemetry warning
107
+ 5. Migration of existing user `.mcp.json` configs
108
+
109
+ Estimate in the PRD: ~8 working days.
110
+
111
+ ## Status
112
+
113
+ | Date | Status | Author |
114
+ |------|--------|--------|
115
+ | 2026-05-04 | Spike completed | claude |
116
+ | 2026-05-04 | User decision: defer F2 to v4.0 entirely (no F2-lite in v3.2.0) | lukasz.krzemien |
117
+ | 2026-05-04 | Spike archived to `kb/history/completed/` alongside the parent plan | claude |
@@ -0,0 +1,261 @@
1
+ ---
2
+ title: "Plan: Output & Token Discipline — Concise Modes, MCP Trim, Token Receipts"
3
+ category: planning
4
+ service: ai-toolkit
5
+ tags:
6
+ - brand-voice
7
+ - output-style
8
+ - mcp
9
+ - statusline
10
+ - token-tracking
11
+ - hooks
12
+ - briefing
13
+ doc_type: plan
14
+ status: completed
15
+ created: "2026-05-04"
16
+ last_updated: "2026-05-04"
17
+ completed: "2026-05-04"
18
+ completion: "100% of v3.2.0 scope (F2 deferred to v4.0 per spike conclusion)"
19
+ shipped_in: "v3.2.0"
20
+ description: "Three coordinated extensions to ai-toolkit that reduce token usage and surface real cost data: (1) brand-voice output modes for concise/strict Claude responses, (2) MCP description trimmer to compact tool listings before they reach the model, (3) token receipts in statusline reading session JSONL directly. Native extensions, no third-party skill names imported."
21
+ ---
22
+
23
+ # Plan: Output & Token Discipline
24
+
25
+ **Status:** Completed (shipped in v3.2.0 on 2026-05-04)
26
+ **Author:** lukasz.krzemien
27
+ **Source of inspiration:** external Claude Code plugin observed 2026-05-04 (mechanism only, not naming or branding)
28
+ **Spike companion:** [`kb/history/completed/f2-mcp-trim-spike-20260504.md`](f2-mcp-trim-spike-20260504.md)
29
+
30
+ ## Cel
31
+
32
+ Zmniejszyć realne zużycie tokenów w sesjach Claude Code i dać użytkownikowi widoczność tego zużycia w czasie rzeczywistym. Trzy mechanizmy działające razem, każdy jako natywne rozszerzenie istniejących komponentów ai-toolkit (`brand-voice`, `briefing`, `track-usage.sh`). Bez importowania obcych nazw — adaptacja idei jako własnych.
33
+
34
+ ## Kontekst
35
+
36
+ Obecnie ai-toolkit ma:
37
+
38
+ - `brand-voice` skill — pilnuje stylu pisanego (docs, README, content)
39
+ - `track-usage.sh` hook — liczy `/skill` invocations do `~/.softspark/ai-toolkit/stats.json`
40
+ - `compile_slm.py` — kompresuje cały toolkit dla małych modeli (inny scope)
41
+ - 113 skilli, pełen system hooków, doctor, eject
42
+
43
+ Brakuje:
44
+
45
+ - Trybu zwięzłego dla *odpowiedzi* Claude'a (brand-voice działa tylko dla pisanej zawartości)
46
+ - Kompresji opisów MCP-tooli, które zżerają setki tokenów na każdym wywołaniu
47
+ - Realnego pomiaru tokenów per sesja (mamy tylko licznik invocations, nie tokenów)
48
+
49
+ ## Zakres
50
+
51
+ Trzy features, zaplanowane w kolejności narastającego ryzyka.
52
+
53
+ ---
54
+
55
+ ## Feature 1 — `brand-voice` output modes
56
+
57
+ ### Cel
58
+ Rozszerzyć `brand-voice` o tryby zwięzłości stosowane do odpowiedzi konwersacyjnych Claude'a, nie tylko do generowanych dokumentów.
59
+
60
+ ### Decyzje nazewnicze
61
+ - **Wybrane:** zostaje `brand-voice` z wewnętrznymi trybami (`default`, `concise`, `strict`)
62
+ - **Odrzucone:**
63
+ - `concise` jako osobny skill — duplikuje brand-voice, niepotrzebny rozłam
64
+ - `terse` — niejednoznaczne, kojarzy się z "rude"
65
+ - `output-discipline` — zbyt biurokratyczne
66
+
67
+ ### Pliki
68
+
69
+ | Ścieżka | Akcja | Cel |
70
+ |---------|-------|-----|
71
+ | `app/skills/brand-voice/SKILL.md` | edit | Dodaj sekcję `## Output Modes` z opisem trzech trybów i sposobu aktywacji |
72
+ | `app/skills/brand-voice/modes/concise.md` | new | Reguły: max 3 zdania per odpowiedź na pytanie zamknięte, brak preamble, brak "I'll now..." |
73
+ | `app/skills/brand-voice/modes/strict.md` | new | Reguły: tylko fakty, zero filler adjectives, max 1 zdanie per fakt, listy zamiast prozy |
74
+ | `app/skills/brand-voice/scripts/measure.py` | new | Eval przed/po na fixtures, raport oszczędności tokenów |
75
+ | `tests/fixtures/output-modes/` | new | 10 par baseline/expected dla różnych typów zadań (debug, review, plan, eksploracja) |
76
+ | `tests/skills_brand_voice.bats` | edit | Dodaj asercje dla modes (regex na zakazane filler, max-line-length) |
77
+
78
+ ### Aktywacja
79
+
80
+ Trzy mechanizmy:
81
+
82
+ 1. Frontmatter w projekcie: `output-mode: concise` w `CLAUDE.md` lub `.claude/settings.json`
83
+ 2. Slash: `/brand-voice concise` przełącza dla bieżącej sesji (przez `track-usage.sh` zapisuje do session state)
84
+ 3. Auto-trigger: skill ładuje się także przy długich sesjach generowania (>30 min, heurystyka)
85
+
86
+ ### Success criteria
87
+
88
+ - Na zestawie 10 fixtures `concise` redukuje output >40% bez utraty kluczowych faktów
89
+ - Test asercji: zachowane są wszystkie nazwy plików i symboli z baseline (regex match)
90
+ - `validate.py --strict` przechodzi
91
+ - `audit_skills.py --ci` zero HIGH
92
+
93
+ ### Estymata
94
+ 4–6h
95
+
96
+ ---
97
+
98
+ ## Feature 2 — MCP context trim — DEFERRED TO v4.0
99
+
100
+ **Status:** Deferred. Spike conducted before implementation, conclusion in [`f2-mcp-trim-spike-20260504.md`](f2-mcp-trim-spike-20260504.md).
101
+
102
+ **Reason:** Claude Code hooks do not expose the MCP `tools/list` response or the system-prompt tool catalog. Hook events (`PreToolUse`, `PermissionRequest`, `Elicitation`) operate on individual tool calls only. Modifying tool descriptions before they reach the model requires a local MCP proxy server — multi-day scope, single-bug-breaks-all-MCP failure mode, out of scope for v3.2.0.
103
+
104
+ **Resolution:** Full proxy-server approach moved to its own active planning doc: [`kb/planning/mcp-context-trim-v4-prd.md`](../../planning/mcp-context-trim-v4-prd.md). The mid-spike "F2-lite observability tool" alternative was also dropped per user decision (2026-05-04) — v3.2.0 ships F1+F3 only; v4.0 picks up the proxy-server work in full scope.
105
+
106
+ The compression heuristics, file plan, and risk register from the original Feature 2 design were migrated into the v4.0 PRD. They are no longer duplicated in this archived doc.
107
+
108
+ ---
109
+
110
+ ## Feature 3 — Token receipts w statusline
111
+
112
+ ### Cel
113
+ Pokazać realne (nie estymowane) zużycie tokenów per-sesja w statusline Claude Code. Dane czytane z session JSONL, nie z heurystyk.
114
+
115
+ ### Decyzje nazewnicze
116
+ - **Wybrane:** rozszerzenie istniejącego skilla `briefing` + nowy hook `statusline-tokens.sh` + nowy skrypt `session_token_stats.py`
117
+ - **Odrzucone:**
118
+ - Nowy skill `stats` / `receipts` — duplikuje funkcjonalnie `briefing`
119
+ - Modyfikacja istniejącego `track-usage.sh` jako jedynego punktu — za duża odpowiedzialność jednego pliku
120
+
121
+ ### Pliki
122
+
123
+ | Ścieżka | Akcja | Cel |
124
+ |---------|-------|-----|
125
+ | `scripts/session_token_stats.py` | new | Parser JSONL stdlib-only. Funkcje: `read_session()`, `aggregate_by_skill()`, `compare_baseline_vs_concise()` |
126
+ | `app/hooks/statusline-tokens.sh` | new | Type `statusLine` w settings.json. Sumuje `usage.input_tokens` + `usage.output_tokens` z bieżącej sesji JSONL |
127
+ | `app/hooks/track-usage.sh` | edit | Po wykryciu `/skill` zapisuj też `prompt_tokens` jeśli `transcript_path` dostępne |
128
+ | `app/skills/briefing/SKILL.md` | edit | Nowa sekcja "Token receipts", komendy `/briefing --tokens --since 7d`, `/briefing --tokens --share` |
129
+ | `scripts/merge-hooks.py` | edit | Statusline injection do `settings.json`, preserve user-customized entries (delivered as F3.5) |
130
+ | `app/hooks/ai-toolkit-statusline.sh` | new | Comprehensive statusline (cwd + git + ctx + tokens + cost + model), default install (delivered as F3.5) |
131
+ | `tests/session_token_stats.bats` | new | Fixture JSONL z 3 messages, asercje na sumę i breakdown |
132
+ | `tests/statusline_tokens.bats` | new | Mock JSONL, weryfikacja outputu hooka (max 80 znaków, brak NaN, fallback gdy brak sesji) |
133
+
134
+ ### Format statusline (proponowany)
135
+
136
+ ```
137
+ [ai-toolkit] /concise · session: 24.7k · trend: ↓18%
138
+ ```
139
+
140
+ Krótki tryb default, `--verbose` dodaje breakdown per skill.
141
+
142
+ ### Ścieżka odczytu sesji
143
+
144
+ Claude Code zapisuje JSONL do `~/.claude/projects/<sanitized-cwd>/<session-id>.jsonl`. Każda linia to message z polem `usage` (input_tokens, output_tokens, cache_*). Skrypt:
145
+
146
+ 1. Identyfikuje aktualną sesję z env var `CLAUDE_SESSION_ID` (jeśli istnieje) lub najświeższy plik
147
+ 2. Parsuje linie ignorując te bez `usage`
148
+ 3. Sumuje + agreguje per skill (jeśli `track-usage.sh` zapisał skill mapping w sidecar pliku)
149
+
150
+ ### Success criteria
151
+
152
+ - Statusline pokazuje liczbę tokenów odczytaną z JSONL z dokładnością ±2% vs Anthropic API report (jeśli dostępny)
153
+ - Brak crash gdy sesja jeszcze pusta
154
+ - Brak crash gdy JSONL malformed
155
+ - `validate.py --strict` przechodzi
156
+
157
+ ### Estymata
158
+ 6–8h
159
+
160
+ ---
161
+
162
+ ## Co nie wchodzi w plan
163
+
164
+ | Pomysł | Powód odrzucenia |
165
+ |--------|------------------|
166
+ | Memory/file compressor (`/compress <file>`) | `compile_slm.py` już kompresuje toolkit, brak konkretnego use-case dla per-file |
167
+ | Compact `/commit`, `/review` modes | Powstaną automatycznie po Feature 1 (te skille będą używać reguł `concise` mode) |
168
+ | "Caveman speak" / classical Chinese mode | Nie pasuje do tonu workmanlike, sprzeczne z brand-voice |
169
+ | Single curl-installer | Już mamy `ai-toolkit install` z profilami |
170
+
171
+ ---
172
+
173
+ ## Kolejność realizacji i zależności
174
+
175
+ ```
176
+ Feature 1 (brand-voice modes)
177
+ ↓ dostarcza reguły zwięzłości
178
+ Feature 3 (token receipts)
179
+ ↓ dostarcza pomiar before/after dla F1
180
+ Feature 2 (mcp-trim) ← spike research najpierw, niezależne od F1/F3
181
+ ```
182
+
183
+ **F1 i F3 mogą iść parallel po dokończeniu F1 mode files.**
184
+ **F2 ma osobną decyzję go/no-go po spike'u.**
185
+
186
+ ## Estymata zbiorcza
187
+
188
+ | Feature | Min | Max |
189
+ |---------|-----|-----|
190
+ | F1 | 4h | 6h |
191
+ | F3 | 6h | 8h |
192
+ | F2 spike | 1h | 1h |
193
+ | F2 implementacja | 0h | 10h |
194
+ | **Total** | **11h** | **25h** |
195
+
196
+ ## Doc & test sweep (obowiązkowy po każdym feature)
197
+
198
+ 1. `python3 scripts/validate.py --strict`
199
+ 2. `python3 scripts/audit_skills.py --ci`
200
+ 3. Regen `AGENTS.md`: `python3 scripts/generate_agents_md.py > AGENTS.md`
201
+ 4. Regen `llms.txt`: `python3 scripts/generate_llms_txt.py > llms.txt`
202
+ 5. Bump version w `package.json` + `plugin.json`
203
+ 6. Update `skills-catalog.md` z nowymi/zmienionymi skillami
204
+ 7. Update `README.md`, `CLAUDE.md`, `ARCHITECTURE.md`, `architecture-overview.md` jeśli zmiana behavior
205
+ 8. Commit conventional: `feat(brand-voice): add output modes`, `feat(briefing): add token receipts`, `feat(mcp-trim): add description trimmer`
206
+
207
+ ## Open questions — resolved
208
+
209
+ 1. **Czy `PreToolUse` może modyfikować deklarację tool'a w MCP listingu?** — NIE. Spike potwierdził że żaden hook event nie wystawia `tools/list`. F2 wymaga MCP proxy. Odsunięte do v4.0.
210
+ 2. **Czy Claude Code wystawia hookom `CLAUDE_SESSION_ID`?** — częściowo. `scripts/session_token_stats.py` używa fallback "newest JSONL w katalogu projektu" + opcjonalnie cwd → sanitize → match. Działa stabilnie na realnych sesjach (96.6k tokens parsed correctly w smoke tescie).
211
+ 3. **Czy włączyć `concise` mode jako default?** — pozostaje opt-in. `brand-voice` z trybami auto-loaduje się tylko gdy projekt ustawi `output-mode: concise` w `CLAUDE.md` lub user wpisze `/brand-voice concise`. Pomiary z F3 dadzą dane do późniejszej decyzji.
212
+
213
+ ## Final delivery (v3.2.0)
214
+
215
+ ### Shipped
216
+
217
+ | Feature | Outcome | Pliki |
218
+ |---------|---------|-------|
219
+ | **F1 — brand-voice output modes** | Done. Aggregate ratio na 3 fixtures: concise **21%**, strict **14%** (cel ≤60% / ≤40%). | `app/skills/brand-voice/SKILL.md`, `app/skills/brand-voice/modes/{concise,strict}.md`, `app/skills/brand-voice/scripts/measure.py`, `tests/fixtures/output-modes/{debug-explanation,plan-question,review-summary}/`, `tests/test_brand_voice.bats` (14 tests) |
220
+ | **F3 — token receipts** | Done. Smoke-test na realnej sesji: 96.6k tokenów poprawnie sparsowane. | `scripts/session_token_stats.py`, `tests/fixtures/session-jsonl/{three-messages,malformed,empty}.jsonl`, `tests/test_session_token_stats.bats` (15 tests) |
221
+ | **F3.5 — comprehensive default statusline** | Done. Pełny segment: cwd + git + ctx% + tokens + trend + model-aware cost + model. Installed by default via `merge-hooks.py`, user-custom statusLine preserved untouched. | `app/hooks/ai-toolkit-statusline.sh`, `app/hooks.json` (`statusLine` entry), `scripts/merge-hooks.py` (statusLine inject/strip), `tests/test_statusline_hook.bats` (14 tests), `tests/test_merge_hooks_statusline.bats` (8 tests) |
222
+ | **briefing skill extension** | `/briefing --tokens` + wire-up docs + opt-out env vars. | `app/skills/briefing/SKILL.md` |
223
+
224
+ ### Deviations from plan
225
+
226
+ | Plan said | Shipped | Reason |
227
+ |-----------|---------|--------|
228
+ | 10 fixtures w F1 | 3 fixtures + `must_contain.txt` mechanism | Mniejszy zestaw + extensible konwencja wystarcza do walidacji budżetów; jakość > ilość |
229
+ | F3 hook integracja jako follow-up (manual settings.json edit) | F3.5 dostarczył pełny default install via `merge-hooks.py` | User feedback w trakcie pracy: "niech ai-toolki instaluje go domyslnie od nowej wersji" |
230
+ | F2 implementacja po spike'u | F2 deferred do v4.0 | Spike pokazał że Claude Code hooki nie wystawiają `tools/list` → wymaga proxy server, multi-day scope |
231
+
232
+ ### Quality gates passed
233
+
234
+ - `validate.py --strict`: 0 errors / 0 warnings
235
+ - `audit_skills.py --ci`: 0 HIGH / 0 WARN / 13 INFO (pre-existing)
236
+ - `audit_skills.py --sarif`: SARIF 2.1.0 valid, 5 rules
237
+ - `npm test`: 1032 / 1032 passing (was 981 in v3.1.1)
238
+ - Registry drift: clean
239
+ - Provenance + checksum-pin: verified
240
+ - Ecosystem doctor: 9 cosmetic drifts (class A) refreshed
241
+
242
+ ### Skill classification change
243
+
244
+ `brand-voice` przeszedł `user-invocable: false → true` (knowledge → hybrid):
245
+
246
+ - **Hybrid**: 31 → 32
247
+ - **Knowledge**: 49 → 48
248
+ - **Task**: 32 (no change)
249
+
250
+ Updated: `README.md`, `kb/reference/architecture-overview.md`, `kb/reference/skills-catalog.md`.
251
+
252
+ ## Status & rewizje
253
+
254
+ | Data | Zmiana | Autor |
255
+ |------|--------|-------|
256
+ | 2026-05-04 | Initial draft | lukasz.krzemien |
257
+ | 2026-05-04 | F1 implementation done — brand-voice modes, measure.py, 3 fixtures, 14 bats tests. Aggregate ratio: concise 21%, strict 14%. | claude |
258
+ | 2026-05-04 | F3 implementation done — `session_token_stats.py`, `statusline-tokens.sh`, briefing skill extension. 22 new bats tests. Smoke-tested on real session. | claude |
259
+ | 2026-05-04 | F3.5 follow-up done — replaced focused tokens hook with comprehensive `ai-toolkit-statusline.sh`. Extended `merge-hooks.py` for safe statusLine injection. Version bumped 3.1.1 → 3.2.0. 22 new bats tests. CHANGELOG + README updated. | claude |
260
+ | 2026-05-04 | F2 spike completed — see [`f2-mcp-trim-spike-20260504.md`](f2-mcp-trim-spike-20260504.md). Hooks cannot modify `tools/list`. F2 deferred to v4.0 with own PRD. | claude |
261
+ | 2026-05-04 | Plan archived to `kb/history/completed/`. Shipped in v3.2.0. | claude |