@stackmemoryai/stackmemory 1.5.3 → 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.
@@ -1,3 +1,4 @@
1
+ ```markdown
1
2
  # StackMemory - Project Configuration
2
3
 
3
4
  ## Project Structure
@@ -5,7 +6,7 @@
5
6
  ```
6
7
  src/
7
8
  cli/ # CLI commands and entry point
8
- core/ # Core business logic
9
+ core/
9
10
  context/ # Frame and context management
10
11
  database/ # Database adapters (SQLite, ParadeDB)
11
12
  digest/ # Digest generation
@@ -15,78 +16,72 @@ src/
15
16
  skills/ # Claude Code skills
16
17
  utils/ # Shared utilities
17
18
  scripts/ # Build and utility scripts
18
- config/ # Configuration files
19
- docs/ # Documentation
20
19
  ```
21
20
 
22
21
  ## Key Files
23
22
 
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
23
+ - Entry: `src/cli/index.ts`
24
+ - MCP Server: `src/integrations/mcp/server.ts`
25
+ - Frame Manager: `src/core/context/frame-manager.ts`
26
+ - Database: `src/core/database/sqlite-adapter.ts`
27
+ - Snapshot: `src/core/worktree/capture.ts`
28
+ - Preflight: `src/core/worktree/preflight.ts`
29
+ - Conductor: `src/cli/commands/orchestrator.ts`
30
+ - Shared Utils: `src/core/utils/{git,text,fs}.ts`
28
31
 
29
- ## Documentation
32
+ ## Docs
30
33
 
31
- Quick reference (agent_docs/): linear_integration.md | mcp_server.md | database_storage.md | claude_hooks.md
32
-
33
- Full docs (docs/): principles.md | architecture.md | SPEC.md | API_REFERENCE.md | DEVELOPMENT.md | SETUP.md
34
+ - `agent_docs/`: linear_integration.md | mcp_server.md | database_storage.md | claude_hooks.md
35
+ - `docs/`: principles.md | architecture.md | SPEC.md | API_REFERENCE.md | DEVELOPMENT.md
34
36
 
35
37
  ## Commands
36
38
 
37
39
  ```bash
38
- npm run build|lint|lint:fix|test|test:run|linear:sync
39
- stackmemory capture|restore # Session state handoff
40
+ npm run build # Compile TypeScript (esbuild)
41
+ npm run lint # ESLint check
42
+ npm run lint:fix # Auto-fix lint issues
43
+ npm run test:run # Run tests once
44
+ npm run linear:sync # Sync with Linear
45
+
46
+ stackmemory capture # Save session state for handoff
47
+ stackmemory restore # Restore from captured state
48
+ stackmemory snapshot save # Post-run context snapshot (alias: snap)
49
+ stackmemory snapshot list # List recent snapshots
50
+ stackmemory preflight # File overlap check for parallel tasks (alias: pf)
51
+ stackmemory conductor start # Autonomous Linear→worktree→agent orchestrator
40
52
  ```
41
53
 
42
- ## Working Directory
43
-
44
- PRIMARY: /Users/jwu/Dev/stackmemory | ALLOWED: All subdirectories | TEMP: /tmp
45
-
46
54
  ## Validation (MUST DO)
47
55
 
48
- After code changes:
49
- 1. `npm run lint` - fix errors AND warnings
50
- 2. `npm run test:run` - verify no regressions
51
- 3. `npm run build` - ensure compilation
52
- 4. Run code to verify it works
56
+ After code changes: `npm run lint && npm run test:run && npm run build`
53
57
 
54
- Test coverage:
55
58
  - New features require tests in `src/**/__tests__/`
56
- - Maintain or improve coverage (no untested code paths)
59
+ - Maintain or improve coverage no untested code paths
57
60
  - Critical paths: context management, handoff, Linear sync
58
-
59
- Never: Assume success | Skip testing | Use mock data as fallback
61
+ - Never assume success | skip testing | use mock data as fallback
60
62
 
61
63
  ## Git Rules (CRITICAL)
62
64
 
63
- - NEVER use `--no-verify` on commit/push
64
- - ALWAYS fix lint/test errors before pushing
65
- - Run `npm run lint && npm run test:run` before pushing
66
- - Commit format: `type(scope): message`
67
- - Branch naming: `feature/STA-XXX-desc` | `fix/STA-XXX-desc` | `chore/desc`
65
+ - NEVER `--no-verify` on push or commit — fix the underlying issue
66
+ - Commit: `type(scope): message` | Branch: `feature/STA-XXX-description` | `fix/` | `chore/`
68
67
 
69
68
  ## Security
70
69
 
71
- NEVER hardcode secrets - use process.env with dotenv/config
70
+ NEVER hardcode secrets use `process.env` with dotenv/config.
72
71
 
73
72
  ```javascript
