@stackmemoryai/stackmemory 1.5.2 → 1.5.4

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.
@@ -21,26 +21,26 @@ docs/ # Documentation
21
21
 
22
22
  ## Key Files
23
23
 
24
- - Entry: src/cli/index.ts
25
- - MCP Server: src/integrations/mcp/server.ts
26
- - Frame Manager: src/core/context/frame-manager.ts
27
- - Database: src/core/database/sqlite-adapter.ts
28
-
29
- ## Detailed Guides
30
-
31
- Quick reference (agent_docs/):
32
- - linear_integration.md - Linear sync
33
- - mcp_server.md - MCP tools
34
- - database_storage.md - Storage
35
- - claude_hooks.md - Hooks
36
-
37
- Full documentation (docs/):
38
- - principles.md - Agent programming paradigm
39
- - architecture.md - Extension model and browser sandbox
40
- - SPEC.md - Technical specification
41
- - API_REFERENCE.md - API docs
42
- - DEVELOPMENT.md - Dev guide
43
- - SETUP.md - Installation
24
+ - Entry: `src/cli/index.ts`
25
+ - MCP Server: `src/integrations/mcp/server.ts`
26
+ - Frame Manager: `src/core/context/frame-manager.ts`
27
+ - Database: `src/core/database/sqlite-adapter.ts`
28
+
29
+ ## Reference Docs
30
+
31
+ `agent_docs/` (quick reference):
32
+ - `linear_integration.md` Linear sync
33
+ - `mcp_server.md` MCP tools
34
+ - `database_storage.md` Storage
35
+ - `claude_hooks.md` Hooks
36
+
37
+ `docs/` (full documentation):
38
+ - `principles.md` Agent programming paradigm
39
+ - `architecture.md` Extension model and browser sandbox
40
+ - `SPEC.md` Technical specification
41
+ - `API_REFERENCE.md` API docs
42
+ - `DEVELOPMENT.md` Dev guide
43
+ - `SETUP.md` Installation
44
44
 
45
45
  ## Commands
46
46
 
@@ -53,49 +53,53 @@ npm run test:run # Run tests once
53
53
  npm run linear:sync # Sync with Linear
54
54
 
55
55
  # StackMemory CLI
56
- stackmemory capture # Save session state for handoff
57
- stackmemory restore # Restore from captured state
56
+ stackmemory capture # Save session state for handoff
57
+ stackmemory restore # Restore from captured state
58
+ stackmemory snapshot save # Post-run context snapshot (alias: snap)
59
+ stackmemory snapshot list # List recent snapshots
60
+ stackmemory preflight # File overlap check for parallel tasks (alias: pf)
61
+ stackmemory conductor start # Autonomous Linear→worktree→agent orchestrator
58
62
  ```
59
63
 
60
64
  ## Working Directory
61
65
 
62
- - PRIMARY: /Users/jwu/Dev/stackmemory
66
+ - PRIMARY: `/Users/jwu/Dev/stackmemory`
63
67
  - ALLOWED: All subdirectories
64
- - TEMP: /tmp for temporary operations
68
+ - TEMP: `/tmp` for temporary operations
65
69
 
66
70
  ## Validation (MUST DO)
67
71
 
68
- After code changes:
69
- 1. `npm run lint` - fix any errors AND warnings
70
- 2. `npm run test:run` - verify no regressions
71
- 3. `npm run build` - ensure compilation
72
- 4. Run code to verify it works
72
+ Run these checks after every code change — in order:
73
73
 
74
- Test coverage:
74
+ 1. `npm run lint` — fix all errors and warnings
75
+ 2. `npm run test:run` — confirm no regressions
76
+ 3. `npm run build` — confirm compilation succeeds
77
+ 4. Execute the code and verify it works
78
+
79
+ Test coverage rules:
75
80
  - New features require tests in `src/**/__tests__/`
76
- - Maintain or improve coverage (no untested code paths)
81
+ - Maintain or improve coverage no untested code paths
77
82
  - Critical paths: context management, handoff, Linear sync
78
83
 
79
- Never: Assume success | Skip testing | Use mock data as fallback
84
+ **Never:** assume success | skip testing | use mock data as fallback
80
85
 
81
86
  ## Git Rules (CRITICAL)
82
87
 
83
- - NEVER use `--no-verify` on git push or commit
84
- - ALWAYS fix lint/test errors before pushing
85
- - If pre-push hooks fail, fix the underlying issue
86
- - Run `npm run lint && npm run test:run` before pushing
87
- - Commit message format: `type(scope): message`
88
- - Branch naming: `feature/STA-XXX-description` | `fix/STA-XXX-description` | `chore/description`
88
+ - NEVER use `--no-verify` on `git push` or `git commit`
89
+ - Fix lint/test errors before pushing — never bypass pre-push hooks
90
+ - Run `npm run lint && npm run test:run` before every push
91
+ - Commit format: `type(scope): message`
92
+ - Branch format: `feature/STA-XXX-description` | `fix/STA-XXX-description` | `chore/description`
89
93
 
90
94
  ## Task Management
91
95
 
92
- - Use TodoWrite for 3+ steps or multiple requests
93
- - Keep one task in_progress at a time
94
- - Update task status immediately on completion
96
+ - Use TodoWrite for 3+ steps or multiple concurrent requests
97
+ - Keep exactly one task `in_progress` at a time
98
+ - Update task status immediately when complete
95
99
 
96
100
  ## Security
97
101
 
98
- NEVER hardcode secrets - use process.env with dotenv/config
102
+ Never hardcode secrets always use `process.env` with `dotenv/config`:
99
103
 
100
104
  ```javascript
