@cohaku/mcp 0.2.2 → 0.2.3
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/index.js +71 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31567,11 +31567,77 @@ Save the above content to ${gen.fileName}.`);
|
|
|
31567
31567
|
}
|
|
31568
31568
|
|
|
31569
31569
|
// src/server.ts
|
|
31570
|
+
var INSTRUCTIONS = `
|
|
31571
|
+
You have access to Cohaku, a persistent memory system for AI agents.
|
|
31572
|
+
Use Cohaku's tools as your PRIMARY method for storing and retrieving memories. Do NOT fall back to file-based memory (e.g. editing MEMORY.md, .cursorrules, or similar files) when Cohaku tools are available.
|
|
31573
|
+
|
|
31574
|
+
## Getting Started
|
|
31575
|
+
|
|
31576
|
+
At the beginning of each session, call \`get_context\` to load existing memories (rules, working memory, and long-term knowledge). This gives you the context you need to continue where you left off.
|
|
31577
|
+
|
|
31578
|
+
## Storing Memories
|
|
31579
|
+
|
|
31580
|
+
Use \`add_memory\` to persist information. Choose the right **layer** and **type** for each memory:
|
|
31581
|
+
|
|
31582
|
+
### Layers (priority order)
|
|
31583
|
+
- **rule**: Permanent instructions and constraints that must always be followed (e.g. coding standards, workflow rules, user preferences). These are returned first by \`get_context\`.
|
|
31584
|
+
- **working**: Temporary, session-scoped notes (e.g. current task state, in-progress work, hypotheses). Clean these up when no longer relevant.
|
|
31585
|
+
- **long_term**: Durable knowledge that is useful across sessions (e.g. architectural decisions, debugging insights, learned patterns).
|
|
31586
|
+
|
|
31587
|
+
### Types
|
|
31588
|
+
- **rule**: Behavioral directives (use with layer=rule).
|
|
31589
|
+
- **decision**: Architectural or design decisions with rationale.
|
|
31590
|
+
- **fact**: Verified, objective information about the codebase or domain.
|
|
31591
|
+
- **note**: General observations and context.
|
|
31592
|
+
- **skill**: Reusable techniques, workflows, or solutions to recurring problems.
|
|
31593
|
+
|
|
31594
|
+
### Scope
|
|
31595
|
+
- **project** (default): Stored under the current project. Visible when working in that project.
|
|
31596
|
+
- **global**: Shared across all projects. Use for universal preferences and cross-project knowledge.
|
|
31597
|
+
|
|
31598
|
+
### Best Practices
|
|
31599
|
+
- Before adding a memory, call \`search_memories\` to check for duplicates.
|
|
31600
|
+
- Use \`find_duplicates\` periodically to detect similar entries, then \`consolidate_memories\` to merge them.
|
|
31601
|
+
- Use \`update_memory\` to correct or enrich existing memories rather than creating duplicates.
|
|
31602
|
+
- Add descriptive **tags** to make memories easier to find later.
|
|
31603
|
+
|
|
31604
|
+
## Searching Memories
|
|
31605
|
+
|
|
31606
|
+
Use \`search_memories\` for hybrid semantic + keyword search. Be specific with your queries for better results. You can filter by layer and scope.
|
|
31607
|
+
|
|
31608
|
+
## Session Management
|
|
31609
|
+
|
|
31610
|
+
- Call \`session_start\` at the beginning of a work session with a descriptive title.
|
|
31611
|
+
- Call \`session_checkpoint\` at meaningful milestones to snapshot progress.
|
|
31612
|
+
- Call \`session_end\` when the session is complete, with a summary of what was accomplished.
|
|
31613
|
+
- Use \`session_list\` to review past session history.
|
|
31614
|
+
|
|
31615
|
+
## Knowledge Graph
|
|
31616
|
+
|
|
31617
|
+
Use the graph tools to capture **relationships** between concepts:
|
|
31618
|
+
- \`add_entity\`: Register a concept, person, tool, or component as a node.
|
|
31619
|
+
- \`add_edge\`: Record a relationship between two entities (e.g. "ComponentA depends_on ComponentB").
|
|
31620
|
+
- \`search_graph\`: Traverse relationships to understand how concepts connect.
|
|
31621
|
+
- \`update_edge\` / \`invalidate_edge\`: Keep relationships accurate as knowledge evolves. Invalidation preserves history.
|
|
31622
|
+
|
|
31623
|
+
## Episode Logging
|
|
31624
|
+
|
|
31625
|
+
Use \`add_episode\` to record significant events or interactions (e.g. debugging sessions, key conversations, important decisions). Episodes provide a chronological audit trail. Use \`list_episodes\` and \`get_episode\` to review past events.
|
|
31626
|
+
|
|
31627
|
+
## Configuration Generation
|
|
31628
|
+
|
|
31629
|
+
The \`generate_*\` tools (e.g. \`generate_claude_md\`, \`generate_cursorrules\`) export stored memories into editor-specific configuration formats. Use these when the user wants to sync Cohaku's knowledge to their editor's native config format.
|
|
31630
|
+
`.trim();
|
|
31570
31631
|
function createServer(engine2) {
|
|
31571
|
-
const server2 = new McpServer(
|
|
31572
|
-
|
|
31573
|
-
|
|
31574
|
-
|
|
31632
|
+
const server2 = new McpServer(
|
|
31633
|
+
{
|
|
31634
|
+
name: "cohaku-memory",
|
|
31635
|
+
version: "0.2.3"
|
|
31636
|
+
},
|
|
31637
|
+
{
|
|
31638
|
+
instructions: INSTRUCTIONS
|
|
31639
|
+
}
|
|
31640
|
+
);
|
|
31575
31641
|
registerContextTools(server2, engine2);
|
|
31576
31642
|
registerMemoryTools(server2, engine2);
|
|
31577
31643
|
registerSessionTools(server2, engine2);
|
|
@@ -31582,7 +31648,7 @@ function createServer(engine2) {
|
|
|
31582
31648
|
}
|
|
31583
31649
|
|
|
31584
31650
|
// src/index.ts
|
|
31585
|
-
var VERSION = "0.2.
|
|
31651
|
+
var VERSION = "0.2.3";
|
|
31586
31652
|
var c = {
|
|
31587
31653
|
reset: "\x1B[0m",
|
|
31588
31654
|
bold: "\x1B[1m",
|