74
73
  import 'dotenv/config';
75
74
  const API_KEY = process.env.LINEAR_API_KEY;
76
- if (!API_KEY) {
77
- console.error('LINEAR_API_KEY not set');
78
- process.exit(1);
79
- }
75
+ if (!API_KEY) { console.error('LINEAR_API_KEY not set'); process.exit(1); }
80
76
  ```
81
77
 
82
- Environment sources (check in order): .env | .env.local | ~/.zshrc | process.env
83
-
84
- Secret patterns to block: lin_api_* | lin_oauth_* | sk-* | npm_*
78
+ Env sources (order): `.env` `.env.local` `~/.zshrc` process env
79
+ Block patterns: `lin_api_*` | `lin_oauth_*` | `sk-*` | `npm_*`
85
80
 
86
81
  ## Deploy
87
82
 
88
83
  ```bash
89
- # npm publish (uses NPM_TOKEN from .env)
84
+ # npm publish
90
85
  git stash -- scripts/gepa/
91
86
  NPM_TOKEN=$(grep '^NPM_TOKEN=' .env | cut -d= -f2) \
92
87
  npm publish --registry https://registry.npmjs.org/ \
@@ -95,48 +90,33 @@ git stash pop
95
90
 
96
91
  # Railway
97
92
  railway up