101
105
  import 'dotenv/config';
@@ -106,18 +110,18 @@ if (!API_KEY) {
106
110
  }
107
111
  ```
108
112
 
109
- Environment sources (check in order):
110
- 1. .env file
111
- 2. .env.local
112
- 3. ~/.zshrc
113
+ Check for API keys in this order:
114
+ 1. `.env`
115
+ 2. `.env.local`
116
+ 3. `~/.zshrc`
113
117
  4. Process environment
114
118
 
115
- Secret patterns to block: lin_api_* | lin_oauth_* | sk-* | npm_*
119
+ Block these secret patterns: `lin_api_*` | `lin_oauth_*` | `sk-*` | `npm_*`
116
120
 
117
121
  ## Deploy
118
122
 
119
123
  ```bash
120
- # npm publish (uses NPM_TOKEN from .env, no OTP needed)
124
+ # npm publish (NPM_TOKEN from .env no OTP required)
121
125
  git stash -- scripts/gepa/ # stash GEPA state (dirties working tree)
122
126
  NPM_TOKEN=$(grep '^NPM_TOKEN=' .env | cut -d= -f2) \
123
127
  npm publish --registry https://registry.npmjs.org/ \
@@ -127,14 +131,46 @@ git stash pop # restore GEPA state
127
131
  # Railway
128
132
  railway up
129
133
 
130
- # Pre-publish checks require clean git status — stash GEPA files first
134
+ # Pre-publish requires clean git status — always stash GEPA files first
131
135
  ```
132
136
 
137
+ ## Task Delegation Model
138
+
139
+ Match effort to task complexity:
140
+
141
+ **AUTOMATE** — Execute immediately; lint+test is sufficient:
142
+ - CRUD, boilerplate, formatting, simple transforms
143
+ - Adding a handler following an existing switch/case pattern
144
+ - Config additions (env var, feature flag)
145
+
146
+ **STANDARD** — Normal workflow; lint+test+build:
147
+ - Feature implementation, bug fixes, refactoring
148
+ - New tests, documentation updates
149
+ - Integration wiring (adding handler to `server.ts` dispatch)
150
+
151
+ **CAREFUL** — Review approach before writing code:
152
+ - API/schema changes, database migrations, auth flows
153
+ - New integration patterns (MCP tools, webhook handlers)
154
+ - Changes to `frame-manager`, `sqlite-adapter`, or daemon lifecycle
155
+ - Anything touching error handling chains
156
+
157
+ **ARCHITECT** — Require plan mode; explore existing patterns first:
158
+ - New service boundaries or system integrations
159
+ - Performance-critical paths (FTS5 queries, search scoring)
160
+ - Breaking changes to MCP protocol or CLI interface
161
+
162
+ **HUMAN** — Get explicit user approval before any changes:
163
+ - Security-critical decisions, secret handling
164
+ - Irreversible operations (data migrations, schema drops)
165
+ - Publishing (`npm publish`, Railway deploy)
166
+
167
+ Don't over-engineer AUTOMATE tasks. Don't under-review CAREFUL ones.
168
+
133
169
  ## Workflow
134
170
 
135
- - Check .env for API keys before asking
136
- - Run npm run linear:sync after task completion
171
+ - Check `.env` for API keys before asking the user
172
+ - Run `npm run linear:sync` after completing tasks
137
173
  - Use browser MCP for visual testing
138
- - Review recent commits and stackmemory.json on session start
174
+ - On session start: review recent commits and `stackmemory.json`
139
175
  - Use subagents for multi-step tasks
140
- - Ask 1-3 clarifying questions for complex commands (one at a time)
176
+ - Ask 13 clarifying questions for ambiguous requests (one at a time)
@@ -25,6 +25,10 @@ docs/ # Documentation
25
25
  - MCP Server: src/integrations/mcp/server.ts
26
26
  - Frame Manager: src/core/context/frame-manager.ts
27
27
  - Database: src/core/database/sqlite-adapter.ts
28
+ - Snapshot: src/core/worktree/capture.ts
29
+ - Preflight: src/core/worktree/preflight.ts
30
+ - Conductor: src/cli/commands/orchestrator.ts
31
+ - Shared Utils: src/core/utils/{git,text,fs}.ts
28
32
 
29
33
  ## Detailed Guides
30
34
 
@@ -55,6 +59,10 @@ npm run linear:sync # Sync with Linear
55
59
  # StackMemory CLI
56
60
  stackmemory capture # Save session state for handoff
57
61
  stackmemory restore # Restore from captured state
62
+ stackmemory snapshot save # Post-run context snapshot (alias: snap)
63
+ stackmemory snapshot list # List recent snapshots
64
+ stackmemory preflight # File overlap check for parallel tasks (alias: pf)
65
+ stackmemory conductor start # Autonomous Linear→worktree→agent orchestrator
58
66
  ```
