@tekmidian/pai 0.5.7 → 0.6.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.
- package/ARCHITECTURE.md +72 -1
- package/README.md +87 -1
- package/dist/{auto-route-BG6I_4B1.mjs → auto-route-C-DrW6BL.mjs} +3 -3
- package/dist/{auto-route-BG6I_4B1.mjs.map → auto-route-C-DrW6BL.mjs.map} +1 -1
- package/dist/cli/index.mjs +1482 -1628
- package/dist/cli/index.mjs.map +1 -1
- package/dist/clusters-JIDQW65f.mjs +201 -0
- package/dist/clusters-JIDQW65f.mjs.map +1 -0
- package/dist/{config-Cf92lGX_.mjs → config-BuhHWyOK.mjs} +21 -6
- package/dist/config-BuhHWyOK.mjs.map +1 -0
- package/dist/daemon/index.mjs +11 -8
- package/dist/daemon/index.mjs.map +1 -1
- package/dist/{daemon-2ND5WO2j.mjs → daemon-D3hYb5_C.mjs} +669 -218
- package/dist/daemon-D3hYb5_C.mjs.map +1 -0
- package/dist/daemon-mcp/index.mjs +4597 -4
- package/dist/daemon-mcp/index.mjs.map +1 -1
- package/dist/db-DdUperSl.mjs +110 -0
- package/dist/db-DdUperSl.mjs.map +1 -0
- package/dist/{detect-BU3Nx_2L.mjs → detect-CdaA48EI.mjs} +1 -1
- package/dist/{detect-BU3Nx_2L.mjs.map → detect-CdaA48EI.mjs.map} +1 -1
- package/dist/{detector-Bp-2SM3x.mjs → detector-jGBuYQJM.mjs} +2 -2
- package/dist/{detector-Bp-2SM3x.mjs.map → detector-jGBuYQJM.mjs.map} +1 -1
- package/dist/{factory-Bzcy70G9.mjs → factory-Ygqe_bVZ.mjs} +7 -5
- package/dist/{factory-Bzcy70G9.mjs.map → factory-Ygqe_bVZ.mjs.map} +1 -1
- package/dist/helpers-BEST-4Gx.mjs +420 -0
- package/dist/helpers-BEST-4Gx.mjs.map +1 -0
- package/dist/hooks/capture-all-events.mjs +2 -2
- package/dist/hooks/capture-all-events.mjs.map +3 -3
- package/dist/hooks/capture-session-summary.mjs +38 -0
- package/dist/hooks/capture-session-summary.mjs.map +3 -3
- package/dist/hooks/cleanup-session-files.mjs +6 -12
- package/dist/hooks/cleanup-session-files.mjs.map +4 -4
- package/dist/hooks/context-compression-hook.mjs +93 -104
- package/dist/hooks/context-compression-hook.mjs.map +4 -4
- package/dist/hooks/initialize-session.mjs +14 -11
- package/dist/hooks/initialize-session.mjs.map +4 -4
- package/dist/hooks/inject-observations.mjs +220 -0
- package/dist/hooks/inject-observations.mjs.map +7 -0
- package/dist/hooks/load-core-context.mjs +2 -2
- package/dist/hooks/load-core-context.mjs.map +3 -3
- package/dist/hooks/load-project-context.mjs +90 -91
- package/dist/hooks/load-project-context.mjs.map +4 -4
- package/dist/hooks/observe.mjs +354 -0
- package/dist/hooks/observe.mjs.map +7 -0
- package/dist/hooks/stop-hook.mjs +94 -107
- package/dist/hooks/stop-hook.mjs.map +4 -4
- package/dist/hooks/sync-todo-to-md.mjs +31 -33
- package/dist/hooks/sync-todo-to-md.mjs.map +4 -4
- package/dist/index.d.mts +30 -7
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -8
- package/dist/indexer-D53l5d1U.mjs +1 -0
- package/dist/{indexer-backend-CIMXedqk.mjs → indexer-backend-jcJFsmB4.mjs} +37 -127
- package/dist/indexer-backend-jcJFsmB4.mjs.map +1 -0
- package/dist/{ipc-client-Bjg_a1dc.mjs → ipc-client-CoyUHPod.mjs} +2 -7
- package/dist/{ipc-client-Bjg_a1dc.mjs.map → ipc-client-CoyUHPod.mjs.map} +1 -1
- package/dist/latent-ideas-bTJo6Omd.mjs +191 -0
- package/dist/latent-ideas-bTJo6Omd.mjs.map +1 -0
- package/dist/neighborhood-BYYbEkUJ.mjs +135 -0
- package/dist/neighborhood-BYYbEkUJ.mjs.map +1 -0
- package/dist/note-context-BK24bX8Y.mjs +126 -0
- package/dist/note-context-BK24bX8Y.mjs.map +1 -0
- package/dist/postgres-CKf-EDtS.mjs +846 -0
- package/dist/postgres-CKf-EDtS.mjs.map +1 -0
- package/dist/{reranker-D7bRAHi6.mjs → reranker-CMNZcfVx.mjs} +1 -1
- package/dist/{reranker-D7bRAHi6.mjs.map → reranker-CMNZcfVx.mjs.map} +1 -1
- package/dist/{search-_oHfguA5.mjs → search-DC1qhkKn.mjs} +2 -58
- package/dist/search-DC1qhkKn.mjs.map +1 -0
- package/dist/{sqlite-WWBq7_2C.mjs → sqlite-l-s9xPjY.mjs} +160 -3
- package/dist/sqlite-l-s9xPjY.mjs.map +1 -0
- package/dist/state-C6_vqz7w.mjs +102 -0
- package/dist/state-C6_vqz7w.mjs.map +1 -0
- package/dist/stop-words-BaMEGVeY.mjs +326 -0
- package/dist/stop-words-BaMEGVeY.mjs.map +1 -0
- package/dist/{indexer-CMPOiY1r.mjs → sync-BOsnEj2-.mjs} +14 -216
- package/dist/sync-BOsnEj2-.mjs.map +1 -0
- package/dist/themes-BvYF0W8T.mjs +148 -0
- package/dist/themes-BvYF0W8T.mjs.map +1 -0
- package/dist/{tools-DV_lsiCc.mjs → tools-DcaJlYDN.mjs} +162 -273
- package/dist/tools-DcaJlYDN.mjs.map +1 -0
- package/dist/trace-CRx9lPuc.mjs +137 -0
- package/dist/trace-CRx9lPuc.mjs.map +1 -0
- package/dist/{vault-indexer-k-kUlaZ-.mjs → vault-indexer-Bi2cRmn7.mjs} +134 -132
- package/dist/vault-indexer-Bi2cRmn7.mjs.map +1 -0
- package/dist/zettelkasten-cdajbnPr.mjs +708 -0
- package/dist/zettelkasten-cdajbnPr.mjs.map +1 -0
- package/package.json +1 -2
- package/src/hooks/ts/lib/project-utils/index.ts +50 -0
- package/src/hooks/ts/lib/project-utils/notify.ts +75 -0
- package/src/hooks/ts/lib/project-utils/paths.ts +218 -0
- package/src/hooks/ts/lib/project-utils/session-notes.ts +363 -0
- package/src/hooks/ts/lib/project-utils/todo.ts +178 -0
- package/src/hooks/ts/lib/project-utils/tokens.ts +39 -0
- package/src/hooks/ts/lib/project-utils.ts +40 -1018
- package/src/hooks/ts/post-tool-use/observe.ts +327 -0
- package/src/hooks/ts/session-end/capture-session-summary.ts +41 -0
- package/src/hooks/ts/session-start/inject-observations.ts +254 -0
- package/dist/chunker-CbnBe0s0.mjs +0 -191
- package/dist/chunker-CbnBe0s0.mjs.map +0 -1
- package/dist/config-Cf92lGX_.mjs.map +0 -1
- package/dist/daemon-2ND5WO2j.mjs.map +0 -1
- package/dist/db-Dp8VXIMR.mjs +0 -212
- package/dist/db-Dp8VXIMR.mjs.map +0 -1
- package/dist/indexer-CMPOiY1r.mjs.map +0 -1
- package/dist/indexer-backend-CIMXedqk.mjs.map +0 -1
- package/dist/mcp/index.d.mts +0 -1
- package/dist/mcp/index.mjs +0 -500
- package/dist/mcp/index.mjs.map +0 -1
- package/dist/postgres-FXrHDPcE.mjs +0 -358
- package/dist/postgres-FXrHDPcE.mjs.map +0 -1
- package/dist/schemas-BFIgGntb.mjs +0 -3405
- package/dist/schemas-BFIgGntb.mjs.map +0 -1
- package/dist/search-_oHfguA5.mjs.map +0 -1
- package/dist/sqlite-WWBq7_2C.mjs.map +0 -1
- package/dist/tools-DV_lsiCc.mjs.map +0 -1
- package/dist/vault-indexer-k-kUlaZ-.mjs.map +0 -1
- package/dist/zettelkasten-e-a4rW_6.mjs +0 -901
- package/dist/zettelkasten-e-a4rW_6.mjs.map +0 -1
- package/templates/README.md +0 -181
- package/templates/skills/CORE/Aesthetic.md +0 -333
- package/templates/skills/CORE/CONSTITUTION.md +0 -1502
- package/templates/skills/CORE/HistorySystem.md +0 -427
- package/templates/skills/CORE/HookSystem.md +0 -1082
- package/templates/skills/CORE/Prompting.md +0 -509
- package/templates/skills/CORE/ProsodyAgentTemplate.md +0 -53
- package/templates/skills/CORE/ProsodyGuide.md +0 -416
- package/templates/skills/CORE/SKILL.md +0 -741
- package/templates/skills/CORE/SkillSystem.md +0 -213
- package/templates/skills/CORE/TerminalTabs.md +0 -119
- package/templates/skills/CORE/VOICE.md +0 -106
- package/templates/skills/createskill-skill.template.md +0 -78
- package/templates/skills/history-system.template.md +0 -371
- package/templates/skills/hook-system.template.md +0 -913
- package/templates/skills/sessions-skill.template.md +0 -102
- package/templates/skills/skill-system.template.md +0 -214
- package/templates/skills/terminal-tabs.template.md +0 -120
- package/templates/templates.md +0 -20
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
# Universal Output Capture System (UOCS) - History System Documentation
|
|
2
|
-
|
|
3
|
-
**Location:** `${PAI_DIR}/History/`
|
|
4
|
-
**Purpose:** Automated documentation of ALL work performed by PAI and specialized agents
|
|
5
|
-
**Status:** ✅ FULLY OPERATIONAL
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Overview
|
|
10
|
-
|
|
11
|
-
The Universal Output Capture System (UOCS) is PAI's automatic memory - capturing every feature, bug fix, decision, learning, research, and session through hooks with **zero manual effort**.
|
|
12
|
-
|
|
13
|
-
**Core Principle:** Work normally, documentation handles itself.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Quick Reference
|
|
18
|
-
|
|
19
|
-
This file is the **complete reference** for the history system. All specifications, conventions, and usage patterns are documented below.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Directory Structure
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
${PAI_DIR}/History/
|
|
27
|
-
├── Sessions/YYYY-MM/ # Session summaries (SessionEnd hook)
|
|
28
|
-
├── Learnings/YYYY-MM/ # Problem-solving narratives (Stop hook + manual)
|
|
29
|
-
├── Research/YYYY-MM/ # Investigation reports (Researcher agents)
|
|
30
|
-
├── Decisions/YYYY-MM/ # Architectural decisions (Architect agent)
|
|
31
|
-
├── Execution/
|
|
32
|
-
│ ├── Features/YYYY-MM/ # Feature implementations (Engineer/Designer)
|
|
33
|
-
│ ├── Bugs/YYYY-MM/ # Bug fixes (Engineer)
|
|
34
|
-
│ └── Refactors/YYYY-MM/ # Code improvements (Engineer)
|
|
35
|
-
└── Raw-Outputs/YYYY-MM/ # JSONL logs (PostToolUse hook)
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
**Quick Decision Guide:**
|
|
39
|
-
- "What happened this session?" → `Sessions/`
|
|
40
|
-
- "What did we learn?" → `Learnings/`
|
|
41
|
-
- "What features were built?" → `Execution/Features/`
|
|
42
|
-
- "What broke and when?" → `Execution/Bugs/`
|
|
43
|
-
- "What was improved?" → `Execution/Refactors/`
|
|
44
|
-
- "Why this approach?" → `Decisions/`
|
|
45
|
-
- "What did we investigate?" → `Research/`
|
|
46
|
-
- "Raw execution logs?" → `Raw-Outputs/`
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## Project Session Storage
|
|
51
|
-
|
|
52
|
-
**Location:** `${PAI_DIR}/projects/{encoded-path}/`
|
|
53
|
-
|
|
54
|
-
Claude Code stores session transcripts per-project. PAI organizes these with a clean structure:
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
${PAI_DIR}/projects/{encoded-path}/
|
|
58
|
-
├── sessions/ # Session transcripts (auto-organized)
|
|
59
|
-
│ ├── {uuid}.jsonl # Main session transcripts
|
|
60
|
-
│ └── agent-*.jsonl # Subagent transcripts
|
|
61
|
-
├── Notes/ # Session notes (PAI extension)
|
|
62
|
-
│ └── NNNN_YYYY-MM-DD_desc.md
|
|
63
|
-
└── TODO.md # Project task tracking
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
**Path Encoding:** Directory paths are encoded by replacing `/` and `.` with `-`
|
|
67
|
-
- `/Users/john/Projects/myapp` → `-Users-john-Projects-myapp`
|
|
68
|
-
|
|
69
|
-
**Session File Lifecycle:**
|
|
70
|
-
1. **During session:** Claude Code writes `.jsonl` to project root
|
|
71
|
-
2. **On UserPromptSubmit:** `cleanup-session-files.ts` moves stray files from previous sessions
|
|
72
|
-
3. **On Stop:** `stop-hook.ts` moves current session files to `sessions/`
|
|
73
|
-
4. **On SessionStart:** `load-project-context.ts` creates structure and migrates any stragglers
|
|
74
|
-
|
|
75
|
-
**Key Files:**
|
|
76
|
-
- `{uuid}.jsonl` - Full conversation transcript with token usage
|
|
77
|
-
- `agent-*.jsonl` - Subagent (Task tool) transcripts
|
|
78
|
-
- `Notes/*.md` - Human-readable session summaries
|
|
79
|
-
- `TODO.md` - Synced from TodoWrite tool
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## File Naming Convention
|
|
84
|
-
|
|
85
|
-
**Unified format:**
|
|
86
|
-
```
|
|
87
|
-
YYYY-MM-DD-HHMMSS_[PROJECT]_[TYPE]_[HIERARCHY]_[DESCRIPTION].md
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
**Components:**
|
|
91
|
-
- **Timestamp:** `YYYY-MM-DD-HHMMSS` (PST) - Enables chronological sorting
|
|
92
|
-
- **Project:** Optional identifier (e.g., `dashboard`, `website`, `PAI`)
|
|
93
|
-
- **Type:** Mandatory classification
|
|
94
|
-
- `FEATURE` - New functionality
|
|
95
|
-
- `BUG` - Bug fix
|
|
96
|
-
- `REFACTOR` - Code improvement
|
|
97
|
-
- `RESEARCH` - Investigation
|
|
98
|
-
- `DECISION` - Architectural decision
|
|
99
|
-
- `LEARNING` - Problem-solving narrative
|
|
100
|
-
- `SESSION` - Session summary
|
|
101
|
-
- **Hierarchy:** Optional Spec-Kit task number (e.g., `T1.2.3`)
|
|
102
|
-
- **Description:** Kebab-case, max 60 chars
|
|
103
|
-
|
|
104
|
-
**Examples:**
|
|
105
|
-
```
|
|
106
|
-
2025-10-13-140000_dashboard_FEATURE_T1.1_database-schema-setup.md
|
|
107
|
-
2025-10-13-153000_dashboard_BUG_T1.2_jwt-expiry-validation.md
|
|
108
|
-
2025-10-13-092000_PAI_DECISION_unified-capture-architecture.md
|
|
109
|
-
2025-10-13-083000_LEARNING_kitty-remote-control-api.md
|
|
110
|
-
2025-10-13-180000_SESSION_feature-implementation-day-1.md
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## Hook Integration
|
|
116
|
-
|
|
117
|
-
### 1. PostToolUse Hook
|
|
118
|
-
**Triggers:** Every tool execution (Bash, Edit, Write, Read, Task, etc.)
|
|
119
|
-
**Implementation:** `${PAI_DIR}/Hooks/capture-all-events.ts --event-type PostToolUse`
|
|
120
|
-
**Output:** Daily JSONL logs in `Raw-Outputs/YYYY-MM/YYYY-MM-DD_all-events.jsonl`
|
|
121
|
-
**Purpose:** Raw execution data for forensics and analytics
|
|
122
|
-
|
|
123
|
-
**Key Feature:** Completely generic - captures ENTIRE payload automatically
|
|
124
|
-
- **Future-proof**: New fields added to hooks (like `agent_id`, `agent_transcript_path` in v2.0.42) are automatically captured
|
|
125
|
-
- No code updates needed when Claude Code adds new fields
|
|
126
|
-
|
|
127
|
-
### 2. Stop Hook
|
|
128
|
-
**Triggers:** Main agent (PAI) task completion
|
|
129
|
-
**Implementation:** `${PAI_DIR}/Hooks/stop-hook.ts`
|
|
130
|
-
**Output:** Auto-captured files in `Learnings/` or `Sessions/` based on content
|
|
131
|
-
**Purpose:** Lightweight capture of work summaries and learning moments
|
|
132
|
-
|
|
133
|
-
**How it works:**
|
|
134
|
-
1. Extracts structured response format sections
|
|
135
|
-
2. Analyzes for learning indicators (problem, solved, discovered, fixed)
|
|
136
|
-
3. Categorizes as LEARNING (2+ indicators) or WORK (general session)
|
|
137
|
-
4. Generates appropriate filename and saves to history
|
|
138
|
-
|
|
139
|
-
### 3. SubagentStop Hook
|
|
140
|
-
**Triggers:** Specialized agent task completion
|
|
141
|
-
**Implementation:** `${PAI_DIR}/Hooks/subagent-stop-hook.ts`
|
|
142
|
-
**Output:** Categorized documents in appropriate directories
|
|
143
|
-
**Purpose:** Organized work documentation by agent type
|
|
144
|
-
|
|
145
|
-
**Categorization Logic:**
|
|
146
|
-
- Architect → `Decisions/` (DECISION)
|
|
147
|
-
- Engineer/Principal-Engineer → `Execution/Features|Bugs|Refactors/`
|
|
148
|
-
- Designer → `Execution/Features/` (FEATURE)
|
|
149
|
-
- Researchers (all types) → `Research/` (RESEARCH)
|
|
150
|
-
- Pentester → `Research/` (RESEARCH)
|
|
151
|
-
- Intern → `Research/` (mixed - defaults to RESEARCH)
|
|
152
|
-
|
|
153
|
-
**⚠️ Upgrade Note (v2.0.42):**
|
|
154
|
-
New fields available in SubagentStop hooks:
|
|
155
|
-
- `agent_id` - Unique agent instance identifier
|
|
156
|
-
- `agent_transcript_path` - Path to agent transcript
|
|
157
|
-
|
|
158
|
-
**Status:**
|
|
159
|
-
- ✅ `capture-all-events.ts` - Already capturing automatically (generic payload storage)
|
|
160
|
-
- ⚠️ `subagent-stop-hook.ts` - Should be updated to explicitly use new fields for better agent tracking
|
|
161
|
-
|
|
162
|
-
### 4. SessionEnd Hook
|
|
163
|
-
**Triggers:** Session exit (when you quit Claude Code)
|
|
164
|
-
**Implementation:** `${PAI_DIR}/Hooks/capture-session-summary.ts`
|
|
165
|
-
**Output:** Session summary in `Sessions/YYYY-MM/`
|
|
166
|
-
**Purpose:** High-level session documentation
|
|
167
|
-
|
|
168
|
-
### 5. SessionStart Hook
|
|
169
|
-
**Triggers:** Session initialization (when you start Claude Code)
|
|
170
|
-
**Implementation:** `${PAI_DIR}/Hooks/initialize-kai-session.ts`
|
|
171
|
-
**Purpose:** Load core context and prepare session environment
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## Custom Slash Commands
|
|
176
|
-
|
|
177
|
-
### /search-history [query]
|
|
178
|
-
**Purpose:** Full-text search across all history
|
|
179
|
-
**Example:** `/search-history authentication bug`
|
|
180
|
-
**Implementation:** Uses ripgrep with context lines
|
|
181
|
-
|
|
182
|
-
### /show-project-history [project]
|
|
183
|
-
**Purpose:** Chronological timeline for project
|
|
184
|
-
**Example:** `/show-project-history dashboard`
|
|
185
|
-
**Output:** Most recent 30 files for project
|
|
186
|
-
|
|
187
|
-
### /trace-feature [task-number]
|
|
188
|
-
**Purpose:** Complete implementation history for task
|
|
189
|
-
**Example:** `/trace-feature T1.2`
|
|
190
|
-
**Output:** Features, bugs, refactors related to task
|
|
191
|
-
|
|
192
|
-
### /bug-timeline [feature]
|
|
193
|
-
**Purpose:** Bug introduction and fix timeline
|
|
194
|
-
**Example:** `/bug-timeline authentication`
|
|
195
|
-
**Output:** Chronological list of related bugs
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
## Integration with Spec-Kit
|
|
200
|
-
|
|
201
|
-
**Spec-Kit** (`.specify/`) = PLAN (what to do)
|
|
202
|
-
**UOCS** (`History/`) = REALITY (what was done)
|
|
203
|
-
|
|
204
|
-
### Bidirectional Traceability
|
|
205
|
-
|
|
206
|
-
**From Spec to History:**
|
|
207
|
-
```
|
|
208
|
-
.specify/specs/001-auth/tasks.md
|
|
209
|
-
└─ T005 [US1] Implement login endpoint
|
|
210
|
-
|
|
211
|
-
History/Execution/Features/2025-10/
|
|
212
|
-
└─ 2025-10-13-140000_myapp_FEATURE_T005_login-endpoint.md
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
**From Bug to Feature:**
|
|
216
|
-
```
|
|
217
|
-
History/Execution/Features/2025-10/
|
|
218
|
-
└─ 2025-10-13-140000_myapp_FEATURE_T1.2_user-model.md
|
|
219
|
-
↓ (bug introduced here)
|
|
220
|
-
History/Execution/Bugs/2025-10/
|
|
221
|
-
└─ 2025-10-13-153000_myapp_BUG_T1.2_unique-constraint.md
|
|
222
|
-
(metadata: bug_introduced_by: T1.2)
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
---
|
|
226
|
-
|
|
227
|
-
## Metadata Schema
|
|
228
|
-
|
|
229
|
-
Every capture file includes YAML frontmatter:
|
|
230
|
-
|
|
231
|
-
```yaml
|
|
232
|
-
---
|
|
233
|
-
# Core classification
|
|
234
|
-
capture_type: FEATURE|BUG|REFACTOR|RESEARCH|DECISION|LEARNING|SESSION
|
|
235
|
-
timestamp: 2025-10-13T14:30:22-07:00
|
|
236
|
-
duration_minutes: 45
|
|
237
|
-
|
|
238
|
-
# Context
|
|
239
|
-
project: dashboard
|
|
240
|
-
executor: kai|architect|engineer|designer|researcher
|
|
241
|
-
session_id: uuid
|
|
242
|
-
|
|
243
|
-
# Development tracking (when applicable)
|
|
244
|
-
hierarchy: T1.2.3
|
|
245
|
-
spec_kit_feature: 001-user-authentication
|
|
246
|
-
spec_kit_task: T005
|
|
247
|
-
user_story: US1
|
|
248
|
-
phase: 2
|
|
249
|
-
|
|
250
|
-
# Technical details
|
|
251
|
-
files_changed:
|
|
252
|
-
- path/to/file.ts
|
|
253
|
-
technologies:
|
|
254
|
-
- TypeScript
|
|
255
|
-
- Vitest
|
|
256
|
-
|
|
257
|
-
# Outcomes
|
|
258
|
-
status: completed|blocked|partial
|
|
259
|
-
tests_added: 12
|
|
260
|
-
tests_passing: 12
|
|
261
|
-
coverage_change: +5.2%
|
|
262
|
-
|
|
263
|
-
# Bug tracking (for bugs only)
|
|
264
|
-
bug_severity: critical|high|medium|low
|
|
265
|
-
bug_introduced_by: T1.1
|
|
266
|
-
|
|
267
|
-
# Relationships
|
|
268
|
-
related_to:
|
|
269
|
-
- other-capture-file.md
|
|
270
|
-
depends_on:
|
|
271
|
-
- prerequisite-file.md
|
|
272
|
-
|
|
273
|
-
# Searchability
|
|
274
|
-
tags:
|
|
275
|
-
- authentication
|
|
276
|
-
keywords:
|
|
277
|
-
- user model
|
|
278
|
-
---
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
---
|
|
282
|
-
|
|
283
|
-
## Common Usage Patterns
|
|
284
|
-
|
|
285
|
-
### Before Starting Work
|
|
286
|
-
|
|
287
|
-
```bash
|
|
288
|
-
# Has this been done before?
|
|
289
|
-
/search-history [feature-name]
|
|
290
|
-
|
|
291
|
-
# How did we build similar features?
|
|
292
|
-
/trace-feature T1
|
|
293
|
-
|
|
294
|
-
# What decisions were made about this?
|
|
295
|
-
ls ${PAI_DIR}/History/Decisions/*/[project]_*
|
|
296
|
-
|
|
297
|
-
# What did we learn about this domain?
|
|
298
|
-
/search-history [domain-term]
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
### During Development
|
|
302
|
-
|
|
303
|
-
**No action required** - work normally, everything captured automatically.
|
|
304
|
-
|
|
305
|
-
### After Encountering Issues
|
|
306
|
-
|
|
307
|
-
```bash
|
|
308
|
-
# When did this break?
|
|
309
|
-
/bug-timeline [feature-name]
|
|
310
|
-
|
|
311
|
-
# Complete history of this feature
|
|
312
|
-
/trace-feature T1.2.3
|
|
313
|
-
|
|
314
|
-
# What similar bugs have we fixed?
|
|
315
|
-
/search-history "[bug description]"
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
### Periodic Review
|
|
319
|
-
|
|
320
|
-
```bash
|
|
321
|
-
# What did we accomplish this week?
|
|
322
|
-
ls -lt ${PAI_DIR}/History/Sessions/2025-10/ | head -7
|
|
323
|
-
|
|
324
|
-
# All decisions made this month
|
|
325
|
-
ls ${PAI_DIR}/History/Decisions/2025-10/
|
|
326
|
-
|
|
327
|
-
# Learnings from this quarter
|
|
328
|
-
ls ${PAI_DIR}/History/Learnings/2025-{10,11,12}/
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
---
|
|
332
|
-
|
|
333
|
-
## Advanced Queries
|
|
334
|
-
|
|
335
|
-
### Find all features for project
|
|
336
|
-
```bash
|
|
337
|
-
find ${PAI_DIR}/History/Execution/Features -name "*_dashboard_*"
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
### Find bugs introduced in specific task
|
|
341
|
-
```bash
|
|
342
|
-
rg "bug_introduced_by: T1.2" ${PAI_DIR}/History/Execution/Bugs/
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
### Find all work from specific date
|
|
346
|
-
```bash
|
|
347
|
-
find ${PAI_DIR}/History -name "2025-10-13-*"
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
### Analyze tool usage patterns
|
|
351
|
-
```bash
|
|
352
|
-
cat ${PAI_DIR}/History/Raw-Outputs/2025-10/*.jsonl | \
|
|
353
|
-
jq -r '.tool' | sort | uniq -c | sort -rn
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
### Extract all architectural decisions
|
|
357
|
-
```bash
|
|
358
|
-
find ${PAI_DIR}/History/Decisions -name "*.md" | \
|
|
359
|
-
xargs grep -l "Alternatives considered"
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
---
|
|
363
|
-
|
|
364
|
-
## Benefits
|
|
365
|
-
|
|
366
|
-
- ✅ **Root Cause Analysis** - "When did we break this?" instantly answerable
|
|
367
|
-
- ✅ **Decision Tracking** - Every architectural choice preserved with rationale
|
|
368
|
-
- ✅ **Learning Accumulation** - Problem-solving patterns captured and queryable
|
|
369
|
-
- ✅ **Process Improvement** - Complete history enables identifying bottlenecks
|
|
370
|
-
- ✅ **Knowledge Harvesting** - Past solutions easily found and reused
|
|
371
|
-
- ✅ **Zero Overhead** - Completely automated capture
|
|
372
|
-
- ✅ **Spec-Kit Integration** - Bidirectional traceability (plan ↔ execution)
|
|
373
|
-
|
|
374
|
-
---
|
|
375
|
-
|
|
376
|
-
## Maintenance
|
|
377
|
-
|
|
378
|
-
### Automated (No Action Required)
|
|
379
|
-
- Hooks capture all work automatically
|
|
380
|
-
- Files created with proper naming
|
|
381
|
-
- Metadata populated by hooks
|
|
382
|
-
- Categorization handled by hook logic
|
|
383
|
-
|
|
384
|
-
### Manual (Periodic)
|
|
385
|
-
|
|
386
|
-
**Monthly:**
|
|
387
|
-
- Review directory sizes
|
|
388
|
-
- Archive older months if getting large (>1000 files/month)
|
|
389
|
-
- Validate hook functionality
|
|
390
|
-
|
|
391
|
-
**Quarterly:**
|
|
392
|
-
- Extract common learnings into best practices
|
|
393
|
-
- Analyze bug patterns for process improvements
|
|
394
|
-
- Review categorization accuracy
|
|
395
|
-
|
|
396
|
-
---
|
|
397
|
-
|
|
398
|
-
## System Status
|
|
399
|
-
|
|
400
|
-
**Status:** ✅ FULLY OPERATIONAL
|
|
401
|
-
**Hooks Active:**
|
|
402
|
-
- ✅ PostToolUse (capture-all-events.ts)
|
|
403
|
-
- ✅ Stop (stop-hook.ts)
|
|
404
|
-
- ✅ SubagentStop (subagent-stop-hook.ts)
|
|
405
|
-
- ✅ SessionEnd (capture-session-summary.ts)
|
|
406
|
-
- ✅ SessionStart (initialize-kai-session.ts)
|
|
407
|
-
|
|
408
|
-
**Commands:** ✅ All 4 slash commands available
|
|
409
|
-
**Integration:** ✅ Spec-Kit, Agent workflows
|
|
410
|
-
**Files Captured:** 52 migrated + ongoing auto-captures
|
|
411
|
-
|
|
412
|
-
---
|
|
413
|
-
|
|
414
|
-
## Routing Triggers
|
|
415
|
-
|
|
416
|
-
**Load this documentation when the user says:**
|
|
417
|
-
- "history system" or "UOCS"
|
|
418
|
-
- "how does capture work" or "automatic documentation"
|
|
419
|
-
- "where are sessions saved" or "history directory"
|
|
420
|
-
- "how to search history" or "find past work"
|
|
421
|
-
- "SubagentStop hook" or "capture hooks"
|
|
422
|
-
- "learning capture" or "session summaries"
|
|
423
|
-
- Questions about file organization in History/
|
|
424
|
-
|
|
425
|
-
---
|
|
426
|
-
|
|
427
|
-
**This is the memory of your AI infrastructure - it remembers everything so you don't have to.**
|