98
-
99
- # Pre-publish requires clean git — stash GEPA files first
100
93
  ```
101
94
 
102
- ## Task Delegation Model
103
-
104
- Route effort by complexity:
95
+ Pre-publish requires clean git status — stash GEPA files first.
105
96
 
106
- **AUTOMATE** Execute immediately, lint+test sufficient:
107
- - CRUD, boilerplate, formatting, simple transforms
108
- - Tool handler following existing pattern
109
- - Config additions (env var, feature flag)
97
+ ## Task Delegation Model
110
98
 
111
- **STANDARD** — Normal workflow, lint+test+build:
112
- - Features, bug fixes, refactoring
113
- - Tests, docs, integration wiring
99
+ **AUTOMATE** — lint+test sufficient:
100
+ - CRUD, boilerplate, config additions, simple switch/case handlers
114
101
 
115
- **CAREFUL** — Review approach before implementation:
116
- - API/schema changes, migrations, auth flows
117
- - New integration patterns (MCP, webhooks)
118
- - Changes to frame-manager, sqlite-adapter, daemon lifecycle
119
- - Error handling chains
102
+ **STANDARD** — lint+test+build:
103
+ - Feature impl, bug fixes, refactoring, new tests, integration wiring
120
104
 
121
- **ARCHITECT** — Plan mode required, explore patterns first:
122
- - New service boundaries, system integrations
123
- - Performance-critical paths (FTS5, search scoring)
124
- - Breaking changes to MCP protocol or CLI
105
+ **CAREFUL** — review approach first:
106
+ - API/schema changes, DB migrations, auth flows, MCP/webhook handlers
107
+ - Changes to frame-manager, sqlite-adapter, daemon lifecycle, error chains
125
108
 
126
- **HUMAN** — Explicit approval required:
127
- - Security decisions, secret handling
128
- - Irreversible operations (migrations, schema drops)
129
- - Publishing (npm, Railway)
109
+ **ARCHITECT** — plan mode required:
110
+ - New service boundaries, FTS5/search performance, breaking MCP/CLI changes
130
111
 
131
- Quality gates scale with tier don't over-engineer AUTOMATE, don't under-review CAREFUL.
112
+ **HUMAN**explicit approval required:
113
+ - Secret handling, data migrations/schema drops, npm publish, Railway deploy
132
114
 
133
115
  ## Workflow
134
116
 
135
- - Check .env for API keys before asking
136
- - Run npm run linear:sync after task completion
137
- - Use browser MCP for visual testing
138
- - Review recent commits and stackmemory.json on session start
139
- - Use TodoWrite for 3+ steps or multiple requests
140
- - Keep one task in_progress at a time
141
- - Update task status immediately on completion
142
- - Ask 1-3 clarifying questions for complex commands (one at a time)
117
+ - Check `.env` for API keys before asking
118
+ - Run `npm run linear:sync` after task completion
119
+ - Review recent commits on session start
120
+ - Use subagents for multi-step tasks
121
+ - Ask 1–3 clarifying questions for complex commands (one at a time)
122
+ ```
@@ -1,150 +1,115 @@
1
+ ```markdown
1
2
  # StackMemory - Project Configuration
2
3
 
3
- ## Overview
4
+ ## Quick Reference
4
5
 
5
- StackMemory is an agent programming platform with CLI, MCP server, and Linear integration.
6
+ **Entry points:** `src/cli/index.ts` · `src/integrations/mcp/server.ts`
7
+ **Key files:** `src/core/context/frame-manager.ts` · `src/core/database/sqlite-adapter.ts` · `src/core/worktree/{capture,preflight}.ts` · `src/cli/commands/orchestrator.ts` · `src/core/utils/{git,text,fs}.ts`
6
8
 
7
- **Primary**: /Users/jwu/Dev/stackmemory
8
- **Tech**: TypeScript, Node.js, SQLite, Vitest, ESLint, esbuild
9
+ **Docs:** `agent_docs/` (quick ref) · `docs/` (full: principles, architecture, SPEC, API_REFERENCE, DEVELOPMENT, SETUP)
9
10
 
10
- ## Architecture
11
+ ---
12
+
13
+ ## Project Structure
11
14
 
12
15
  ```
13
16
  src/
14
- cli/ # CLI entry (index.ts)
15
- core/ # Business logic
16
- context/ # Frame management (frame-manager.ts)
17
- database/ # Storage adapters (sqlite-adapter.ts)
17
+ cli/ # CLI commands and entry point
18
+ core/
19
+ context/ # Frame and context management
20
+ database/ # Database adapters (SQLite, ParadeDB)
18
21
  digest/ # Digest generation
19
- query/ # Query routing
20
- integrations/ # Linear, MCP (mcp/server.ts)
22
+ query/ # Query parsing and routing
23
+ integrations/ # External integrations (Linear, MCP)
21
24
  services/ # Business services
22
25
  skills/ # Claude Code skills
23
26
  utils/ # Shared utilities
27
+ scripts/ # Build and utility scripts
28
+ config/ # Configuration files
29
+ docs/ # Documentation
24
30
  ```
25
31
 
26
- ## Documentation
27
-
28
- **Quick reference** (agent_docs/):
29
- - linear_integration.md
30
- - mcp_server.md
31
- - database_storage.md
32
- - claude_hooks.md
33
-
34
- **Full docs** (docs/):
35
- - principles.md - Agent paradigm
36
- - architecture.md - Extension model
37
- - SPEC.md - Technical spec
38
- - API_REFERENCE.md
39
- - DEVELOPMENT.md
40
- - SETUP.md
32
+ ---
41
33
 
42
34
  ## Commands
43
35
 
44
36
  ```bash
45
37
  # Build & Quality
