claude-alfred 0.1.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.
Files changed (44) hide show
  1. package/README.ja.md +283 -0
  2. package/README.md +283 -0
  3. package/content/hooks/hooks.json +41 -0
  4. package/content/mcp/.mcp.json +12 -0
  5. package/dist/audit-DujZ6YAy.mjs +18 -0
  6. package/dist/cli.mjs +509 -0
  7. package/dist/dispatcher-BzOdcjaa.mjs +93 -0
  8. package/dist/embedder-BshPIMrW.mjs +215 -0
  9. package/dist/epic-CdRKNGvP.mjs +227 -0
  10. package/dist/fts-BDdUbNfM.mjs +195 -0
  11. package/dist/helpers-BsdW4kgn.mjs +94 -0
  12. package/dist/knowledge-CCCixwb8.mjs +156 -0
  13. package/dist/post-tool-qemgso2b.mjs +88 -0
  14. package/dist/postinstall.mjs +49 -0
  15. package/dist/pre-compact-Cmg9kprV.mjs +181 -0
  16. package/dist/project-CpgK3fwQ.mjs +79 -0
  17. package/dist/schema-CcIFwr_0.mjs +289 -0
  18. package/dist/server-DF7CXxKi.mjs +2635 -0
  19. package/dist/server-Dsf47Pd4.mjs +19220 -0
  20. package/dist/session-start-DUYF6E0V.mjs +209 -0
  21. package/dist/store-Clcihees.mjs +338 -0
  22. package/dist/types-C3butmI8.mjs +6823 -0
  23. package/dist/user-prompt-BDeST0mR.mjs +144 -0
  24. package/dist/vectors-DvuAqDeO.mjs +83 -0
  25. package/package.json +46 -0
  26. package/web/dist/assets/activity-UyW12k7Z.js +1 -0
  27. package/web/dist/assets/api-BI8AW-mC.js +1 -0
  28. package/web/dist/assets/dist-BHj_gZG8.js +1 -0
  29. package/web/dist/assets/dist-DDZSXOC-.js +1 -0
  30. package/web/dist/assets/index-B9C85vN2.js +10 -0
  31. package/web/dist/assets/index-bIyYMf1a.css +1 -0
  32. package/web/dist/assets/knowledge-DmvXTX67.js +5 -0
  33. package/web/dist/assets/link-BSgD_zxQ.js +1 -0
  34. package/web/dist/assets/matchContext-CO01nzZ3.js +1 -0
  35. package/web/dist/assets/progress-DBmt_Ww6.js +6 -0
  36. package/web/dist/assets/routes-zEN1XNFl.js +1 -0
  37. package/web/dist/assets/scroll-area-DPCDB42s.js +45 -0
  38. package/web/dist/assets/separator-5sy8HYz5.js +1 -0
  39. package/web/dist/assets/skeleton-D7GRd6oJ.js +1 -0
  40. package/web/dist/assets/tabs-VSkG1f0-.js +1 -0
  41. package/web/dist/assets/tasks-CKNc1U7M.js +1 -0
  42. package/web/dist/assets/tasks._slug-DPzi78wf.js +8 -0
  43. package/web/dist/assets/utils-Dw49HYRP.js +1 -0
  44. package/web/dist/index.html +17 -0
