@stackmemoryai/stackmemory 1.2.1 → 1.2.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.
- package/dist/src/cli/codex-sm.js +6 -8
- package/dist/src/cli/commands/config.js +0 -81
- package/dist/src/cli/commands/context-rehydrate.js +133 -47
- package/dist/src/cli/commands/db.js +35 -8
- package/dist/src/cli/commands/handoff.js +1 -1
- package/dist/src/cli/commands/linear.js +9 -0
- package/dist/src/cli/commands/ralph.js +2 -2
- package/dist/src/cli/commands/setup.js +2 -2
- package/dist/src/cli/commands/signup.js +3 -1
- package/dist/src/cli/commands/skills.js +123 -1
- package/dist/src/cli/commands/storage-tier.js +26 -8
- package/dist/src/cli/index.js +1 -57
- package/dist/src/core/config/feature-flags.js +0 -4
- package/dist/src/core/context/dual-stack-manager.js +10 -3
- package/dist/src/core/context/frame-database.js +32 -0
- package/dist/src/core/context/frame-handoff-manager.js +2 -2
- package/dist/src/core/context/{refactored-frame-manager.js → frame-manager.js} +3 -3
- package/dist/src/core/context/index.js +2 -2
- package/dist/src/core/database/sqlite-adapter.js +161 -1
- package/dist/src/core/digest/frame-digest-integration.js +1 -1
- package/dist/src/core/digest/index.js +1 -1
- package/dist/src/core/execution/parallel-executor.js +5 -1
- package/dist/src/core/projects/project-isolation.js +18 -4
- package/dist/src/core/security/index.js +2 -0
- package/dist/src/core/security/input-sanitizer.js +23 -0
- package/dist/src/core/utils/update-checker.js +10 -6
- package/dist/src/daemon/daemon-config.js +2 -1
- package/dist/src/daemon/services/auto-save-service.js +121 -0
- package/dist/src/daemon/services/maintenance-service.js +76 -1
- package/dist/src/features/sweep/prompt-builder.js +2 -2
- package/dist/src/hooks/graphiti-hooks.js +149 -0
- package/dist/src/hooks/session-summary.js +30 -0
- package/dist/src/integrations/graphiti/linear-graphiti-bridge.js +115 -0
- package/dist/src/integrations/greptile/client.js +101 -0
- package/dist/src/integrations/greptile/config.js +14 -0
- package/dist/src/integrations/greptile/index.js +11 -0
- package/dist/src/integrations/greptile/types.js +4 -0
- package/dist/src/integrations/linear/config.js +3 -1
- package/dist/src/integrations/linear/sync.js +18 -5
- package/dist/src/integrations/linear/webhook.js +16 -0
- package/dist/src/integrations/mcp/handlers/code-execution-handlers.js +33 -7
- package/dist/src/integrations/mcp/handlers/cord-handlers.js +397 -0
- package/dist/src/integrations/mcp/handlers/greptile-handlers.js +456 -0
- package/dist/src/integrations/mcp/handlers/index.js +55 -1
- package/dist/src/integrations/mcp/handlers/task-handlers.js +55 -12
- package/dist/src/integrations/mcp/handlers/team-handlers.js +211 -0
- package/dist/src/integrations/mcp/handlers/trace-handlers.js +25 -9
- package/dist/src/integrations/mcp/index.js +2 -2
- package/dist/src/integrations/mcp/refactored-server.js +31 -10
- package/dist/src/integrations/mcp/server.js +27 -0
- package/dist/src/integrations/mcp/tool-definitions.js +215 -1
- package/dist/src/integrations/ralph/context/context-budget-manager.js +10 -2
- package/dist/src/integrations/ralph/context/stackmemory-context-loader.js +54 -22
- package/dist/src/integrations/ralph/learning/pattern-learner.js +59 -24
- package/dist/src/integrations/ralph/orchestration/multi-loop-orchestrator.js +81 -35
- package/dist/src/integrations/ralph/patterns/compounding-engineering-pattern.js +12 -4
- package/dist/src/integrations/ralph/patterns/extended-coherence-sessions.js +32 -9
- package/dist/src/integrations/ralph/swarm/git-workflow-manager.js +25 -8
- package/dist/src/integrations/ralph/swarm/swarm-coordinator.js +17 -5
- package/dist/src/integrations/ralph/visualization/ralph-debugger.js +73 -22
- package/dist/src/skills/claude-skills.js +46 -103
- package/dist/src/skills/parallel-agent-skill.js +514 -0
- package/dist/src/utils/hook-installer.js +8 -0
- package/package.json +5 -5
- package/scripts/gepa/.before-optimize.md +140 -159
- package/scripts/gepa/config.json +7 -1
- package/scripts/gepa/evals/fixtures/api-endpoint.ts +31 -0
- package/scripts/gepa/evals/fixtures/brittle-integration.ts +38 -0
- package/scripts/gepa/evals/fixtures/fts5-triggers.sql +23 -0
- package/scripts/gepa/evals/fixtures/leaky-service.ts +70 -0
- package/scripts/gepa/evals/fixtures/mcp-dispatch-stub.ts +39 -0
- package/scripts/gepa/evals/fixtures/pr-diff.txt +24 -0
- package/scripts/gepa/evals/fixtures/unsafe-webhook.ts +34 -0
- package/scripts/gepa/evals/fixtures/unwrapped-db-op.ts +42 -0
- package/scripts/gepa/evals/stackmemory-tasks.jsonl +8 -0
- package/scripts/gepa/generations/gen-000/baseline.md +172 -159
- package/scripts/gepa/generations/gen-001/baseline.md +172 -159
- package/scripts/gepa/generations/gen-001/variant-a.md +156 -146
- package/scripts/gepa/generations/gen-001/variant-b.md +199 -170
- package/scripts/gepa/generations/gen-001/variant-c.md +127 -46
- package/scripts/gepa/generations/gen-001/variant-d.md +160 -107
- package/scripts/gepa/hooks/reflect.js +44 -5
- package/scripts/gepa/optimize.js +281 -39
- package/scripts/gepa/results/eval-1-baseline.json +187 -10
- package/scripts/gepa/results/eval-1-variant-a.json +188 -11
- package/scripts/gepa/results/eval-1-variant-b.json +188 -11
- package/scripts/gepa/results/eval-1-variant-c.json +168 -11
- package/scripts/gepa/results/eval-1-variant-d.json +169 -12
- package/scripts/gepa/state.json +18 -18
- package/scripts/install-claude-hooks-auto.js +8 -0
- package/templates/claude-hooks/cord-trace.js +225 -0
- package/dist/src/core/config/storage-config.js +0 -114
- package/dist/src/core/storage/chromadb-adapter.js +0 -379
- package/dist/src/integrations/claude-code/enhanced-pre-clear-hooks.js +0 -458
- package/dist/src/integrations/ralph/coordination/enhanced-coordination.js +0 -409
- package/dist/src/skills/repo-ingestion-skill.js +0 -631
- package/templates/claude-hooks/chromadb-wrapper +0 -21
- /package/dist/src/core/context/{enhanced-rehydration.js → rehydration.js} +0 -0
- /package/dist/src/core/digest/{enhanced-hybrid-digest.js → hybrid-digest.js} +0 -0
- /package/dist/src/core/session/{enhanced-handoff.js → handoff.js} +0 -0
|
@@ -1,166 +1,176 @@
|
|
|
1
|
-
#
|
|
1
|
+
# StackMemory - Project Configuration
|
|
2
|
+
|
|
3
|
+
## Project Structure
|
|
2
4
|
|
|
3
|
-
## Reference Docs
|
|
4
5
|
```
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
src/
|
|
7
|
+
cli/ # CLI commands and entry point
|
|
8
|
+
core/ # Core business logic
|
|
9
|
+
context/ # Frame and context management
|
|
10
|
+
database/ # Database adapters (SQLite, ParadeDB)
|
|
11
|
+
digest/ # Digest generation
|
|
12
|
+
query/ # Query parsing and routing
|
|
13
|
+
integrations/ # External integrations (Linear, MCP)
|
|
14
|
+
services/ # Business services
|
|
15
|
+
skills/ # Claude Code skills
|
|
16
|
+
utils/ # Shared utilities
|
|
17
|
+
scripts/ # Build and utility scripts
|
|
18
|
+
config/ # Configuration files
|
|
19
|
+
docs/ # Documentation
|
|
17
20
|
```
|
|
18
21
|
|
|
22
|
+
## Key Files
|
|
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
|
|
44
|
+
|
|
19
45
|
## Commands
|
|
46
|
+
|
|
20
47
|
```bash
|
|
21
|
-
npm run
|
|
22
|
-
|
|
23
|
-
|
|
48
|
+
npm run build # Compile TypeScript (esbuild)
|
|
49
|
+
npm run lint # ESLint check
|
|
50
|
+
npm run lint:fix # Auto-fix lint issues
|
|
51
|
+
npm test # Run Vitest (watch)
|
|
52
|
+
npm run test:run # Run tests once
|
|
53
|
+
npm run linear:sync # Sync with Linear
|
|
54
|
+
|
|
55
|
+
# StackMemory CLI
|
|
56
|
+
stackmemory capture # Save session state for handoff
|
|
57
|
+
stackmemory restore # Restore from captured state
|
|
24
58
|
```
|
|
25
59
|
|
|
26
|
-
##
|
|
27
|
-
Node.js + Express + PostgreSQL + Redis | Railway | Stripe + Salesforce + QuickBooks
|
|
60
|
+
## Working Directory
|
|
28
61
|
|
|
29
|
-
|
|
30
|
-
|
|
62
|
+
- PRIMARY: /Users/jwu/Dev/stackmemory
|
|
63
|
+
- ALLOWED: All subdirectories
|
|
64
|
+
- TEMP: /tmp for temporary operations
|
|
31
65
|
|
|
32
|
-
##
|
|
33
|
-
```
|
|
34
|
-
src/
|
|
35
|
-
api/ core/ features/ shared/ integrations/
|
|
36
|
-
docs/ scripts/ docker/
|
|
37
|
-
```
|
|
66
|
+
## Required Validation
|
|
38
67
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
|
44
73
|
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
- **StackMemory**: session/entity context layer (repurpose when KG lands)
|
|
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
|
|
50
78
|
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
src/graph/client.ts # MCP client for Graphiti
|
|
54
|
-
src/graph/service.ts # Graph ingest + enrich + search
|
|
55
|
-
src/llm/adapter.js # LLM streaming + SYSTEM_PROMPT
|
|
56
|
-
src/routes/query.js # Query endpoint + KG enrichment
|
|
57
|
-
src/auth/auth.middleware.js # Clerk + API key + test mode
|
|
58
|
-
src/nudge/rule-engine.js # 13 default rules + CRUD + eval
|
|
59
|
-
src/nudge/nudge-engine.js # Lifecycle + state machine + events
|
|
60
|
-
src/nudge/delivery.js # Slack Block Kit + delivery
|
|
61
|
-
src/integrations/slack/app.js # OAuth v2 + token management
|
|
62
|
-
scripts/create-stripe-products.js # Stripe product creation
|
|
63
|
-
scripts/seed-demo-data.js # Demo nudge data
|
|
64
|
-
dashboard-app/src/pages/pricing/ # 4-tier pricing UI
|
|
65
|
-
```
|
|
79
|
+
Do NOT: assume success | skip testing | use mock data as fallback
|
|
66
80
|
|
|
67
|
-
##
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
81
|
+
## Git Rules (CRITICAL)
|
|
82
|
+
|
|
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`
|
|
93
|
+
|
|
94
|
+
## Task Management
|
|
95
|
+
|
|
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
|
|
99
|
+
|
|
100
|
+
## Security
|
|
101
|
+
|
|
102
|
+
NEVER hardcode secrets. Use process.env with dotenv/config:
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
import 'dotenv/config';
|
|
106
|
+
const API_KEY = process.env.LINEAR_API_KEY;
|
|
107
|
+
if (!API_KEY) {
|
|
108
|
+
console.error('LINEAR_API_KEY not set');
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
96
111
|
```
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- **localStorage**: `provenantai:conversationId`, `sidebarOpen`, `onboarded`
|
|
109
|
-
- **Vite**: `base: '/app/'` + BrowserRouter `basename="/app"`
|
|
110
|
-
- **Dev auth**: `X-Test-Mode: true` bypasses Clerk
|
|
111
|
-
- **Express**: `node src/index.js` on PORT=8080 (3000 = Rails)
|
|
112
|
-
- **Build**: `bash -c 'cd dashboard-app && npx vite build'`
|
|
113
|
-
|
|
114
|
-
## Slack Integration
|
|
115
|
-
- **OAuth flow**: GET /api/integrations/slack/install → consent → callback
|
|
116
|
-
- **DB**: `slack_installations` table (migration 030) - per-org bot tokens
|
|
117
|
-
- **Service**: `src/integrations/slack/app.js` - createSlackAppService
|
|
118
|
-
- **Delivery**: `src/nudge/delivery.js` - nudge:created listener, Block Kit formatter
|
|
119
|
-
- **Routes**: install, callback, status, channel config, revoke
|
|
120
|
-
- **Env**: SLACK_CLIENT_ID, SLACK_CLIENT_SECRET, SLACK_REDIRECT_URI
|
|
121
|
-
- **Demo data**: `node scripts/seed-demo-data.js` (10 nudges)
|
|
122
|
-
|
|
123
|
-
## Architecture Patterns
|
|
124
|
-
- **DI**: all route factories accept `deps` objects
|
|
125
|
-
- **Mocks**: MockPineconeAdapter, MockGmailConnectorClient, stub embeddings
|
|
126
|
-
- **Queues**: Bull (not BullMQ)
|
|
127
|
-
- **KMS**: AES-256-GCM shim via LOCAL_KMS_KEY
|
|
128
|
-
- **Streaming**: adapter.streamLLM() → query/stream → ReadableStream
|
|
129
|
-
- **Graph**: optional graphService dep, null when GRAPHITI_URL unset
|
|
130
|
-
|
|
131
|
-
## Testing
|
|
132
|
-
- **Framework**: Jest + SWC (`@swc/jest`), `@jest/globals` imports
|
|
133
|
-
- **Mocks**: `mockDb = { query: jest.fn() }` via DI
|
|
134
|
-
- **Fetch**: `global.fetch = mockFetch` + `jsonResponse()` helper
|
|
135
|
-
- **Pre-commit**: lint + parallel test suite via concurrently
|
|
136
|
-
- **Timeout guard**: Promise.race + .unref() timer in test/setup.js
|
|
137
|
-
- **Supertest**: pass Express app directly (NOT server) - avoids port contention
|
|
138
|
-
- **Redis**: skip eager connect in NODE_ENV=test; disconnect in afterAll
|
|
139
|
-
|
|
140
|
-
### Parallel Test Execution
|
|
112
|
+
|
|
113
|
+
Environment sources (check in order):
|
|
114
|
+
1. .env file
|
|
115
|
+
2. .env.local
|
|
116
|
+
3. ~/.zshrc
|
|
117
|
+
4. Process environment
|
|
118
|
+
|
|
119
|
+
Block secret patterns: lin_api_* | lin_oauth_* | sk-* | npm_*
|
|
120
|
+
|
|
121
|
+
## Deploy
|
|
122
|
+
|
|
141
123
|
```bash
|
|
142
|
-
npm
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
**After code changes**: run targeted sub-suite in background via Bash `run_in_background`
|
|
124
|
+
# npm publish (uses NPM_TOKEN from .env, no OTP needed)
|
|
125
|
+
git stash -- scripts/gepa/ # stash GEPA state (dirties working tree)
|
|
126
|
+
NPM_TOKEN=$(grep '^NPM_TOKEN=' .env | cut -d= -f2) \
|
|
127
|
+
npm publish --registry https://registry.npmjs.org/ \
|
|
128
|
+
--//registry.npmjs.org/:_authToken="$NPM_TOKEN"
|
|
129
|
+
git stash pop # restore GEPA state
|
|
149
130
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
docs/business/CONTENT_INBOUND_STRATEGY.md # Content/inbound playbook
|
|
155
|
-
docs/business/FRACTIONAL_CMO_AGENT.md # CMO Agent product brief
|
|
131
|
+
# Railway
|
|
132
|
+
railway up
|
|
133
|
+
|
|
134
|
+
# Pre-publish checks require clean git status — stash GEPA files first
|
|
156
135
|
```
|
|
157
136
|
|
|
158
|
-
##
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
137
|
+
## Task Delegation Model
|
|
138
|
+
|
|
139
|
+
Match effort to complexity:
|
|
140
|
+
|
|
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)
|
|
145
|
+
|
|
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)
|
|
150
|
+
|
|
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
|
|
156
|
+
|
|
157
|
+
**ARCHITECT** — Plan mode required, explore patterns first:
|
|
158
|
+
- New service boundaries, system integrations
|
|
159
|
+
- Performance-critical paths (FTS5 queries, search scoring)
|
|
160
|
+
- Breaking changes to MCP protocol or CLI interface
|
|
161
|
+
|
|
162
|
+
**HUMAN** — Explicit user approval required:
|
|
163
|
+
- Security-critical decisions, secret handling
|
|
164
|
+
- 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.
|
|
168
|
+
|
|
169
|
+
## Workflow
|
|
165
170
|
|
|
166
|
-
|
|
171
|
+
- Check .env for API keys before asking user
|
|
172
|
+
- Run `npm run linear:sync` after task completion
|
|
173
|
+
- Use browser MCP for visual testing
|
|
174
|
+
- Review recent commits and stackmemory.json at session start
|
|
175
|
+
- Use subagents for multi-step tasks
|
|
176
|
+
- Ask 1-3 clarifying questions for complex commands (one at a time)
|