46
- npm run build # Compile (esbuild)
47
- npm run lint # Check
48
- npm run lint:fix # Auto-fix
49
- npm test # Watch mode
50
- npm run test:run # Run once
51
-
52
- # Integration
53
- npm run linear:sync # Sync Linear
54
-
55
- # CLI
56
- stackmemory capture # Save session state
57
- stackmemory restore # Restore session
38
+ npm run build # Compile TypeScript (esbuild)
39
+ npm run lint # ESLint check
40
+ npm run lint:fix # Auto-fix lint issues
41
+ npm test # Run Vitest (watch)
42
+ npm run test:run # Run tests once
43
+ npm run linear:sync # Sync with Linear
44
+
45
+ # StackMemory CLI
46
+ stackmemory capture # Save session state for handoff
47
+ stackmemory restore # Restore from captured state
48
+ stackmemory snapshot save # Post-run context snapshot (alias: snap)
49
+ stackmemory snapshot list # List recent snapshots
50
+ stackmemory preflight # File overlap check for parallel tasks (alias: pf)
51
+ stackmemory conductor start # Autonomous Linear→worktree→agent orchestrator
58
52
  ```
59
53
 
60
- ## Validation Checklist
54
+ ---
61
55
 
62
- After EVERY code change:
56
+ ## Validation (MUST DO)
63
57
 
64
- 1. **Lint**: `npm run lint` - fix ALL errors AND warnings
65
- 2. **Test**: `npm run test:run` - verify no regressions
66
- 3. **Build**: `npm run build` - ensure compilation
67
- 4. **Run**: Execute code to verify functionality
58
+ After every code change:
59
+ 1. `npm run lint` fix all errors AND warnings
60
+ 2. `npm run test:run` verify no regressions
61
+ 3. `npm run build` ensure compilation
62
+ 4. Run the code to verify it works
68
63
 
69
- **Test coverage**:
70
- - New features require tests in `src/**/__tests__/`
71
- - Maintain or improve coverage (no untested paths)
72
- - Critical: context management, handoff, Linear sync
64
+ **Test coverage:** New features require tests in `src/**/__tests__/`. Maintain or improve coverage. Critical paths: context management, handoff, Linear sync.
73
65
 
74
- **Never**: Assume success | Skip testing | Use mock fallbacks
66
+ Never: assume success · skip testing · use mock data as fallback
75
67
 
76
- ## Git Workflow
68
+ ---
77
69
 
78
- **Commit format**: `type(scope): message`
79
- **Branch naming**: `feature/STA-XXX-desc` | `fix/STA-XXX-desc` | `chore/desc`
70
+ ## Git Rules (CRITICAL)
80
71
 
81
- **Critical rules**:
82
- - NEVER use `--no-verify` on commit/push
83
- - ALWAYS fix lint/test errors before pushing
72
+ - NEVER use `--no-verify` on git push or commit
73
+ - ALWAYS fix lint/test errors before pushing; if pre-push hooks fail, fix the issue
84
74
  - Run `npm run lint && npm run test:run` before pushing
85
- - If pre-push hooks fail, fix the underlying issue
75
+ - Commit: `type(scope): message`
76
+ - Branch: `feature/STA-XXX-description` · `fix/STA-XXX-description` · `chore/description`
77
+
78
+ ---
86
79
 
87
80
  ## Task Delegation Model
88
81
 
89
- Route effort by complexity:
90
-
91
- ### AUTOMATE
92
- Execute immediately, lint+test is sufficient:
93
- - CRUD, boilerplate, formatting, simple transforms
94
- - Tool handler following existing switch/case
95
- - Config additions (env var, feature flag)
96
-
97
- ### STANDARD
98
- Normal workflow, lint+test+build:
99
- - Features, bug fixes, refactoring
100
- - Test coverage, documentation
101
- - Integration wiring (server.ts dispatch)
102
-
103
- ### CAREFUL
104
- Review approach before implementation:
105
- - API/schema changes, database migrations, auth
106
- - New integration patterns (MCP tools, webhooks)
107
- - Changes to frame-manager, sqlite-adapter, daemon lifecycle
108
- - Error handling chains
109
-
110
- ### ARCHITECT
111
- Plan mode required, explore patterns first:
112
- - New service boundaries, system integrations
113
- - Performance-critical (FTS5 queries, search scoring)
114
- - Breaking changes (MCP protocol, CLI interface)
115
-
116
- ### HUMAN
117
- Explicit approval before changes:
118
- - Security decisions, secret handling
119
- - Irreversible operations (migrations, schema drops)
120
- - Publishing (npm, Railway)
82
+ | Tier | When | Gates |
83
+ |------|------|-------|
84
+ | **AUTOMATE** | CRUD, boilerplate, config additions, simple switch/case handlers | lint + test |
85
+ | **STANDARD** | Features, bug fixes, refactoring, new tests, integration wiring | lint + test + build |
86
+ | **CAREFUL** | API/schema changes, DB migrations, auth, MCP tools, frame-manager/sqlite-adapter/daemon lifecycle | Review approach first |
87
+ | **ARCHITECT** | New service boundaries, FTS5/search perf, breaking MCP/CLI changes | Plan mode required |
88
+ | **HUMAN** | Security decisions, secret handling, irreversible ops, publishing | Explicit approval |
89
+
90
+ ---
121
91
 
122
92
  ## Security
123
93
 
124
- **NEVER hardcode secrets** - use process.env with dotenv/config:
94
+ NEVER hardcode secrets use `process.env` with dotenv/config:
125
95
 
126
96
  ```javascript