package/README.ja.md ADDED
@@ -0,0 +1,283 @@
1
+ # alfred
2
+
3
+ [![Version](https://img.shields.io/npm/v/claude-alfred)](https://www.npmjs.com/package/claude-alfred)
4
+ [![Node](https://img.shields.io/badge/node-%3E%3D22-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
5
+ [![MIT License](https://img.shields.io/github/license/hir4ta/claude-alfred)](https://github.com/hir4ta/claude-alfred/blob/main/LICENSE)
6
+
7
+ Claude Code の開発執事。
8
+
9
+ [English README](README.md)
10
+
11
+ ## 何が辛いのか
12
+
13
+ Claude Code で開発してると、こうなる:
14
+
15
+ - **忘れる。** Compact するたび、セッション切れるたび、全部消える。20分かけた設計判断、もう一回聞かれる。
16
+ - **行き当たりばったり。** 仕様もなく、計画もなく、ノリで実装。動くけど、壊れる。
17
+ - **誰もレビューしない。** コードがそのまま出ていく。バグは本番で見つかる。
18
+
19
+ alfred は3つとも潰す。
20
+
21
+ ## 何ができるか
22
+
23
+ **消えない仕様。** 要件、設計、決定、セッション状態 — 構造化されたMarkdownファイルが Compact を跨いで生き残る。コンテキストは一度も失われない。
24
+
25
+ **適応する仕様。** 小さなバグ修正なら3ファイル。中規模なら5。大規模なら7。タスクに応じてスペックの深さを自動調整。bugfix専用テンプレート(再現手順、原因分析、修正戦略)も。
26
+
27
+ **積み重なる記憶。** 「あの時こう決めた」「このバグ前にも見た」「Xは試したけどダメだった」— 全てが `.alfred/knowledge/` にMarkdownファイルとして保存される。Git フレンドリーで、人間が読めて、チームで共有できる。SQLite検索インデックスがセマンティック検索を提供。矛盾は自動検出。次に似た問題に当たったとき、聞く前に alfred が出してくる。
28
+
29
+ **信頼性シグナル。** 仕様の全項目にgrounding level(`verified`/`reviewed`/`inferred`/`speculative`)が付く。どの要件が実証済みで、どれが推測なのか一目でわかる。typoも検出する。
30
+
31
+ **ブラウンフィールド対応。** 既存コード変更用のdelta specに`CHG-N`変更IDとBefore/After行動差分を追加。「どのファイルが変わった」だけでなく「どの振る舞いがなぜ変わった」まで追跡。3つの新バリデーションチェック付き。
32
+
33
+ **ドリフトしない仕様。** コミットの度に、変更ファイルをスペックと照合。設計書にないコンポーネントを変更した?警告。メモリに保存したコーディング規約がコードと合わなくなった?フラグ。これをやるツールは他にない。
34
+
35
+ **スケールするレビュー。** 6つのレビュープロファイル(code, config, security, docs, architecture, testing)、それぞれにチェックリスト。並列エージェント、スコア付きレポート、具体的な修正案。
36
+
37
+ **能動的スキル提案。** alfred は呼ばれるのを待たない。調査中か、設計中か、実装中か、バグ修正中かを検出し、適切なタイミングで適切なスキルを提案する。コードを探索し続けてる?「`/alfred:survey` 使ったら?」。調査結果が出た?「`ledger` に保存しよう」。タスクが溜まってきた?「`roster` でまとめよう」。
38
+
39
+ **バイパスできない承認ゲート。** 実装前に仕様のレビューサイクルを回す。ブラウザダッシュボードで任意の行にコメントして、承認か差し戻し — GitHub の PR レビューと同じ体験を、仕様に対してやる。ステータスの手動書き換えでは突破できない。レビューファイルの存在まで検証する。
40
+
41
+ **張り付くプロジェクトコンテキスト。** Steering文書(プロダクトの目的、コード構造、技術スタック)がプロジェクトから自動生成され、すべての仕様に注入される。AIは常にアーキテクチャを理解している。
42
+
43
+ ## セットアップ
44
+
45
+ ### 1. インストール
46
+
47
+ ```bash
48
+ npm install -g claude-alfred
49
+ ```
50
+
51
+ SQLite データベースとユーザールールが自動セットアップされる。確認:
52
+
53
+ ```bash
54
+ alfred doctor
55
+ ```
56
+
57
+ ### 2. プラグイン
58
+
59
+ Claude Code 内で:
60
+
61
+ ```
62
+ /plugin marketplace add hir4ta/claude-alfred
63
+ /plugin install alfred
64
+ ```
65
+
66
+ ### 3. 環境変数
67
+
68
+ `~/.zshrc` に追加:
69
+
70
+ ```bash
71
+ export VOYAGE_API_KEY=your-key # セマンティック検索が有効に(1セッション約$0.01)
72
+ export ALFRED_LANG=ja # 出力言語 (en/ja/zh/ko/fr/de/es/pt...)
73
+ ```
74
+
75
+ Voyage のキーがなくても動く。FTS5 全文検索がフォールバックする。
76
+
77
+ ### 4. プロジェクトセットアップ
78
+
79
+ Claude Code 内で、プロジェクトルートから:
80
+
81
+ ```
82
+ /init ← 候補から "alfred" を選択
83
+ ```
84
+
85
+ ステアリングドキュメント、テンプレート、ナレッジインデックスを生成する。
86
+
87
+ > **注意**: `/alfred:init` ではなく `/init` (短縮形) を使うこと。Claude Code の補完が `alfred:` プレフィックスを別スキルに誤ルーティングする場合がある。全 alfred スキル共通: `/brief`, `/attend`, `/mend` のように短縮形を推奨。
88
+
89
+ ## アップデート
90
+
91
+ 両方を一緒に更新する:
92
+
93
+ ```bash
94
+ npm update -g claude-alfred # CLI、hooks、MCP サーバー、ダッシュボード
95
+ ```
96
+
97
+ ```
98
+ /plugin update alfred # skills、agents、rules(Claude Code 内で)
99
+ ```
100
+
101
+ `alfred doctor` でバージョンの一致を確認できる。
102
+
103
+ ## スキル
104
+
105
+ | スキル | やること |
106
+ |--------|----------|
107
+ | `/alfred:brief` | 仕様を設計する。3エージェントがアーキテクチャを議論し、ダッシュボードで承認する |
108
+ | `/alfred:attend` | 全自動。仕様→レビュー→承認→実装→テスト→コミットまで放置でOK |
109
+ | `/alfred:tdd` | テスト駆動。red→green→refactor を自律サイクルで回す。テストパターンも記憶する |
110
+ | `/alfred:inspect` | 品質ゲート。6プロファイル並列レビュー、スコア付きレポート |
111
+ | `/alfred:mend` | バグ修正。再現→原因特定(過去のバグ記憶も使う)→修正→検証→コミット |
112
+ | `/alfred:survey` | 既存コードから仕様をリバースエンジニアリング。信頼度スコア付き |
113
+ | `/alfred:salon` | ブレスト。3人の専門家が並列でアイデアを出して、議論する |
114
+ | `/alfred:harvest` | PR レビューコメントからナレッジを抽出して永続メモリに保存 |
115
+ | `/alfred:furnish` | 設定ファイルの作成・ブラッシュアップ |
116
+ | `/alfred:quarters` | プロジェクト全体のセットアップウィザード |
117
+ | `/alfred:archive` | 参照資料を検索可能なナレッジに変換 |
118
+ | `/alfred:concierge` | 全機能のクイックリファレンス |
119
+
120
+ ## MCP ツール
121
+
122
+ | ツール | 役割 |
123
+ |--------|------|
124
+ | `dossier` | 仕様のライフサイクル管理 — init(サイズ/タイプ指定可), update, status, switch, complete, delete, history, rollback, review, validate |
125
+ | `roster` | エピック管理 — タスクのグループ化、依存関係、進捗追跡 |
126
+ | `ledger` | ナレッジ — search, save(Markdown+frontmatter), promote, reflect, audit-conventions |
127
+
128
+ ## Hook
129
+
130
+ 全自動。触らなくていい。
131
+
132
+ | イベント | 動作 |
133
+ |----------|------|
134
+ | SessionStart | 仕様コンテキスト復元 + CLAUDE.md 取込 + プロジェクト成熟度に応じた注入量調整 + ナレッジ健康チェック提案 |
135
+ | PreCompact | 決定抽出 → 構造化チャプターメモリ (Markdown) 保存 → エピック進捗同期 → 調査パターン検出・保存リマインド |
136
+ | UserPromptSubmit | セマンティック検索 + ファイルコンテキストブースト + **スキルナッジ**(意図検出 → 適切なスキル提案)|
137
+ | PostToolUse | Bash エラー検出 → 過去の修正を検索。コミット後: スペックドリフト検出。Read/Grep 5回以上: survey 提案 |
138
+
139
+ ## ブラウザダッシュボード
140
+
141
+ ```bash
142
+ alfred dashboard # ブラウザで localhost:7575 を開く
143
+ alfred dashboard --port 8080 # ポート指定
144
+ alfred dashboard --url-only # URLだけ出力
145
+ ```
146
+
147
+ | タブ | 表示内容 |
148
+ |------|----------|
149
+ | **Overview** | プロジェクトの健康状態 — タスク進捗とバリデーション結果、メモリ健康度(陳腐化数・矛盾数)、仕様の信頼度分布、エピック進捗、最近の意思決定 |
150
+ | **Tasks** | タスクカード: 現在のフォーカス、次のアクション、エピック、バリデーションバッジ。仕様ファイルの閲覧。Review タブでインラインコメント |
151
+ | **Knowledge** | メモリ一覧(サブタイプ別タグ付き)。セマンティック検索(Voyage AI、300msデバウンス)。ローカルテキストフィルタ。メモリの有効/無効切り替え |
152
+ | **Activity** | 操作タイムライン。イベントタイプ別フィルタ(init/complete/review)。エピックドリルダウン |
153
+
154
+ インラインレビュー: 仕様ファイルを選択し、Review タブに切り替え。特定の行にコメントして、レビューラウンドを切り替えて、承認または差し戻し — ブラウザで完結。
155
+
156
+ 着手中のタスクがシマーで光る。何が進行中か、一目でわかる。
157
+
158
+ 開発用: `ALFRED_DEV=1 alfred dashboard` + `task dev`(web/ 内)で Vite HMR が使える。
159
+
160
+ ## 検索パイプライン
161
+
162
+ キーワードマッチだけじゃない。3段階の検索パイプライン:
163
+
164
+ 1. **Voyage AI ベクトル検索** + リランキング(API キーがあるとき)
165
+ 2. **FTS5 全文検索** — タグエイリアス展開 + ファジーマッチ付き
166
+ 3. **キーワードフォールバック**(LIKE クエリ)
167
+
168
+ タグエイリアスが検索を自動拡張する: 「auth」で「authentication」「login」「認証」もヒットする。
169
+
170
+ ファジーマッチがタイポを吸収する:「authetication」でも「authentication」が見つかる。
171
+
172
+ ## ナレッジアーキテクチャ
173
+
174
+ ナレッジはYAMLフロントマター付きのMarkdownファイルとして保存される。真のソースはプロジェクトディレクトリにあり、バイナリDBではない。
175
+
176
+ ```
177
+ .alfred/knowledge/
178
+ ├── decisions/dec-auth-jwt.md # 設計判断
179
+ ├── patterns/pat-error-handling.md # 再利用パターン
180
+ └── rules/rul-no-mock-db.md # 強制ルール
181
+ ```
182
+
183
+ - **Git フレンドリー**: ナレッジをコミットしてチームと共有、PRでレビュー
184
+ - **人間が読める**: `cat` するだけで alfred が何を知っているか確認できる
185
+ - **再構築可能**: SQLite検索インデックスはこれらのファイルから派生 — DB を削除しても次のセッションで再構築される
186
+ - **サブタイプ減衰**: 仮定は30日で腐る。実証されたルールは120日持つ。メモリの種類ごとに半減期が違う。
187
+ - **矛盾検出**: 2つのエントリが矛盾していたら(「JWT使え」vs「JWT避けろ」)、自動でフラグ。
188
+ - **プロジェクト紐付け**: ナレッジは git リモートURLとブランチでタグ付けされ、プロジェクト横断検索が可能。
189
+
190
+ ## 適応的スペック
191
+
192
+ 全タスクに7ファイルは要らない。
193
+
194
+ | サイズ | 生成ファイル | 用途 |
195
+ |--------|------------|------|
196
+ | **S** | 3: requirements, tasks, session | バグ修正、設定変更、小さな変更 |
197
+ | **M** | 5: + design, test-specs | 新エンドポイント、リファクタ、中規模機能 |
198
+ | **L/XL** | 7: + decisions, research | アーキテクチャ変更、新サブシステム |
199
+ | **D** (delta) | 2: delta.md(CHG-N ID + Before/After付き), session | 既存コードへのブラウンフィールド変更 |
200
+ | **Bugfix** | 3-4: bugfix.md, tasks, session (+test-specs) | 外科的バグ修正(再現手順付き) |
201
+
202
+ サイズは説明文から自動判定、または明示指定: `dossier action=init size=S`
203
+
204
+ ## スペック検証
205
+
206
+ `dossier action=validate` で22項目の段階的チェック:
207
+
208
+ - 必須セクション(Goal、Functional Requirements 等)の存在
209
+ - サイズ別最小FR数(S: 1+, M: 3+, L: 5+)
210
+ - トレーサビリティ完全性(全FR→タスク、全タスク→FRの双方向)
211
+ - confidence + grounding annotation の存在
212
+ - Closing Wave の存在
213
+ - Grounding coverage — opt-in: speculative が30%超で失敗(L/XL)
214
+ - Delta spec品質 — Files Affected に CHG-N ID、Before/After セクションの実質的内容
215
+
216
+ ## Steering 文書
217
+
218
+ プロジェクトレベルのコンテキストを全仕様に注入:
219
+
220
+ ```bash
221
+ /alfred:init
222
+ ```
223
+
224
+ `.alfred/steering/` に作成:
225
+ - `product.md` — プロジェクトの目的、対象ユーザー、ビジネスルール
226
+ - `structure.md` — パッケージ構成、モジュール境界、命名規約
227
+ - `tech.md` — 技術スタック、依存関係、API規約
228
+
229
+ `dossier init` 時に読み込まれ、コンテキストとして注入。仕様は常にプロジェクトを理解している。
230
+
231
+ ## 仕組み
232
+
233
+ ```
234
+ あなた
235
+ |
236
+ |-- /alfred:brief -> 仕様 + 3エージェント議論 + ダッシュボード承認
237
+ |-- /alfred:attend -> 全自動: 仕様 → 承認 → 実装 → レビュー → コミット
238
+ |-- /alfred:mend -> 再現 → 原因分析(+過去バグ記憶)→ 修正 → 検証
239
+ |
240
+ v
241
+ Hook(見えない)
242
+ |-- SessionStart -> コンテキスト復元、プロジェクト成熟度に適応
243
+ |-- PreCompact -> 決定をMarkdown保存、チャプターメモリ、エピック進捗
244
+ |-- UserPromptSubmit -> ベクトル検索 + FTS5 + ファイルブースト → メモリ注入
245
+ |-- PostToolUse -> エラー検出 → 関連する過去の修正を提示
246
+ |
247
+ v
248
+ ストレージ
249
+ |-- .alfred/knowledge/ -> Markdown+frontmatter(真のソース、Git フレンドリー)
250
+ |-- .alfred/specs/ -> 仕様ファイル + バージョン履歴 + レビュー
251
+ |-- .alfred/epics/ -> エピック YAML + タスク依存関係
252
+ |-- .alfred/steering/ -> プロジェクトコンテキスト(product, structure, tech)
253
+ |-- .alfred/templates/ -> ユーザーカスタマイズ可能な仕様・Steeringテンプレート
254
+ +-- ~/.claude-alfred/ -> SQLite検索インデックス(knowledge_index + FTS5 + embeddings, スキーマ V8)
255
+ ```
256
+
257
+ ## ファイル生成タイミング
258
+
259
+ インストール時には何も生成されない。使うと出てくる:
260
+
261
+ | ファイル / ディレクトリ | 生成タイミング | トリガー |
262
+ |---|---|---|
263
+ | `~/.claude-alfred/alfred.db` | プラグインインストール後の最初の Claude Code セッション | SessionStart hook が DB を開く |
264
+ | `.alfred/knowledge/` | 最初のナレッジ保存時(decision, pattern, rule) | `ledger action=save`、PreCompact 決定抽出、spec complete |
265
+ | `.alfred/specs/` | 最初のタスク開始時 | `dossier action=init`(`/alfred:brief` や `/alfred:attend` 経由) |
266
+ | `.alfred/epics/` | 最初のエピック作成時 | `roster action=init` |
267
+ | `.alfred/steering/` | `/alfred:init` 実行時 | プロジェクト初期化スキル |
268
+ | `.alfred/templates/` | ユーザーが仕様・Steeringテンプレートをカスタマイズする時 | テンプレートオーバーライド用に手動作成 |
269
+ | `.alfred/audit.jsonl` | 最初の仕様操作時またはコミット後ドリフト検出時 | `dossier init`、レビュー送信、PostToolUse ドリフト |
270
+
271
+ ## トラブルシューティング
272
+
273
+ | 症状 | 対処 |
274
+ |------|------|
275
+ | メモリ検索で結果が出ない | `export VOYAGE_API_KEY=your-key` — またはFTS5フォールバックの動作確認 |
276
+ | 出力が意図しない言語 | `export ALFRED_LANG=ja`(または `en`, `zh`, `ko` 等)を `~/.zshrc` に追加 |
277
+ | Hook が動かない | `/plugin install alfred` して再起動 |
278
+ | ダッシュボードが空 | `.alfred/specs/` があるディレクトリで `alfred dash` |
279
+ | レート制限エラー | 対策済み — エージェントは段階的バッチ起動(最大2並列) |
280
+
281
+ ## ライセンス
282
+
283
+ MIT
package/README.md ADDED
@@ -0,0 +1,283 @@
1
+ # alfred
2
+
3
+ [![Version](https://img.shields.io/npm/v/claude-alfred)](https://www.npmjs.com/package/claude-alfred)
4
+ [![Node](https://img.shields.io/badge/node-%3E%3D22-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
5
+ [![MIT License](https://img.shields.io/github/license/hir4ta/claude-alfred)](https://github.com/hir4ta/claude-alfred/blob/main/LICENSE)
6
+
7
+ Your development butler for Claude Code.
8
+
9
+ [Japanese README](README.ja.md)
10
+
11
+ ## The problem
12
+
13
+ You're building with Claude Code. It's fast, it's smart, but:
14
+
15
+ - **It forgets.** Every compact, every new session — gone. That auth decision you spent 20 minutes debating? Ask again.
16
+ - **It wings it.** No spec, no plan. Just vibes. Works until it doesn't.
17
+ - **Nobody reviews.** The code ships without a second pair of eyes. You catch the bug in production.
18
+
19
+ alfred fixes all three.
20
+
21
+ ## What it does
22
+
23
+ **Specs that survive.** Requirements, design, decisions, session state — structured markdown files that persist across compacts, sessions, and even project restarts. Your context is never lost.
24
+
25
+ **Specs that adapt.** Small bug? 3 files. Medium feature? 5. Large system? All 7. alfred auto-detects the right scope — or you can pick a bugfix template with surgical precision (reproduction steps, root cause, fix strategy).
26
+
27
+ **Memory that compounds.** Every decision, every bug fix, every "we tried X and it didn't work" gets stored as Markdown files in `.alfred/knowledge/` — git-friendly, human-readable, team-shareable. A SQLite search index provides semantic search across all knowledge. Contradictions are detected automatically. Next time you hit a similar problem, alfred surfaces the relevant experience — before you even ask.
28
+
29
+ **Reliability signals.** Every spec item gets a grounding level — `verified`, `reviewed`, `inferred`, or `speculative`. You can instantly see which requirements are battle-tested and which are guesswork. Typos in grounding values get caught, not silently ignored.
30
+
31
+ **Brownfield-ready.** Delta specs for existing code changes get `CHG-N` change IDs and Before/After behavioral diffs. Not just "what file changed" but "what behavior changed and why." Three new validation checks enforce delta quality.
32
+
33
+ **Specs that don't drift.** After every commit, alfred compares what changed against your spec. Modified a component not in the design? Warning. Convention in memory no longer matches code? Flagged. No other tool does this.
34
+
35
+ **Reviews that scale.** Six review profiles (code, config, security, docs, architecture, testing), each with a curated checklist. Parallel agents, scored reports, actionable findings.
36
+
37
+ **Proactive skill suggestions.** alfred doesn't wait to be asked. It detects what you're doing — researching, designing, implementing, fixing bugs — and suggests the right skill at the right time. Explored code for a while? "Try `/alfred:survey`." Got research findings? "Save them with `ledger`." Three tasks piling up? "Group them with `roster`."
38
+
39
+ **Approval gates that can't be bypassed.** Specs go through a review cycle before implementation. Comment on any line in the browser dashboard, approve or request changes — like a GitHub PR review, but for your specs. The gate verifies both the review status *and* the existence of a signed review file, so manually editing the status won't get you past it.
40
+
41
+ **Project context that sticks.** Steering documents (product purpose, code structure, tech stack) are auto-generated from your project and injected into every spec. Your AI always knows your architecture.
42
+
43
+ ## Quick start
44
+
45
+ ### 1. Install
46
+
47
+ ```bash
48
+ npm install -g claude-alfred
49
+ ```
50
+
51
+ This automatically sets up the SQLite database and user rules. Verify with:
52
+
53
+ ```bash
54
+ alfred doctor
55
+ ```
56
+
57
+ ### 2. Plugin
58
+
59
+ In Claude Code:
60
+
61
+ ```
62
+ /plugin marketplace add hir4ta/claude-alfred
63
+ /plugin install alfred
64
+ ```
65
+
66
+ ### 3. Environment
67
+
68
+ Add to `~/.zshrc` (or equivalent):
69
+
70
+ ```bash
71
+ export VOYAGE_API_KEY=your-key # enables semantic search (~$0.01/session)
72
+ export ALFRED_LANG=en # output language (en/ja/zh/ko/fr/de/es/pt...)
73
+ ```
74
+
75
+ No Voyage key? alfred still works — FTS5 full-text search handles the fallback.
76
+
77
+ ### 4. Project setup
78
+
79
+ In Claude Code, from your project root:
80
+
81
+ ```
82
+ /init ← select "alfred" when prompted
83
+ ```
84
+
85
+ This generates steering docs, templates, and indexes existing knowledge.
86
+
87
+ > **Note**: Use `/init` (short form) instead of `/alfred:init` — Claude Code's autocomplete may misroute the `alfred:` prefix to another skill. This applies to all alfred skills: prefer `/brief`, `/attend`, `/mend` etc.
88
+
89
+ ## Updating
90
+
91
+ Both need to be updated together:
92
+
93
+ ```bash
94
+ npm update -g claude-alfred # CLI, hooks, MCP server, dashboard
95
+ ```
96
+
97
+ ```
98
+ /plugin update alfred # skills, agents, rules (in Claude Code)
99
+ ```
100
+
101
+ Run `alfred doctor` to verify both are in sync.
102
+
103
+ ## Skills
104
+
105
+ | Skill | What it does |
106
+ |-------|-------------|
107
+ | `/alfred:brief` | Design a spec. 3 agents debate your architecture, then you approve it in the dashboard |
108
+ | `/alfred:attend` | Full autopilot. Spec, review, approve, implement, test, commit — no intervention |
109
+ | `/alfred:tdd` | Test-driven. Red, green, refactor — autonomous cycles with pattern memory |
110
+ | `/alfred:inspect` | Quality gate. 6 parallel review profiles, scored report |
111
+ | `/alfred:mend` | Bug fix. Reproduce, root-cause (with past bug recall), fix, verify, commit |
112
+ | `/alfred:survey` | Reverse-engineer specs from existing code, with confidence scores |
113
+ | `/alfred:salon` | Brainstorm. 3 specialists generate ideas in parallel, then debate |
114
+ | `/alfred:harvest` | Extract knowledge from PR review comments into permanent memory |
115
+ | `/alfred:furnish` | Create or polish a config file |
116
+ | `/alfred:quarters` | Project setup wizard |
117
+ | `/alfred:archive` | Ingest reference docs into searchable knowledge |
118
+ | `/alfred:concierge` | Quick reference |
119
+
120
+ ## MCP tools
121
+
122
+ | Tool | Purpose |
123
+ |------|---------|
124
+ | `dossier` | Spec lifecycle — init (with size/type), update, status, switch, complete, delete, history, rollback, review, validate |
125
+ | `roster` | Epic management — group tasks with dependencies, track progress |
126
+ | `ledger` | Knowledge — search, save (Markdown+frontmatter), promote, reflect, audit-conventions |
127
+
128
+ ## Hooks
129
+
130
+ Run automatically. You don't touch these.
131
+
132
+ | Event | What happens |
133
+ |-------|-------------|
134
+ | SessionStart | Restores spec context, ingests CLAUDE.md, adapts injection depth to project maturity, suggests `ledger reflect` when knowledge base needs attention |
135
+ | PreCompact | Extracts decisions, saves structured chapter memory (Markdown), syncs epic progress, detects research patterns and reminds to save knowledge |
136
+ | UserPromptSubmit | Semantic search + file context boost + **skill nudge** (detects intent → suggests the right skill) |
137
+ | PostToolUse | Detects Bash errors + searches memory for similar past fixes. After commits: spec drift detection. After 5+ Read/Grep: suggests `/alfred:survey` |
138
+
139
+ ## Browser dashboard
140
+
141
+ ```bash
142
+ alfred dashboard # opens browser at localhost:7575
143
+ alfred dashboard --port 8080 # custom port
144
+ alfred dashboard --url-only # print URL only
145
+ ```
146
+
147
+ | Tab | What you see |
148
+ |-----|-------------|
149
+ | **Overview** | Project health at a glance — task progress with validation badges, memory health (stale count, conflicts), confidence distribution across specs, epic progress, recent decisions |
150
+ | **Tasks** | Enriched task cards: current focus, next action, epic context, validation status. Drill into spec files. Switch to Review tab for inline comments |
151
+ | **Knowledge** | Browse all memories with sub-type tags. Semantic search (Voyage AI) with 300ms debounce. Local text filter. Toggle any memory on/off |
152
+ | **Activity** | Timeline of all operations. Filter by event type (init/complete/review). Epic drill-down with task status badges |
153
+
154
+ Inline review mode: click any spec file, switch to Review tab. Comment on specific lines, navigate review rounds, approve or request changes — all in the browser.
155
+
156
+ The first unchecked task shimmers. You know exactly what's in progress.
157
+
158
+ For development: `ALFRED_DEV=1 alfred dashboard` + `task dev` (in web/) enables Vite HMR.
159
+
160
+ ## Search pipeline
161
+
162
+ alfred doesn't just do keyword matching. The search pipeline has three tiers:
163
+
164
+ 1. **Voyage AI vector search** + reranking (when API key is set)
165
+ 2. **FTS5 full-text search** with tag alias expansion and fuzzy matching
166
+ 3. **Keyword fallback** (LIKE queries)
167
+
168
+ Tag aliases expand your searches automatically: "auth" finds results tagged "authentication", "login", and "認証".
169
+
170
+ Fuzzy matching catches typos: "authetication" still finds "authentication".
171
+
172
+ ## Knowledge architecture
173
+
174
+ Knowledge is stored as Markdown files with YAML frontmatter — the source of truth lives in your project directory, not a binary database.
175
+
176
+ ```
177
+ .alfred/knowledge/
178
+ ├── decisions/dec-auth-jwt.md # design decisions
179
+ ├── patterns/pat-error-handling.md # reusable patterns
180
+ └── rules/rul-no-mock-db.md # enforced standards
181
+ ```
182
+
183
+ - **Git-friendly**: commit knowledge to share with your team, review in PRs
184
+ - **Human-readable**: `cat` any file to see exactly what alfred knows
185
+ - **Rebuildable**: the SQLite search index is derived from these files — delete the DB, it rebuilds on next session
186
+ - **Sub-type decay**: Assumptions decay in 30 days. Proven rules last 120 days. Each knowledge type has its own half-life.
187
+ - **Contradiction detection**: When two entries say opposite things ("use JWT" vs "avoid JWT"), alfred flags the conflict.
188
+ - **Project-aware**: knowledge is tagged with git remote URL and branch, enabling cross-project search.
189
+
190
+ ## Adaptive specs
191
+
192
+ Not every task needs 7 spec files.
193
+
194
+ | Size | Files generated | When |
195
+ |------|----------------|------|
196
+ | **S** (small) | 3: requirements, tasks, session | Bug fix, config change, small tweak |
197
+ | **M** (medium) | 5: + design, test-specs | New endpoint, refactor, moderate feature |
198
+ | **L/XL** (large) | 7: + decisions, research | Architecture change, new subsystem |
199
+ | **D** (delta) | 2: delta.md (with CHG-N IDs + Before/After), session | Brownfield changes to existing code |
200
+ | **Bugfix** | 3-4: bugfix.md, tasks, session (+ test-specs) | Surgical bug fix with reproduction steps |
201
+
202
+ Size auto-detected from description, or set explicitly: `dossier action=init size=S`.
203
+
204
+ ## Spec validation
205
+
206
+ `dossier action=validate` runs 22 progressive checks:
207
+
208
+ - Required sections present (Goal, Functional Requirements, etc.)
209
+ - Minimum FR count by size (S: 1+, M: 3+, L: 5+)
210
+ - Traceability completeness (every FR mapped to a task, every task referencing an FR)
211
+ - Confidence + grounding annotations on required sections
212
+ - Closing wave present in tasks
213
+ - Grounding coverage — opt-in check: fails when >30% of items are speculative (L/XL)
214
+ - Delta spec quality — CHG-N identifiers in Files Affected, Before/After section with content
215
+
216
+ ## Steering documents
217
+
218
+ Project-level context that gets injected into every spec:
219
+
220
+ ```bash
221
+ /alfred:init
222
+ ```
223
+
224
+ Creates `.alfred/steering/` with:
225
+ - `product.md` — project purpose, target users, business rules
226
+ - `structure.md` — package layout, module boundaries, naming conventions
227
+ - `tech.md` — tech stack, dependencies, API conventions
228
+
229
+ These docs are read during `dossier init` and injected as context, so specs are always project-aware.
230
+
231
+ ## How it works
232
+
233
+ ```
234
+ You
235
+ |
236
+ |-- /alfred:brief -> specs + 3-agent debate + dashboard approval
237
+ |-- /alfred:attend -> full cycle: spec -> approve -> implement -> review -> commit
238
+ |-- /alfred:mend -> reproduce -> root cause (+ past bug memory) -> fix -> verify
239
+ |
240
+ v
241
+ Hooks (invisible)
242
+ |-- SessionStart -> restore context, adapt to project maturity
243
+ |-- PreCompact -> save decisions as JSON, chapter memory, epic progress
244
+ |-- UserPromptSubmit -> vector search + FTS5 + file boost -> inject memories
245
+ |-- PostToolUse -> detect errors -> surface related past fixes
246
+ |
247
+ v
248
+ Storage
249
+ |-- .alfred/knowledge/ -> Markdown+frontmatter (source of truth, git-friendly)
250
+ |-- .alfred/specs/ -> spec files + version history + reviews
251
+ |-- .alfred/epics/ -> epic YAML + task dependencies
252
+ |-- .alfred/steering/ -> project context (product, structure, tech)
253
+ |-- .alfred/templates/ -> user-customizable spec + steering templates
254
+ +-- ~/.claude-alfred/ -> SQLite search index (knowledge_index + FTS5 + embeddings, schema V8)
255
+ ```
256
+
257
+ ## When files are created
258
+
259
+ Nothing is generated at install time. Files appear as you use alfred:
260
+
261
+ | File / Directory | Created when | Trigger |
262
+ |---|---|---|
263
+ | `~/.claude-alfred/alfred.db` | First Claude Code session after plugin install | SessionStart hook opens the database |
264
+ | `.alfred/knowledge/` | First knowledge save (decision, pattern, rule) | `ledger action=save`, PreCompact decision extraction, spec complete |
265
+ | `.alfred/specs/` | First task is started | `dossier action=init` (via `/alfred:brief`, `/alfred:attend`, etc.) |
266
+ | `.alfred/epics/` | First epic is created | `roster action=init` |
267
+ | `.alfred/steering/` | Running `/alfred:init` | Project initialization skill |
268
+ | `.alfred/templates/` | User customizes spec or steering templates | Manual creation for template override |
269
+ | `.alfred/audit.jsonl` | First spec operation or commit drift detection | `dossier init`, `dossier delete`, review submission, PostToolUse drift |
270
+
271
+ ## Troubleshooting
272
+
273
+ | Symptom | Fix |
274
+ |---|---|
275
+ | No memory results | `export VOYAGE_API_KEY=your-key` — or check FTS5 fallback is working |
276
+ | Output in wrong language | `export ALFRED_LANG=ja` (or `en`, `zh`, `ko`, etc.) in `~/.zshrc` |
277
+ | Hook not firing | `/plugin install alfred` and restart |
278
+ | Dashboard empty | Run `alfred dash` from a project with `.alfred/specs/` |
279
+ | Rate limit errors | Already mitigated — agents spawn in staggered batches (max 2 parallel) |
280
+
281
+ ## License
282
+
283
+ MIT
@@ -0,0 +1,41 @@
1
+ {
2
+ "description": "Proactive hooks — auto-import, memory injection, spec session persistence",
3
+ "hooks": {
4
+ "PreCompact": [
5
+ {
6
+ "hooks": [
7
+ {
8
+ "command": "alfred hook PreCompact",
9
+ "statusMessage": "alfred: saving session state...",
10
+ "timeout": 10,
11
+ "type": "command"
12
+ }
13
+ ]
14
+ }
15
+ ],
16
+ "SessionStart": [
17
+ {
18
+ "hooks": [
19
+ {
20
+ "command": "alfred hook SessionStart",
21
+ "statusMessage": "alfred: restoring session context...",
22
+ "timeout": 5,
23
+ "type": "command"
24
+ }
25
+ ]
26
+ }
27
+ ],
28
+ "UserPromptSubmit": [
29
+ {
30
+ "hooks": [
31
+ {
32
+ "command": "alfred hook UserPromptSubmit",
33
+ "statusMessage": "alfred: searching memories...",
34
+ "timeout": 10,
35
+ "type": "command"
36
+ }
37
+ ]
38
+ }
39
+ ]
40
+ }
41
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "mcpServers": {
3
+ "alfred": {
4
+ "command": "alfred",
5
+ "args": ["serve"],
6
+ "env": {
7
+ "VOYAGE_API_KEY": "${VOYAGE_API_KEY}",
8
+ "ALFRED_LANG": "${ALFRED_LANG}"
9
+ }
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import { u as rootDir } from "./types-C3butmI8.mjs";
3
+ import { appendFileSync, mkdirSync } from "node:fs";
4
+ import { join } from "node:path";
5
+ //#region src/spec/audit.ts
6
+ function appendAudit(projectPath, entry) {
7
+ try {
8
+ const dir = rootDir(projectPath);
9
+ mkdirSync(dir, { recursive: true });
10
+ const line = JSON.stringify({
11
+ ...entry,
12
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
13
+ });
14
+ appendFileSync(join(dir, "audit.jsonl"), line + "\n");
15
+ } catch {}
16
+ }
17
+ //#endregion
18
+ export { appendAudit as t };