59
67
 
60
68
  ## Working Directory
@@ -25,6 +25,10 @@ docs/ # Documentation
25
25
  - MCP Server: src/integrations/mcp/server.ts
26
26
  - Frame Manager: src/core/context/frame-manager.ts
27
27
  - Database: src/core/database/sqlite-adapter.ts
28
+ - Snapshot: src/core/worktree/capture.ts
29
+ - Preflight: src/core/worktree/preflight.ts
30
+ - Conductor: src/cli/commands/orchestrator.ts
31
+ - Shared Utils: src/core/utils/{git,text,fs}.ts
28
32
 
29
33
  ## Detailed Guides
30
34
 
@@ -55,6 +59,10 @@ npm run linear:sync # Sync with Linear
55
59
  # StackMemory CLI
56
60
  stackmemory capture # Save session state for handoff
57
61
  stackmemory restore # Restore from captured state
62
+ stackmemory snapshot save # Post-run context snapshot (alias: snap)
63
+ stackmemory snapshot list # List recent snapshots
64
+ stackmemory preflight # File overlap check for parallel tasks (alias: pf)
65
+ stackmemory conductor start # Autonomous Linear→worktree→agent orchestrator
58
66
  ```
59
67
 
60
68
  ## Working Directory
@@ -21,26 +21,30 @@ docs/ # Documentation
21
21
 
22
22
  ## Key Files
23
23
 
24
- - Entry: src/cli/index.ts
25
- - MCP Server: src/integrations/mcp/server.ts
26
- - Frame Manager: src/core/context/frame-manager.ts
27
- - Database: src/core/database/sqlite-adapter.ts
28
-
29
- ## Documentation
30
-
31
- Quick reference (agent_docs/):
32
- - linear_integration.md - Linear sync
33
- - mcp_server.md - MCP tools
34
- - database_storage.md - Storage
35
- - claude_hooks.md - Hooks
36
-
37
- Full docs (docs/):
38
- - principles.md - Agent programming paradigm
39
- - architecture.md - Extension model and browser sandbox
40
- - SPEC.md - Technical specification
41
- - API_REFERENCE.md - API docs
42
- - DEVELOPMENT.md - Dev guide
43
- - SETUP.md - Installation
24
+ - Entry: `src/cli/index.ts`
25
+ - MCP Server: `src/integrations/mcp/server.ts`
26
+ - Frame Manager: `src/core/context/frame-manager.ts`
27
+ - Database: `src/core/database/sqlite-adapter.ts`
28
+ - Snapshot: `src/core/worktree/capture.ts`
29
+ - Preflight: `src/core/worktree/preflight.ts`
30
+ - Conductor: `src/cli/commands/orchestrator.ts`
31
+ - Shared Utils: `src/core/utils/{git,text,fs}.ts`
32
+
33
+ ## Reference Docs
34
+
35
+ Quick reference (`agent_docs/`):
36
+ - `linear_integration.md` — Linear sync
37
+ - `mcp_server.md` — MCP tools
38
+ - `database_storage.md` Storage
39
+ - `claude_hooks.md` Hooks
40
+
41
+ Full docs (`docs/`):
42
+ - `principles.md` Agent programming paradigm
43
+ - `architecture.md` Extension model and browser sandbox
44
+ - `SPEC.md` — Technical specification
45
+ - `API_REFERENCE.md` — API docs
46
+ - `DEVELOPMENT.md` — Dev guide
47
+ - `SETUP.md` — Installation
44
48
 
45
49
  ## Commands
46
50
 
@@ -53,53 +57,51 @@ npm run test:run # Run tests once
53
57
  npm run linear:sync # Sync with Linear
54
58
 
55
59
  # StackMemory CLI
56
- stackmemory capture # Save session state for handoff
57
- stackmemory restore # Restore from captured state
60
+ stackmemory capture # Save session state for handoff
61
+ stackmemory restore # Restore from captured state
62
+ stackmemory snapshot save # Post-run context snapshot (alias: snap)
63
+ stackmemory snapshot list # List recent snapshots
64
+ stackmemory preflight # File overlap check for parallel tasks (alias: pf)
65
+ stackmemory conductor start # Autonomous Linear→worktree→agent orchestrator
58
66
  ```