127
97
  import 'dotenv/config';
128
98
  const API_KEY = process.env.LINEAR_API_KEY;
129
- if (!API_KEY) {
130
- console.error('LINEAR_API_KEY not set');
131
- process.exit(1);
132
- }
99
+ if (!API_KEY) { console.error('LINEAR_API_KEY not set'); process.exit(1); }
133
100
  ```
134
101
 
135
- **Env sources** (check in order):
136
- 1. .env file
137
- 2. .env.local
138
- 3. ~/.zshrc
139
- 4. Process environment
102
+ Env lookup order: `.env` → `.env.local` → `~/.zshrc` → process env
103
+
104
+ Block patterns: `lin_api_*` · `lin_oauth_*` · `sk-*` · `npm_*`
140
105
 
141
- **Block patterns**: lin_api_* | lin_oauth_* | sk-* | npm_*
106
+ ---
142
107
 
143
- ## Deployment
108
+ ## Deploy
144
109
 
145
110
  ```bash
146
- # npm publish (uses NPM_TOKEN from .env, no OTP)
147
- git stash -- scripts/gepa/ # stash GEPA state
111
+ # npm publish (uses NPM_TOKEN from .env, no OTP needed)
112
+ git stash -- scripts/gepa/ # stash GEPA state (dirties working tree)
148
113
  NPM_TOKEN=$(grep '^NPM_TOKEN=' .env | cut -d= -f2) \
149
114
  npm publish --registry https://registry.npmjs.org/ \
150
115
  --//registry.npmjs.org/:_authToken="$NPM_TOKEN"
@@ -152,21 +117,22 @@ git stash pop # restore GEPA state
152
117
 
153
118
  # Railway
154
119
  railway up
155
-
156
- # Note: Pre-publish checks require clean git status
157
120
  ```
158
121
 
159
- ## Task Management
122
+ Pre-publish checks require clean git status — stash GEPA files first.
160
123
 
161
- - Use TodoWrite for 3+ steps or multiple requests
162
- - Keep one task in_progress at a time
163
- - Update status immediately on completion
124
+ ---
164
125
 
165
- ## Workflow Tips
126
+ ## Workflow
166
127
 
167
- - Check .env for API keys before asking
128
+ - Check `.env` for API keys before asking
129
+ - Review recent commits and `stackmemory.json` on session start
130
+ - Use subagents for multi-step tasks
168
131
  - Run `npm run linear:sync` after task completion
169
132
  - Use browser MCP for visual testing
170
- - Review recent commits and stackmemory.json on session start
171
- - Use subagents for multi-step tasks
172
- - Ask 1-3 clarifying questions for complex commands (one at a time)
133
+ - Ask 1–3 clarifying questions for complex commands (one at a time)
134
+
135
+ **Task management:** Use TodoWrite for 3+ steps. Keep one task `in_progress`. Update status immediately on completion.
136
+
137
+ **Working directory:** PRIMARY `/Users/jwu/Dev/stackmemory` · TEMP `/tmp`
138
+ ```