decision-os-mcp 0.3.2 → 0.4.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/AGENTS.md +69 -0
- package/README.md +38 -3
- package/package.json +11 -1
- package/templates/AGENTS.md +38 -0
- package/templates/claude-desktop-mcp-config.json +11 -0
- package/src/hierarchical-storage.ts +0 -505
- package/src/index.ts +0 -932
- package/src/schemas.ts +0 -296
- package/src/storage.ts +0 -829
- package/test/hierarchical-storage.test.ts +0 -223
- package/test/storage.test.ts +0 -551
- package/tsconfig.json +0 -19
package/AGENTS.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Decision OS MCP
|
|
2
|
+
|
|
3
|
+
MCP server for Decision OS — an LLM-native decision tracking and learning system. TypeScript, Node.js 18+, ES modules, `@modelcontextprotocol/sdk`, YAML storage, Zod validation.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install # Install dependencies
|
|
9
|
+
npm run build # Compile TypeScript (tsc)
|
|
10
|
+
npm run dev # Watch mode (tsc --watch)
|
|
11
|
+
npm test # Run all tests (vitest run)
|
|
12
|
+
npm run test:watch # Watch tests (vitest)
|
|
13
|
+
npm start # Run server (set DECISION_OS_PATH first)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Run `npm run build && npm test` before committing. All tests must pass.
|
|
17
|
+
|
|
18
|
+
## Architecture
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
src/
|
|
22
|
+
├── index.ts # MCP server entry, tool definitions, request handler
|
|
23
|
+
├── schemas.ts # Zod schemas for all types and tool inputs
|
|
24
|
+
├── storage.ts # Single-scope storage engine (YAML read/write)
|
|
25
|
+
└── hierarchical-storage.ts # Multi-scope storage (PROJECT + GLOBAL cascading)
|
|
26
|
+
test/
|
|
27
|
+
├── storage.test.ts
|
|
28
|
+
└── hierarchical-storage.test.ts
|
|
29
|
+
templates/ # Setup templates for consumers
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- Entry point registers 13 MCP tools via `@modelcontextprotocol/sdk`
|
|
33
|
+
- All tool input validation uses Zod schemas from `schemas.ts`
|
|
34
|
+
- Storage is YAML-based, file-system only, no network calls
|
|
35
|
+
- Hierarchical storage merges `~/.decision-os/` (GLOBAL) with project-level `.decision-os/` (PROJECT)
|
|
36
|
+
- PROJECT scope wins over GLOBAL on conflicts
|
|
37
|
+
|
|
38
|
+
## Conventions
|
|
39
|
+
|
|
40
|
+
- ES modules (`"type": "module"` in package.json) — use `.js` extensions in imports
|
|
41
|
+
- Strict TypeScript (`strict: true`, target ES2022, NodeNext module resolution) — no `any`, no `@ts-ignore`
|
|
42
|
+
- Tool definitions in `TOOLS` array follow MCP SDK `Tool` type with `annotations`
|
|
43
|
+
- All tool handlers live in the `switch` block inside `CallToolRequestSchema` handler
|
|
44
|
+
- Zod for all input validation; errors formatted as `path: message`
|
|
45
|
+
- Error handling: `ZodError` → formatted validation message; `Error` → `.message`; else → `String(error)`
|
|
46
|
+
- Regret values accept both number (0-3) and string ("0"-"3") via `z.preprocess`
|
|
47
|
+
- Foundation IDs: `F-NNNN` (project), `GF-NNNN` (global)
|
|
48
|
+
- Pressure event IDs: `PE-NNNN`
|
|
49
|
+
- Case IDs: `NNNN-slug-title`
|
|
50
|
+
|
|
51
|
+
## Testing
|
|
52
|
+
|
|
53
|
+
- Tests use Vitest with temp directories for isolation
|
|
54
|
+
- Test files: `test/storage.test.ts`, `test/hierarchical-storage.test.ts`
|
|
55
|
+
|
|
56
|
+
## Adding a New Tool
|
|
57
|
+
|
|
58
|
+
1. Add input schema to `schemas.ts`
|
|
59
|
+
2. Add `Tool` definition to `TOOLS` array in `index.ts` (include `annotations`)
|
|
60
|
+
3. Add handler case to the `switch` block in the `CallToolRequestSchema` handler
|
|
61
|
+
4. Add tests in `test/`
|
|
62
|
+
5. Update tool table in `README.md`
|
|
63
|
+
|
|
64
|
+
## PR Guidelines
|
|
65
|
+
|
|
66
|
+
- Title format: descriptive summary of the change
|
|
67
|
+
- Run `npm run build && npm test` before opening a PR
|
|
68
|
+
- Include test coverage for new tools or storage logic
|
|
69
|
+
- Update `README.md` tool table if adding/removing tools
|
package/README.md
CHANGED
|
@@ -32,7 +32,9 @@ cp -r templates/.decision-os /path/to/your-project/
|
|
|
32
32
|
|
|
33
33
|
Edit `config.yaml` with your project name.
|
|
34
34
|
|
|
35
|
-
### 3. Configure
|
|
35
|
+
### 3. Configure Your Agent
|
|
36
|
+
|
|
37
|
+
#### Cursor
|
|
36
38
|
|
|
37
39
|
Add to your project's `.cursor/mcp.json`:
|
|
38
40
|
|
|
@@ -56,6 +58,35 @@ Copy the Cursor rules template:
|
|
|
56
58
|
cp templates/.cursor/rules/decision-os.mdc /path/to/your-project/.cursor/rules/
|
|
57
59
|
```
|
|
58
60
|
|
|
61
|
+
#### Claude Code / Claude Desktop
|
|
62
|
+
|
|
63
|
+
Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"decision-os": {
|
|
69
|
+
"command": "npx",
|
|
70
|
+
"args": ["-y", "decision-os-mcp"],
|
|
71
|
+
"env": {
|
|
72
|
+
"DECISION_OS_PATH": "/absolute/path/to/your-project/.decision-os"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Copy the agent instructions template (includes a `.claude/rules/` symlink to AGENTS.md):
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
cp templates/AGENTS.md /path/to/your-project/
|
|
83
|
+
cp -R templates/.claude /path/to/your-project/
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
> **Note:** Claude Desktop requires absolute paths in `DECISION_OS_PATH` (no `${workspaceFolder}`).
|
|
87
|
+
|
|
88
|
+
[AGENTS.md](https://agents.md) is an open standard supported by 20+ coding agents including OpenAI Codex, Google Jules, Claude Code, Cursor, Aider, Zed, Warp, VS Code, and more. The `.claude/rules/` symlink lets Claude Code pick it up automatically too — one file, every agent.
|
|
89
|
+
|
|
59
90
|
## Tools
|
|
60
91
|
|
|
61
92
|
| Tool | Description |
|
|
@@ -178,10 +209,14 @@ your-project/
|
|
|
178
209
|
│ │ └── ...
|
|
179
210
|
│ └── defaults/
|
|
180
211
|
│ └── foundations.yaml # F-prefixed project learnings
|
|
181
|
-
├── .cursor/
|
|
212
|
+
├── .cursor/ # Cursor setup
|
|
182
213
|
│ ├── mcp.json # MCP server config
|
|
183
214
|
│ └── rules/
|
|
184
|
-
│ └── decision-os.mdc # LLM instructions
|
|
215
|
+
│ └── decision-os.mdc # LLM instructions (Cursor format)
|
|
216
|
+
├── .claude/ # Claude Code setup
|
|
217
|
+
│ └── rules/
|
|
218
|
+
│ └── decision-os.md # -> symlink to ../../AGENTS.md
|
|
219
|
+
├── AGENTS.md # Agent instructions (Claude Code, Codex, Jules, etc.)
|
|
185
220
|
└── src/
|
|
186
221
|
```
|
|
187
222
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decision-os-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "MCP server for Decision OS - LLM-native decision tracking and learning system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,8 +20,18 @@
|
|
|
20
20
|
"decision-os",
|
|
21
21
|
"llm",
|
|
22
22
|
"cursor",
|
|
23
|
+
"claude",
|
|
24
|
+
"codex",
|
|
25
|
+
"agents-md",
|
|
23
26
|
"ai-engineering"
|
|
24
27
|
],
|
|
28
|
+
"files": [
|
|
29
|
+
"dist/",
|
|
30
|
+
"templates/",
|
|
31
|
+
"AGENTS.md",
|
|
32
|
+
"README.md",
|
|
33
|
+
"PRIVACY.md"
|
|
34
|
+
],
|
|
25
35
|
"author": "",
|
|
26
36
|
"license": "MIT",
|
|
27
37
|
"dependencies": {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Decision OS
|
|
2
|
+
|
|
3
|
+
You have access to Decision OS MCP tools for tracking decisions and learning from novel pressure.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
1. **Task start**: Call `get_context()` to load active case, foundations, and conflicts. Create a case with `create_case()` if none exists.
|
|
8
|
+
2. **When surprised**: Call `quick_pressure({ expected, actual })` for fast capture or `log_pressure({ expected, actual, adaptation, remember })` for full detail. When in doubt, capture it.
|
|
9
|
+
3. **Before BUILD decisions**: Call `check_policy({ signals })` to check requirements.
|
|
10
|
+
4. **Task end**: Call `close_case()` with regret (0-3), notes, and regressions. Cases with regret 0 and no unpromoted PEs are auto-deleted.
|
|
11
|
+
5. **Periodically**: Call `suggest_review()` to find unextracted learnings.
|
|
12
|
+
|
|
13
|
+
## When to Log Pressure
|
|
14
|
+
|
|
15
|
+
- Something failed that you predicted would work
|
|
16
|
+
- You changed approach mid-implementation
|
|
17
|
+
- You discovered an undocumented constraint
|
|
18
|
+
- A library behaved differently than expected
|
|
19
|
+
- Performance was unexpectedly poor or good
|
|
20
|
+
|
|
21
|
+
## Tools
|
|
22
|
+
|
|
23
|
+
| Tool | Purpose |
|
|
24
|
+
|------|---------|
|
|
25
|
+
| `get_context` | Load active case, foundations, conflicts |
|
|
26
|
+
| `quick_pressure` | Fast pressure capture (expected + actual only) |
|
|
27
|
+
| `log_pressure` | Full pressure capture with adaptation and remember |
|
|
28
|
+
| `create_case` | Start a new unit of work |
|
|
29
|
+
| `close_case` | Close with outcome signals |
|
|
30
|
+
| `set_active_case` | Switch active case |
|
|
31
|
+
| `check_policy` | Check policy requirements for signals |
|
|
32
|
+
| `get_foundations` | Query compressed learnings |
|
|
33
|
+
| `search_pressures` | Search past pressure events |
|
|
34
|
+
| `promote_to_foundation` | Promote PEs to foundation |
|
|
35
|
+
| `elevate_foundation` | Elevate project foundation to global |
|
|
36
|
+
| `validate_foundation` | Validate global foundation in current project |
|
|
37
|
+
| `suggest_review` | Find unextracted learnings |
|
|
38
|
+
| `list_cases` | List all cases |
|