59
67
 
60
68
  ## Working Directory
61
69
 
62
- - PRIMARY: /Users/jwu/Dev/stackmemory
70
+ - PRIMARY: `/Users/jwu/Dev/stackmemory`
63
71
  - ALLOWED: All subdirectories
64
- - TEMP: /tmp for temporary operations
72
+ - TEMP: `/tmp`
65
73
 
66
- ## Required Validation
74
+ ## Validation (REQUIRED after every code change)
67
75
 
68
- After every code change:
69
- 1. `npm run lint` - fix all errors AND warnings
70
- 2. `npm run test:run` - verify no regressions
71
- 3. `npm run build` - confirm compilation succeeds
72
- 4. Execute code to confirm functionality
76
+ 1. `npm run lint` — fix all errors and warnings
77
+ 2. `npm run test:run` confirm no regressions
78
+ 3. `npm run build` confirm compilation succeeds
79
+ 4. Run the code to verify behavior
73
80
 
74
- Test coverage requirements:
75
- - Write tests in `src/**/__tests__/` for all new features
76
- - Maintain or improve coverage - no untested code paths
77
- - Critical paths require tests: context management, handoff, Linear sync
81
+ Test coverage rules:
82
+ - New features require tests in `src/**/__tests__/`
83
+ - Maintain or improve coverage no untested code paths
84
+ - Critical paths: context management, handoff, Linear sync
78
85
 
79
- Do NOT: assume success | skip testing | use mock data as fallback
86
+ Do not: assume success | skip testing | use mock data as fallback
80
87
 
81
88
  ## Git Rules (CRITICAL)
82
89
 
83
- NEVER:
84
- - Use `--no-verify` on git push or commit
85
- - Push without fixing lint/test errors
86
- - Skip validation when pre-push hooks fail
87
-
88
- ALWAYS:
89
- - Fix underlying issues when hooks fail
90
- - Run `npm run lint && npm run test:run` before pushing
91
- - Use commit format: `type(scope): message`
92
- - Use branch naming: `feature/STA-XXX-description` | `fix/STA-XXX-description` | `chore/description`
90
+ - NEVER pass `--no-verify` to `git push` or `git commit`
91
+ - Fix lint/test errors before pushing — never bypass pre-push hooks
92
+ - Run `npm run lint && npm run test:run` before every push
93
+ - Commit format: `type(scope): message`
94
+ - Branch format: `feature/STA-XXX-description` | `fix/STA-XXX-description` | `chore/description`
93
95
 
94
96
  ## Task Management
95
97
 
96
- - Create TodoWrite for 3+ steps or multiple requests
97
- - Work on one task at a time (keep one in_progress)
98
- - Update task status immediately on completion
98
+ - Use TodoWrite for tasks with 3+ steps or multiple requests
99
+ - Keep exactly one task `in_progress` at a time
100
+ - Mark tasks complete immediately when done
99
101
 
100
102
  ## Security
101
103
 
102
- NEVER hardcode secrets. Use process.env with dotenv/config:
104
+ Never hardcode secrets. Always use `process.env` with dotenv:
103
105
 
104
106
  ```javascript
105
107
  import 'dotenv/config';
@@ -110,18 +112,18 @@ if (!API_KEY) {
110
112
  }
111
113
  ```
112
114
 
113
- Environment sources (check in order):
114
- 1. .env file
115
- 2. .env.local
116
- 3. ~/.zshrc
115
+ Check env sources in order:
116
+ 1. `.env`
117
+ 2. `.env.local`
118
+ 3. `~/.zshrc`
117
119
  4. Process environment
118
120
 
119
- Block secret patterns: lin_api_* | lin_oauth_* | sk-* | npm_*
121
+ Block these patterns: `lin_api_*` | `lin_oauth_*` | `sk-*` | `npm_*`
120
122
 
121
123
  ## Deploy
122
124
 
123
125
  ```bash
124
- # npm publish (uses NPM_TOKEN from .env, no OTP needed)
126
+ # npm publish (NPM_TOKEN from .env, no OTP required)
125
127
  git stash -- scripts/gepa/ # stash GEPA state (dirties working tree)
126
128
  NPM_TOKEN=$(grep '^NPM_TOKEN=' .env | cut -d= -f2) \
127
129
  npm publish --registry https://registry.npmjs.org/ \
@@ -131,46 +133,44 @@ git stash pop # restore GEPA state
131
133
  # Railway
132
134
  railway up
133
135
 
134
- # Pre-publish checks require clean git status — stash GEPA files first
136
+ # Note: pre-publish checks require clean git status — stash GEPA files first
135
137
  ```
136
138
 
137
139
  ## Task Delegation Model
138
140
 
139
- Match effort to complexity:
141
+ Match scrutiny to complexity:
140
142
 
141
- **AUTOMATE** — Execute immediately, lint+test only:
142
- - CRUD operations, boilerplate, formatting, simple transforms
143
- - Adding tool handler following existing switch/case pattern
144
- - Config additions (env var, feature flag)
143
+ **AUTOMATE** — Run immediately; lint+test is enough:
144
+ - CRUD, boilerplate, formatting, simple transforms
145
+ - Adding a tool handler to an existing switch/case
146
+ - Config additions (env vars, feature flags)
145
147
 
146
- **STANDARD** — Normal workflow, lint+test+build:
147
- - Feature implementation, bug fixes, refactoring
148
- - New test coverage, documentation updates
149
- - Integration wiring (adding handler to server.ts dispatch)
148
+ **STANDARD** — Normal workflow; lint+test+build:
149
+ - Feature work, bug fixes, refactoring
150
+ - New tests, doc updates
151
+ - Integration wiring (e.g., adding handler to `server.ts`)
150
152
 
151
- **CAREFUL** — Review approach before coding:
152
- - API/schema changes, database migrations, auth flows
153
- - New integration patterns (MCP tools, webhook handlers)
154
- - Changes to frame-manager, sqlite-adapter, daemon lifecycle
155
- - Error handling chain modifications
153
+ **CAREFUL** — Confirm approach before implementing:
154
+ - API/schema changes, DB migrations, auth flows
155
+ - New MCP tools or webhook handlers
156
+ - Changes to `frame-manager`, `sqlite-adapter`, or daemon lifecycle
157
+ - Any error handling chain modifications
156
158
 
157
- **ARCHITECT** — Plan mode required, explore patterns first:
158
- - New service boundaries, system integrations
159
+ **ARCHITECT** — Enter plan mode; read existing patterns first:
160
+ - New service boundaries or system integrations
159
161
  - Performance-critical paths (FTS5 queries, search scoring)
160
162
  - Breaking changes to MCP protocol or CLI interface
161
163
 
162
- **HUMAN** — Explicit user approval required:
163
- - Security-critical decisions, secret handling
164
+ **HUMAN** — Get explicit user approval before touching:
165
+ - Security decisions, secret handling
164
166
  - Irreversible operations (data migrations, schema drops)
165
- - Publishing (npm publish, Railway deploy)
166
-
167
- Scale quality gates to tier. Don't over-engineer AUTOMATE tasks or under-review CAREFUL ones.
167
+ - Publishing (`npm publish`, Railway deploy)
168
168
 
169
169
  ## Workflow
170
170
 
171
- - Check .env for API keys before asking user
172
- - Run `npm run linear:sync` after task completion
171
+ - Check `.env` for API keys before asking the user
172
+ - Run `npm run linear:sync` after completing tasks
173
173
  - Use browser MCP for visual testing
174
- - Review recent commits and stackmemory.json at session start
174
+ - On session start: review recent commits and `stackmemory.json`
175
175
  - Use subagents for multi-step tasks
176
- - Ask 1-3 clarifying questions for complex commands (one at a time)
176
+ - Ask at most 13 clarifying questions for complex requests, one at a time