@goondocks/myco 0.1.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/.claude-plugin/marketplace.json +22 -0
- package/.claude-plugin/plugin.json +18 -0
- package/CONTRIBUTING.md +143 -0
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/commands/init.md +231 -0
- package/commands/setup-llm.md +89 -0
- package/commands/status.md +112 -0
- package/dist/src/agents/adapter.d.ts +76 -0
- package/dist/src/agents/adapter.d.ts.map +1 -0
- package/dist/src/agents/adapter.js +124 -0
- package/dist/src/agents/adapter.js.map +1 -0
- package/dist/src/agents/claude-code.d.ts +3 -0
- package/dist/src/agents/claude-code.d.ts.map +1 -0
- package/dist/src/agents/claude-code.js +22 -0
- package/dist/src/agents/claude-code.js.map +1 -0
- package/dist/src/agents/cursor.d.ts +3 -0
- package/dist/src/agents/cursor.d.ts.map +1 -0
- package/dist/src/agents/cursor.js +154 -0
- package/dist/src/agents/cursor.js.map +1 -0
- package/dist/src/agents/index.d.ts +6 -0
- package/dist/src/agents/index.d.ts.map +1 -0
- package/dist/src/agents/index.js +5 -0
- package/dist/src/agents/index.js.map +1 -0
- package/dist/src/agents/registry.d.ts +34 -0
- package/dist/src/agents/registry.d.ts.map +1 -0
- package/dist/src/agents/registry.js +95 -0
- package/dist/src/agents/registry.js.map +1 -0
- package/dist/src/artifacts/candidates.d.ts +20 -0
- package/dist/src/artifacts/candidates.d.ts.map +1 -0
- package/dist/src/artifacts/candidates.js +84 -0
- package/dist/src/artifacts/candidates.js.map +1 -0
- package/dist/src/artifacts/slugify.d.ts +2 -0
- package/dist/src/artifacts/slugify.d.ts.map +1 -0
- package/dist/src/artifacts/slugify.js +22 -0
- package/dist/src/artifacts/slugify.js.map +1 -0
- package/dist/src/capture/artifact-watcher.d.ts +19 -0
- package/dist/src/capture/artifact-watcher.d.ts.map +1 -0
- package/dist/src/capture/artifact-watcher.js +37 -0
- package/dist/src/capture/artifact-watcher.js.map +1 -0
- package/dist/src/capture/buffer.d.ts +20 -0
- package/dist/src/capture/buffer.d.ts.map +1 -0
- package/dist/src/capture/buffer.js +55 -0
- package/dist/src/capture/buffer.js.map +1 -0
- package/dist/src/capture/plan-detector.d.ts +15 -0
- package/dist/src/capture/plan-detector.d.ts.map +1 -0
- package/dist/src/capture/plan-detector.js +34 -0
- package/dist/src/capture/plan-detector.js.map +1 -0
- package/dist/src/capture/processor.d.ts +2 -0
- package/dist/src/capture/processor.d.ts.map +1 -0
- package/dist/src/capture/processor.js +3 -0
- package/dist/src/capture/processor.js.map +1 -0
- package/dist/src/capture/prompts/classify.md +28 -0
- package/dist/src/capture/prompts/debugging.md +91 -0
- package/dist/src/capture/prompts/exploration.md +88 -0
- package/dist/src/capture/prompts/extraction.md +93 -0
- package/dist/src/capture/prompts/implementation.md +90 -0
- package/dist/src/capture/prompts/prompts/classify.md +28 -0
- package/dist/src/capture/prompts/prompts/debugging.md +91 -0
- package/dist/src/capture/prompts/prompts/exploration.md +88 -0
- package/dist/src/capture/prompts/prompts/extraction.md +93 -0
- package/dist/src/capture/prompts/prompts/implementation.md +90 -0
- package/dist/src/capture/prompts/prompts/schema.yaml +97 -0
- package/dist/src/capture/prompts/prompts/session-summary.md +65 -0
- package/dist/src/capture/prompts/prompts/session-title.md +46 -0
- package/dist/src/capture/prompts/schema.yaml +97 -0
- package/dist/src/capture/prompts/session-summary.md +65 -0
- package/dist/src/capture/prompts/session-title.md +46 -0
- package/dist/src/capture/prompts.d.ts +77 -0
- package/dist/src/capture/prompts.d.ts.map +1 -0
- package/dist/src/capture/prompts.js +255 -0
- package/dist/src/capture/prompts.js.map +1 -0
- package/dist/src/capture/transcript-miner.d.ts +31 -0
- package/dist/src/capture/transcript-miner.d.ts.map +1 -0
- package/dist/src/capture/transcript-miner.js +61 -0
- package/dist/src/capture/transcript-miner.js.map +1 -0
- package/dist/src/cli.d.ts +3 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +584 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/config/loader.d.ts +4 -0
- package/dist/src/config/loader.d.ts.map +1 -0
- package/dist/src/config/loader.js +32 -0
- package/dist/src/config/loader.js.map +1 -0
- package/dist/src/config/schema.d.ts +83 -0
- package/dist/src/config/schema.d.ts.map +1 -0
- package/dist/src/config/schema.js +55 -0
- package/dist/src/config/schema.js.map +1 -0
- package/dist/src/constants.d.ts +73 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +86 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/context/injector.d.ts +18 -0
- package/dist/src/context/injector.d.ts.map +1 -0
- package/dist/src/context/injector.js +71 -0
- package/dist/src/context/injector.js.map +1 -0
- package/dist/src/context/relevance.d.ts +13 -0
- package/dist/src/context/relevance.d.ts.map +1 -0
- package/dist/src/context/relevance.js +44 -0
- package/dist/src/context/relevance.js.map +1 -0
- package/dist/src/daemon/batch.d.ts +22 -0
- package/dist/src/daemon/batch.d.ts.map +1 -0
- package/dist/src/daemon/batch.js +38 -0
- package/dist/src/daemon/batch.js.map +1 -0
- package/dist/src/daemon/lifecycle.d.ts +27 -0
- package/dist/src/daemon/lifecycle.d.ts.map +1 -0
- package/dist/src/daemon/lifecycle.js +50 -0
- package/dist/src/daemon/lifecycle.js.map +1 -0
- package/dist/src/daemon/lineage.d.ts +42 -0
- package/dist/src/daemon/lineage.d.ts.map +1 -0
- package/dist/src/daemon/lineage.js +116 -0
- package/dist/src/daemon/lineage.js.map +1 -0
- package/dist/src/daemon/logger.d.ts +33 -0
- package/dist/src/daemon/logger.d.ts.map +1 -0
- package/dist/src/daemon/logger.js +88 -0
- package/dist/src/daemon/logger.js.map +1 -0
- package/dist/src/daemon/main.d.ts +2 -0
- package/dist/src/daemon/main.d.ts.map +1 -0
- package/dist/src/daemon/main.js +738 -0
- package/dist/src/daemon/main.js.map +1 -0
- package/dist/src/daemon/processor.d.ts +44 -0
- package/dist/src/daemon/processor.d.ts.map +1 -0
- package/dist/src/daemon/processor.js +142 -0
- package/dist/src/daemon/processor.js.map +1 -0
- package/dist/src/daemon/server.d.ts +24 -0
- package/dist/src/daemon/server.d.ts.map +1 -0
- package/dist/src/daemon/server.js +117 -0
- package/dist/src/daemon/server.js.map +1 -0
- package/dist/src/daemon/watcher.d.ts +29 -0
- package/dist/src/daemon/watcher.d.ts.map +1 -0
- package/dist/src/daemon/watcher.js +67 -0
- package/dist/src/daemon/watcher.js.map +1 -0
- package/dist/src/hooks/client.d.ts +20 -0
- package/dist/src/hooks/client.d.ts.map +1 -0
- package/dist/src/hooks/client.js +111 -0
- package/dist/src/hooks/client.js.map +1 -0
- package/dist/src/hooks/post-tool-use.d.ts +2 -0
- package/dist/src/hooks/post-tool-use.d.ts.map +1 -0
- package/dist/src/hooks/post-tool-use.js +40 -0
- package/dist/src/hooks/post-tool-use.js.map +1 -0
- package/dist/src/hooks/read-stdin.d.ts +2 -0
- package/dist/src/hooks/read-stdin.d.ts.map +1 -0
- package/dist/src/hooks/read-stdin.js +10 -0
- package/dist/src/hooks/read-stdin.js.map +1 -0
- package/dist/src/hooks/session-end.d.ts +2 -0
- package/dist/src/hooks/session-end.d.ts.map +1 -0
- package/dist/src/hooks/session-end.js +23 -0
- package/dist/src/hooks/session-end.js.map +1 -0
- package/dist/src/hooks/session-start.d.ts +2 -0
- package/dist/src/hooks/session-start.d.ts.map +1 -0
- package/dist/src/hooks/session-start.js +49 -0
- package/dist/src/hooks/session-start.js.map +1 -0
- package/dist/src/hooks/stop.d.ts +2 -0
- package/dist/src/hooks/stop.d.ts.map +1 -0
- package/dist/src/hooks/stop.js +34 -0
- package/dist/src/hooks/stop.js.map +1 -0
- package/dist/src/hooks/user-prompt-submit.d.ts +2 -0
- package/dist/src/hooks/user-prompt-submit.d.ts.map +1 -0
- package/dist/src/hooks/user-prompt-submit.js +46 -0
- package/dist/src/hooks/user-prompt-submit.js.map +1 -0
- package/dist/src/index/fts.d.ts +16 -0
- package/dist/src/index/fts.d.ts.map +1 -0
- package/dist/src/index/fts.js +53 -0
- package/dist/src/index/fts.js.map +1 -0
- package/dist/src/index/rebuild.d.ts +4 -0
- package/dist/src/index/rebuild.d.ts.map +1 -0
- package/dist/src/index/rebuild.js +40 -0
- package/dist/src/index/rebuild.js.map +1 -0
- package/dist/src/index/sqlite.d.ts +33 -0
- package/dist/src/index/sqlite.d.ts.map +1 -0
- package/dist/src/index/sqlite.js +99 -0
- package/dist/src/index/sqlite.js.map +1 -0
- package/dist/src/index/vectors.d.ts +24 -0
- package/dist/src/index/vectors.d.ts.map +1 -0
- package/dist/src/index/vectors.js +97 -0
- package/dist/src/index/vectors.js.map +1 -0
- package/dist/src/intelligence/anthropic.d.ts +17 -0
- package/dist/src/intelligence/anthropic.d.ts.map +1 -0
- package/dist/src/intelligence/anthropic.js +36 -0
- package/dist/src/intelligence/anthropic.js.map +1 -0
- package/dist/src/intelligence/embeddings.d.ts +3 -0
- package/dist/src/intelligence/embeddings.d.ts.map +1 -0
- package/dist/src/intelligence/embeddings.js +15 -0
- package/dist/src/intelligence/embeddings.js.map +1 -0
- package/dist/src/intelligence/haiku.d.ts +17 -0
- package/dist/src/intelligence/haiku.d.ts.map +1 -0
- package/dist/src/intelligence/haiku.js +35 -0
- package/dist/src/intelligence/haiku.js.map +1 -0
- package/dist/src/intelligence/llm.d.ts +33 -0
- package/dist/src/intelligence/llm.d.ts.map +1 -0
- package/dist/src/intelligence/llm.js +26 -0
- package/dist/src/intelligence/llm.js.map +1 -0
- package/dist/src/intelligence/lm-studio.d.ts +20 -0
- package/dist/src/intelligence/lm-studio.d.ts.map +1 -0
- package/dist/src/intelligence/lm-studio.js +59 -0
- package/dist/src/intelligence/lm-studio.js.map +1 -0
- package/dist/src/intelligence/ollama.d.ts +22 -0
- package/dist/src/intelligence/ollama.d.ts.map +1 -0
- package/dist/src/intelligence/ollama.js +64 -0
- package/dist/src/intelligence/ollama.js.map +1 -0
- package/dist/src/intelligence/response.d.ts +29 -0
- package/dist/src/intelligence/response.d.ts.map +1 -0
- package/dist/src/intelligence/response.js +71 -0
- package/dist/src/intelligence/response.js.map +1 -0
- package/dist/src/intelligence/service.d.ts +18 -0
- package/dist/src/intelligence/service.d.ts.map +1 -0
- package/dist/src/intelligence/service.js +66 -0
- package/dist/src/intelligence/service.js.map +1 -0
- package/dist/src/logs/format.d.ts +6 -0
- package/dist/src/logs/format.d.ts.map +1 -0
- package/dist/src/logs/format.js +46 -0
- package/dist/src/logs/format.js.map +1 -0
- package/dist/src/logs/reader.d.ts +28 -0
- package/dist/src/logs/reader.d.ts.map +1 -0
- package/dist/src/logs/reader.js +106 -0
- package/dist/src/logs/reader.js.map +1 -0
- package/dist/src/mcp/server.d.ts +16 -0
- package/dist/src/mcp/server.d.ts.map +1 -0
- package/dist/src/mcp/server.js +305 -0
- package/dist/src/mcp/server.js.map +1 -0
- package/dist/src/mcp/tools/consolidate.d.ts +15 -0
- package/dist/src/mcp/tools/consolidate.d.ts.map +1 -0
- package/dist/src/mcp/tools/consolidate.js +49 -0
- package/dist/src/mcp/tools/consolidate.js.map +1 -0
- package/dist/src/mcp/tools/graph.d.ts +30 -0
- package/dist/src/mcp/tools/graph.d.ts.map +1 -0
- package/dist/src/mcp/tools/graph.js +106 -0
- package/dist/src/mcp/tools/graph.js.map +1 -0
- package/dist/src/mcp/tools/logs.d.ts +3 -0
- package/dist/src/mcp/tools/logs.d.ts.map +1 -0
- package/dist/src/mcp/tools/logs.js +7 -0
- package/dist/src/mcp/tools/logs.js.map +1 -0
- package/dist/src/mcp/tools/plans.d.ts +23 -0
- package/dist/src/mcp/tools/plans.d.ts.map +1 -0
- package/dist/src/mcp/tools/plans.js +63 -0
- package/dist/src/mcp/tools/plans.js.map +1 -0
- package/dist/src/mcp/tools/recall.d.ts +30 -0
- package/dist/src/mcp/tools/recall.d.ts.map +1 -0
- package/dist/src/mcp/tools/recall.js +34 -0
- package/dist/src/mcp/tools/recall.js.map +1 -0
- package/dist/src/mcp/tools/remember.d.ts +15 -0
- package/dist/src/mcp/tools/remember.d.ts.map +1 -0
- package/dist/src/mcp/tools/remember.js +18 -0
- package/dist/src/mcp/tools/remember.js.map +1 -0
- package/dist/src/mcp/tools/search.d.ts +19 -0
- package/dist/src/mcp/tools/search.d.ts.map +1 -0
- package/dist/src/mcp/tools/search.js +59 -0
- package/dist/src/mcp/tools/search.js.map +1 -0
- package/dist/src/mcp/tools/sessions.d.ts +21 -0
- package/dist/src/mcp/tools/sessions.d.ts.map +1 -0
- package/dist/src/mcp/tools/sessions.js +36 -0
- package/dist/src/mcp/tools/sessions.js.map +1 -0
- package/dist/src/mcp/tools/supersede.d.ts +14 -0
- package/dist/src/mcp/tools/supersede.d.ts.map +1 -0
- package/dist/src/mcp/tools/supersede.js +30 -0
- package/dist/src/mcp/tools/supersede.js.map +1 -0
- package/dist/src/mcp/tools/team.d.ts +16 -0
- package/dist/src/mcp/tools/team.d.ts.map +1 -0
- package/dist/src/mcp/tools/team.js +32 -0
- package/dist/src/mcp/tools/team.js.map +1 -0
- package/dist/src/obsidian/formatter.d.ts +80 -0
- package/dist/src/obsidian/formatter.d.ts.map +1 -0
- package/dist/src/obsidian/formatter.js +227 -0
- package/dist/src/obsidian/formatter.js.map +1 -0
- package/dist/src/prompts/classification.md +42 -0
- package/dist/src/prompts/extraction.md +45 -0
- package/dist/src/prompts/index.d.ts +13 -0
- package/dist/src/prompts/index.d.ts.map +1 -0
- package/dist/src/prompts/index.js +75 -0
- package/dist/src/prompts/index.js.map +1 -0
- package/dist/src/prompts/session-similarity.md +24 -0
- package/dist/src/prompts/summary.md +9 -0
- package/dist/src/prompts/title.md +8 -0
- package/dist/src/vault/frontmatter.d.ts +6 -0
- package/dist/src/vault/frontmatter.d.ts.map +1 -0
- package/dist/src/vault/frontmatter.js +10 -0
- package/dist/src/vault/frontmatter.js.map +1 -0
- package/dist/src/vault/observations.d.ts +10 -0
- package/dist/src/vault/observations.d.ts.map +1 -0
- package/dist/src/vault/observations.js +33 -0
- package/dist/src/vault/observations.js.map +1 -0
- package/dist/src/vault/reader.d.ts +10 -0
- package/dist/src/vault/reader.d.ts.map +1 -0
- package/dist/src/vault/reader.js +48 -0
- package/dist/src/vault/reader.js.map +1 -0
- package/dist/src/vault/resolve.d.ts +18 -0
- package/dist/src/vault/resolve.d.ts.map +1 -0
- package/dist/src/vault/resolve.js +51 -0
- package/dist/src/vault/resolve.js.map +1 -0
- package/dist/src/vault/session-id.d.ts +16 -0
- package/dist/src/vault/session-id.d.ts.map +1 -0
- package/dist/src/vault/session-id.js +29 -0
- package/dist/src/vault/session-id.js.map +1 -0
- package/dist/src/vault/types.d.ts +88 -0
- package/dist/src/vault/types.d.ts.map +1 -0
- package/dist/src/vault/types.js +94 -0
- package/dist/src/vault/types.js.map +1 -0
- package/dist/src/vault/writer.d.ts +66 -0
- package/dist/src/vault/writer.d.ts.map +1 -0
- package/dist/src/vault/writer.js +217 -0
- package/dist/src/vault/writer.js.map +1 -0
- package/hooks/hooks.json +60 -0
- package/package.json +52 -0
- package/skills/myco/SKILL.md +206 -0
- package/skills/myco/references/wisdom.md +61 -0
- package/skills/rules/SKILL.md +185 -0
- package/skills/rules/references/rules-bad-example.md +106 -0
- package/skills/rules/references/rules-good-example.md +90 -0
package/hooks/hooks.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Myco capture pipeline — session lifecycle hooks for knowledge capture and context injection",
|
|
3
|
+
"hooks": {
|
|
4
|
+
"SessionStart": [
|
|
5
|
+
{
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "node ${CLAUDE_PLUGIN_ROOT}/dist/src/hooks/session-start.js",
|
|
10
|
+
"timeout": 10
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"UserPromptSubmit": [
|
|
16
|
+
{
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "node ${CLAUDE_PLUGIN_ROOT}/dist/src/hooks/user-prompt-submit.js",
|
|
21
|
+
"timeout": 5
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"PostToolUse": [
|
|
27
|
+
{
|
|
28
|
+
"hooks": [
|
|
29
|
+
{
|
|
30
|
+
"type": "command",
|
|
31
|
+
"command": "node ${CLAUDE_PLUGIN_ROOT}/dist/src/hooks/post-tool-use.js",
|
|
32
|
+
"timeout": 5
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"Stop": [
|
|
38
|
+
{
|
|
39
|
+
"hooks": [
|
|
40
|
+
{
|
|
41
|
+
"type": "command",
|
|
42
|
+
"command": "node ${CLAUDE_PLUGIN_ROOT}/dist/src/hooks/stop.js",
|
|
43
|
+
"timeout": 30
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"SessionEnd": [
|
|
49
|
+
{
|
|
50
|
+
"hooks": [
|
|
51
|
+
{
|
|
52
|
+
"type": "command",
|
|
53
|
+
"command": "node ${CLAUDE_PLUGIN_ROOT}/dist/src/hooks/session-end.js",
|
|
54
|
+
"timeout": 10
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@goondocks/myco",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Collective agent intelligence — Claude Code plugin",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"myco": "dist/src/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/",
|
|
13
|
+
"commands/",
|
|
14
|
+
"skills/",
|
|
15
|
+
"hooks/",
|
|
16
|
+
".claude-plugin/",
|
|
17
|
+
"CONTRIBUTING.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"prepare": "npm run build",
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"build:watch": "tsc --watch",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:watch": "vitest",
|
|
25
|
+
"lint": "tsc --noEmit"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/goondocks-co/myco.git"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@anthropic-ai/sdk": "^0.78.0",
|
|
36
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
37
|
+
"better-sqlite3": "^12.8.0",
|
|
38
|
+
"chokidar": "^5.0.0",
|
|
39
|
+
"gray-matter": "^4.0.3",
|
|
40
|
+
"sqlite-vec": "^0.1.0",
|
|
41
|
+
"yaml": "^2.4.0",
|
|
42
|
+
"zod": "^4.3.6"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
46
|
+
"@types/node": "^25.5.0",
|
|
47
|
+
"tsup": "^8.0.0",
|
|
48
|
+
"tsx": "^4.0.0",
|
|
49
|
+
"typescript": "^5.5.0",
|
|
50
|
+
"vitest": "^4.1.0"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: myco
|
|
3
|
+
description: Use when making design decisions, debugging non-obvious issues, encountering gotchas, wondering why code is structured a certain way, or when you need context about prior work on the same feature or component. Myco captures the reasoning, trade-offs, and lessons behind the codebase — things the code itself doesn't show. Also use when the user mentions vault, memories, sessions, team knowledge, institutional memory, or prior decisions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Myco — Collective Agent Intelligence
|
|
7
|
+
|
|
8
|
+
The codebase shows you **what** exists. Myco shows you **why** it exists — why this approach was chosen over alternatives, what broke along the way, what's non-obvious. When you're wondering *why* something is the way it is, or *whether* something was already tried, Myco has the answers.
|
|
9
|
+
|
|
10
|
+
## When to Use Myco
|
|
11
|
+
|
|
12
|
+
Use Myco tools proactively in these situations — don't wait to be asked:
|
|
13
|
+
|
|
14
|
+
- **Before making a design decision** — search for prior reasoning on the same component. Someone may have already evaluated the approach you're considering, or documented why an alternative was rejected.
|
|
15
|
+
- **When debugging a non-obvious issue** — search for the error message, component name, or symptom. A prior session may have hit the same problem and documented the root cause.
|
|
16
|
+
- **When wondering why code is structured a certain way** — decisions and trade-offs behind the architecture are captured as memories.
|
|
17
|
+
- **When continuing work on a feature** — check session history and plan progress for context on what's been done and what's pending.
|
|
18
|
+
- **After discovering a gotcha, making a key decision, or fixing a tricky bug** — save it so future sessions benefit from the knowledge.
|
|
19
|
+
- **When starting work on a branch** — context is injected automatically at session start, but you can call `myco_recall` for deeper context on specific files.
|
|
20
|
+
|
|
21
|
+
## What's Automatic
|
|
22
|
+
|
|
23
|
+
Myco works in the background without explicit tool calls:
|
|
24
|
+
|
|
25
|
+
- **Session start**: relevant context is injected based on your git branch and active plans
|
|
26
|
+
- **During the session**: tool calls, prompts, and responses are buffered as events
|
|
27
|
+
- **Session stop**: the daemon extracts observations, writes session notes, detects parent sessions, and captures artifacts
|
|
28
|
+
- **Lineage**: parent-child session relationships are detected automatically (clear context, same branch, semantic similarity)
|
|
29
|
+
|
|
30
|
+
The MCP tools below are for going deeper than the automatic context injection provides.
|
|
31
|
+
|
|
32
|
+
## Setup
|
|
33
|
+
|
|
34
|
+
If the vault isn't configured, run `/myco-init` to set up. To change LLM providers, run `/myco-setup-llm`. To check health, run `/myco-status`.
|
|
35
|
+
|
|
36
|
+
## MCP Tools Reference
|
|
37
|
+
|
|
38
|
+
### myco_search — Find knowledge across the vault
|
|
39
|
+
|
|
40
|
+
Combined semantic + full-text search across sessions, plans, and memories.
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{ "query": "why did we choose JWT over session cookies", "type": "memory", "limit": 5 }
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**When to use**: searching for prior decisions, debugging context, or understanding rationale. The `type` filter narrows results — use `"memory"` for decisions/gotchas, `"session"` for session history, `"plan"` for plans, or omit for all.
|
|
47
|
+
|
|
48
|
+
**Example**: before choosing an authentication approach, search for prior decisions:
|
|
49
|
+
```json
|
|
50
|
+
{ "query": "authentication approach JWT session", "type": "memory" }
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### myco_recall — Get context for current work
|
|
54
|
+
|
|
55
|
+
Automatic context retrieval based on git branch and files you're working on.
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{ "branch": "feature/auth-redesign", "files": ["src/auth/middleware.ts"] }
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**When to use**: starting work on a feature or wanting deeper context than what was injected at session start. This is the "what do I need to know?" tool.
|
|
62
|
+
|
|
63
|
+
### myco_remember — Save an observation
|
|
64
|
+
|
|
65
|
+
Store a noteworthy observation for future sessions. Only save things that aren't obvious from reading the code.
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{ "content": "better-sqlite3 WASM build fails on Node 22 ARM — must use native build", "type": "gotcha", "tags": ["sqlite", "build"] }
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Observation types:**
|
|
72
|
+
- `gotcha` — non-obvious pitfall, constraint, or workaround
|
|
73
|
+
- `bug_fix` — root cause of a bug and what fixed it
|
|
74
|
+
- `decision` — why an approach was chosen over alternatives
|
|
75
|
+
- `discovery` — significant insight about the codebase, tooling, or domain
|
|
76
|
+
- `trade_off` — what was sacrificed and what was gained
|
|
77
|
+
|
|
78
|
+
**What makes a good observation:**
|
|
79
|
+
- Specific: file names, function names, actual error messages, concrete values
|
|
80
|
+
- Non-obvious: wouldn't be clear from just reading the code
|
|
81
|
+
- Valuable: a teammate encountering the same situation would benefit
|
|
82
|
+
- Durable: not specific to a transient state or one-off debugging session
|
|
83
|
+
|
|
84
|
+
**Bad**: "the auth system is complex"
|
|
85
|
+
**Good**: "bcrypt.compare() silently returns false (not an error) on hash format mismatch — spent 2h debugging; the hash column was VARCHAR(50) but bcrypt outputs 60 chars"
|
|
86
|
+
|
|
87
|
+
### myco_plans — Check plan status
|
|
88
|
+
|
|
89
|
+
List active plans and their progress.
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{ "status": "active" }
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Use `{ "id": "plan-name" }` to read a specific plan's content.
|
|
96
|
+
|
|
97
|
+
### myco_sessions — Browse session history
|
|
98
|
+
|
|
99
|
+
Query past sessions with filters.
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{ "branch": "feature/auth", "limit": 5 }
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Filter by `plan`, `branch`, `user`, or `since` (ISO timestamp). Useful for understanding what work has been done on a feature before continuing it.
|
|
106
|
+
|
|
107
|
+
### myco_graph — Traverse vault connections
|
|
108
|
+
|
|
109
|
+
Follow wikilink connections between notes — find related sessions, memories, and plans.
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{ "note_id": "session-abc123", "direction": "both", "depth": 2 }
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**When to use**: exploring how a decision connects to sessions and other memories, or understanding the lineage of a feature's development across multiple sessions.
|
|
116
|
+
|
|
117
|
+
### myco_orphans — Find disconnected notes
|
|
118
|
+
|
|
119
|
+
Find vault notes with no incoming or outgoing wikilinks — potentially stale or unconnected knowledge.
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### myco_team — See teammate activity
|
|
126
|
+
|
|
127
|
+
See what teammates have been working on, filtered by files or plan.
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{ "plan": "auth-redesign" }
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### myco_logs — Debug the daemon
|
|
134
|
+
|
|
135
|
+
View daemon logs for debugging when sessions aren't being captured, observations are missing, or embeddings fail.
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{ "level": "warn", "component": "processor", "limit": 20 }
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Components: `daemon`, `processor`, `hooks`, `lifecycle`, `embeddings`, `lineage`, `watcher`.
|
|
142
|
+
|
|
143
|
+
### myco_supersede — Mark a memory as replaced
|
|
144
|
+
|
|
145
|
+
When a newer observation makes an older one obsolete, supersede it. The old memory stays in the vault (data is never deleted) but is marked `status: superseded`.
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{ "old_memory_id": "decision-abc123", "new_memory_id": "decision-def456", "reason": "Migrated from bcrypt to argon2" }
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**When to use**: a decision was reversed, a gotcha was fixed, a discovery turned out to be wrong, or the codebase changed and an observation no longer applies.
|
|
152
|
+
|
|
153
|
+
### myco_consolidate — Merge memories into wisdom
|
|
154
|
+
|
|
155
|
+
When multiple memories describe aspects of the same insight, consolidate them into a single comprehensive note. Source memories are marked superseded with links to the new wisdom note.
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"source_memory_ids": ["gotcha-aaa111", "gotcha-bbb222", "gotcha-ccc333"],
|
|
160
|
+
"consolidated_content": "# SQLite Operational Gotchas\n\n1. WAL mode requires shared memory...\n2. Single writer lock...\n3. FTS5 tokenization...",
|
|
161
|
+
"observation_type": "gotcha",
|
|
162
|
+
"tags": ["sqlite", "infrastructure"]
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**When to use**: 3+ memories share a root cause, describe the same pattern from different angles, or would be more useful as a single comprehensive reference.
|
|
167
|
+
|
|
168
|
+
For detailed patterns on when and how to consolidate, read `references/wisdom.md`.
|
|
169
|
+
|
|
170
|
+
## Wisdom — Keeping the Vault Clean
|
|
171
|
+
|
|
172
|
+
Memories are injected into every prompt via the `UserPromptSubmit` hook. Each injected memory includes its ID (e.g., `[decision-abc123]`). When you see an injected memory that contradicts what you just did or know to be outdated, **supersede it immediately** — don't wait to be asked. This is how the vault stays accurate.
|
|
173
|
+
|
|
174
|
+
**Proactive superseding during normal work:**
|
|
175
|
+
|
|
176
|
+
- You just changed how the stop hook works → an injected memory says it works the old way → `myco_supersede` with the old ID and a new `myco_remember` capturing the current behavior
|
|
177
|
+
- You see two injected memories that say conflicting things → supersede the older one
|
|
178
|
+
- An injected gotcha references code that was refactored → supersede it
|
|
179
|
+
|
|
180
|
+
**Other signals to act on:**
|
|
181
|
+
|
|
182
|
+
- **Recurring gotchas**: the same problem keeps being recorded → `myco_consolidate` into one definitive note
|
|
183
|
+
- **Overlapping content**: a `myco_remember` would duplicate an existing memory → `myco_supersede` with updated content instead
|
|
184
|
+
- **Stale decisions**: a decision references a deleted component or reversed approach → supersede it
|
|
185
|
+
|
|
186
|
+
The vault should get sharper over time, not just bigger. Every session should leave the vault more accurate than it found it.
|
|
187
|
+
|
|
188
|
+
## Patterns
|
|
189
|
+
|
|
190
|
+
### Starting work on an existing feature
|
|
191
|
+
|
|
192
|
+
1. `myco_recall` with your branch and key files
|
|
193
|
+
2. `myco_sessions` filtered by branch to see prior session summaries
|
|
194
|
+
3. `myco_plans` to check if there's an active plan
|
|
195
|
+
|
|
196
|
+
### After fixing a tricky bug
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{ "content": "Race condition in session stop: the unregister hook can fire before the stop hook processes the buffer. Fixed by checking buffer existence before deletion.", "type": "bug_fix", "tags": ["daemon", "hooks", "race-condition"] }
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Before making an architectural decision
|
|
203
|
+
|
|
204
|
+
1. `myco_search` for prior decisions on the same component
|
|
205
|
+
2. If you find relevant context, factor it into your recommendation
|
|
206
|
+
3. After the decision is made, `myco_remember` the rationale
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Wisdom Consolidation Patterns
|
|
2
|
+
|
|
3
|
+
When you notice patterns in vault memories — recurring themes, conflicting advice, outdated observations — use these tools to keep the vault clean and its knowledge sharp.
|
|
4
|
+
|
|
5
|
+
## Supersede
|
|
6
|
+
|
|
7
|
+
Use `myco_supersede` when a newer memory replaces an older one.
|
|
8
|
+
|
|
9
|
+
**Signals:**
|
|
10
|
+
- A decision was reversed in a later session
|
|
11
|
+
- A gotcha was fixed and is no longer relevant
|
|
12
|
+
- A discovery turned out to be wrong or incomplete
|
|
13
|
+
- The codebase changed and an observation no longer applies
|
|
14
|
+
|
|
15
|
+
**Example flow:**
|
|
16
|
+
1. You find memory `decision-abc123` saying "we chose bcrypt for password hashing"
|
|
17
|
+
2. A newer memory `decision-def456` says "migrated from bcrypt to argon2 for better side-channel resistance"
|
|
18
|
+
3. Supersede the old one:
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"old_memory_id": "decision-abc123",
|
|
22
|
+
"new_memory_id": "decision-def456",
|
|
23
|
+
"reason": "Auth migrated from bcrypt to argon2"
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The old memory stays in the vault (data is never deleted) but its frontmatter is marked `status: superseded` with a link to the replacement. Search results deprioritize superseded memories.
|
|
28
|
+
|
|
29
|
+
## Consolidate
|
|
30
|
+
|
|
31
|
+
Use `myco_consolidate` when multiple memories describe aspects of the same insight and would be more useful as a single comprehensive note.
|
|
32
|
+
|
|
33
|
+
**Signals:**
|
|
34
|
+
- Three gotchas about the same subsystem that share a root cause
|
|
35
|
+
- Multiple discoveries about the same library that, together, form a complete picture
|
|
36
|
+
- A bug fix and a gotcha that describe the same issue from different angles
|
|
37
|
+
- Several trade-off memories about the same architectural decision
|
|
38
|
+
|
|
39
|
+
**Example flow:**
|
|
40
|
+
1. You find three related gotchas:
|
|
41
|
+
- `gotcha-aaa111`: "SQLite WAL mode requires shared memory — fails in Docker"
|
|
42
|
+
- `gotcha-bbb222`: "SQLite locks on concurrent writes from multiple processes"
|
|
43
|
+
- `gotcha-ccc333`: "SQLite FTS5 tokenizer doesn't handle CamelCase"
|
|
44
|
+
2. Consolidate them into a wisdom note:
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"source_memory_ids": ["gotcha-aaa111", "gotcha-bbb222", "gotcha-ccc333"],
|
|
48
|
+
"consolidated_content": "# SQLite Operational Gotchas\n\nThree key constraints when using SQLite in production:\n\n1. **WAL mode + Docker**: WAL requires shared memory (mmap). Containers with `--tmpfs` or read-only root filesystems break this. Mount the database directory as a named volume.\n\n2. **Concurrent write access**: SQLite serializes all writes through a single writer lock. Multiple processes writing concurrently will get SQLITE_BUSY. Use a single long-lived process (the daemon) for all writes.\n\n3. **FTS5 tokenization**: The default tokenizer splits on non-alphanumeric characters, so CamelCase identifiers like `getUserById` are indexed as one token. Use the `unicode61` tokenizer with `tokenchars` to handle this.",
|
|
49
|
+
"observation_type": "gotcha",
|
|
50
|
+
"tags": ["sqlite", "infrastructure"]
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The source memories are marked `status: superseded` with links to the wisdom note. The wisdom note has `consolidated_from` in its frontmatter linking back to its sources.
|
|
55
|
+
|
|
56
|
+
## When NOT to act
|
|
57
|
+
|
|
58
|
+
- **Don't consolidate unrelated memories** that happen to share tags — they should remain separate observations
|
|
59
|
+
- **Don't supersede a memory just because it's old** — age alone isn't a reason; the content must be outdated or replaced
|
|
60
|
+
- **Don't force consolidation for fewer than 3 sources** — two related memories are fine as separate notes; consolidation adds value when there's a pattern across 3+
|
|
61
|
+
- **Don't consolidate across observation types** unless they truly describe the same insight from different angles (e.g., a bug_fix and a gotcha about the same issue is fine)
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rules
|
|
3
|
+
description: >-
|
|
4
|
+
Use when creating, auditing, or improving project rules files (CLAUDE.md,
|
|
5
|
+
AGENTS.md). Helps write specific, enforceable rules that agents actually
|
|
6
|
+
follow. Also triggered proactively when Myco detects recurring patterns
|
|
7
|
+
that should become project rules.
|
|
8
|
+
allowed-tools: Read, Edit, Write, Bash, Grep, Glob
|
|
9
|
+
user-invocable: true
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Rules — Project Rules File Management
|
|
13
|
+
|
|
14
|
+
Write, audit, and improve project rules files (CLAUDE.md, AGENTS.md) so agents follow them consistently. Rules files are the project's system prompt — they define invariants every agent must follow every time.
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
- **Creating a new rules file** for a project that doesn't have one
|
|
19
|
+
- **Auditing an existing rules file** that agents seem to ignore
|
|
20
|
+
- **Adding a rule** when you identify a pattern that should be standardized
|
|
21
|
+
- **Proactively** when Myco detects recurring observations that suggest a missing rule
|
|
22
|
+
|
|
23
|
+
## What Belongs in a Rules File
|
|
24
|
+
|
|
25
|
+
Rules files contain **project invariants** — things every agent must follow every time, regardless of context.
|
|
26
|
+
|
|
27
|
+
| Belongs in Rules File | Does NOT Belong |
|
|
28
|
+
|----------------------|-----------------|
|
|
29
|
+
| Hard constraints: "All API routes go through `src/routes/`" | Situational context (use Myco context injection) |
|
|
30
|
+
| Golden paths: step-by-step standard procedures | Decision rationale (use Myco memory) |
|
|
31
|
+
| Quality gates: specific commands that must pass | Code documentation (that's the codebase) |
|
|
32
|
+
| Non-goals: what the project is NOT | Anything starting with "try to" or "when possible" |
|
|
33
|
+
|
|
34
|
+
**The test:** If it's an invariant that applies to every session on every branch, it's a rule. If it depends on what you're working on, it's context — let Myco inject it.
|
|
35
|
+
|
|
36
|
+
## Rule Writing Principles
|
|
37
|
+
|
|
38
|
+
These principles apply whether you're writing new rules or auditing existing ones.
|
|
39
|
+
|
|
40
|
+
### Every rule must be specific enough to violate
|
|
41
|
+
|
|
42
|
+
- Bad: "Write clean code"
|
|
43
|
+
- Good: "Functions MUST NOT exceed 50 lines"
|
|
44
|
+
|
|
45
|
+
### Use RFC 2119 language
|
|
46
|
+
|
|
47
|
+
| Keyword | Meaning | Example |
|
|
48
|
+
|---------|---------|---------|
|
|
49
|
+
| **MUST** | Absolute requirement, no exceptions | "All endpoints MUST validate input with Zod" |
|
|
50
|
+
| **SHOULD** | Strong recommendation, exceptions need justification | "Services SHOULD be stateless" |
|
|
51
|
+
| **MAY** | Optional, recognized pattern | "Teams MAY use dependency injection" |
|
|
52
|
+
|
|
53
|
+
Anything weaker than MAY is not a rule. Remove it or strengthen it.
|
|
54
|
+
|
|
55
|
+
### Anchor to real paths
|
|
56
|
+
|
|
57
|
+
- Bad: "Put tests near the code"
|
|
58
|
+
- Good: "Tests MUST be at `tests/<module>.test.ts` mirroring `src/<module>.ts`"
|
|
59
|
+
|
|
60
|
+
### Define deviation lanes for SHOULD rules
|
|
61
|
+
|
|
62
|
+
- "Functions SHOULD NOT exceed 50 lines. Exception: generated code in `src/generated/`."
|
|
63
|
+
|
|
64
|
+
### No loopholes
|
|
65
|
+
|
|
66
|
+
These phrases give agents permission to skip the rule: "when possible", "try to", "consider", "if needed", "as appropriate". Remove them or rephrase as SHOULD with explicit exceptions.
|
|
67
|
+
|
|
68
|
+
## Required Sections
|
|
69
|
+
|
|
70
|
+
A well-formed rules file has these sections. Not all are required for every project, but the skill checks for their absence.
|
|
71
|
+
|
|
72
|
+
### 1. Project Identity
|
|
73
|
+
|
|
74
|
+
What this project is, in one sentence. The anchor everything else hangs on.
|
|
75
|
+
|
|
76
|
+
### 2. Non-Goals
|
|
77
|
+
|
|
78
|
+
What this project is NOT. Prevents agents from "improving" things outside scope. Example: "This is NOT a general-purpose framework. Do not add extensibility points or plugin systems."
|
|
79
|
+
|
|
80
|
+
### 3. Architecture Invariants
|
|
81
|
+
|
|
82
|
+
Hard rules about project structure, anchored to real file paths. Example: "All database queries MUST go through `src/db/queries.ts`. No raw SQL in route handlers."
|
|
83
|
+
|
|
84
|
+
### 4. Golden Paths
|
|
85
|
+
|
|
86
|
+
Step-by-step standard procedures for common operations: add a feature, fix a bug, add a test. Not vibes — a checklist an agent can follow literally. Point to a canonical file to copy.
|
|
87
|
+
|
|
88
|
+
### 5. Quality Gates
|
|
89
|
+
|
|
90
|
+
Specific commands that must pass before work is done. Example: "Before committing: `npm run lint && npm test && npx tsc --noEmit`"
|
|
91
|
+
|
|
92
|
+
## Audit Workflow
|
|
93
|
+
|
|
94
|
+
### Step 1: Discover existing rules files
|
|
95
|
+
|
|
96
|
+
Scan the project root and subdirectories for:
|
|
97
|
+
- `CLAUDE.md` (root and subdirectories)
|
|
98
|
+
- `AGENTS.md` (root)
|
|
99
|
+
|
|
100
|
+
Report what exists and what doesn't. If neither exists, offer to create CLAUDE.md.
|
|
101
|
+
|
|
102
|
+
### Step 2: Run audit checks
|
|
103
|
+
|
|
104
|
+
For each rules file found, check:
|
|
105
|
+
|
|
106
|
+
| Check | What It Catches | Severity |
|
|
107
|
+
|-------|----------------|----------|
|
|
108
|
+
| Missing sections | No non-goals, no quality gates, etc. | Important |
|
|
109
|
+
| Vague rules | "Follow best practices", "keep it clean", "when possible" | Critical |
|
|
110
|
+
| Unanchored rules | References to structure without real file paths | Important |
|
|
111
|
+
| Contradictions | Two rules that conflict with each other | Critical |
|
|
112
|
+
| Bloat | Rules duplicating what linter/tsconfig/CI already enforces | Minor |
|
|
113
|
+
| Missing golden path | Common operations with no documented standard way | Important |
|
|
114
|
+
| Stale anchors | Rules referencing files/paths that no longer exist | Critical |
|
|
115
|
+
|
|
116
|
+
Detect missing golden paths by checking project signals: `package.json` → should have "add dependency" path, `src/routes/` → should have "add endpoint" path, test framework → should have "add test" path. Also ask the developer what common operations they perform.
|
|
117
|
+
|
|
118
|
+
### Step 3: Check Myco observations (if available)
|
|
119
|
+
|
|
120
|
+
Query `myco_search` for recurring observations related to the project. Look for:
|
|
121
|
+
- Gotchas that recur 3+ times (same mistake across sessions)
|
|
122
|
+
- Decisions that state "we should always/never do X"
|
|
123
|
+
- Bug fixes where the root cause was violating an unwritten convention
|
|
124
|
+
|
|
125
|
+
These are rule candidates. Surface them to the developer.
|
|
126
|
+
|
|
127
|
+
### Step 4: Present findings
|
|
128
|
+
|
|
129
|
+
Report findings ranked by severity (critical first). For each finding:
|
|
130
|
+
- What the problem is
|
|
131
|
+
- Why agents exploit it
|
|
132
|
+
- Specific fix text (the exact rule to add, modify, or remove)
|
|
133
|
+
|
|
134
|
+
The developer approves fixes individually or in batch.
|
|
135
|
+
|
|
136
|
+
### Step 5: Apply approved fixes
|
|
137
|
+
|
|
138
|
+
Edit the rules file with approved changes. Never auto-commit — the developer reviews the diff.
|
|
139
|
+
|
|
140
|
+
## Add Rule Workflow
|
|
141
|
+
|
|
142
|
+
### From a developer request
|
|
143
|
+
|
|
144
|
+
1. Developer describes the rule they want
|
|
145
|
+
2. Craft the rule: specific, anchored, RFC 2119 language
|
|
146
|
+
3. Determine placement:
|
|
147
|
+
- **CLAUDE.md** — Rules specific to Claude Code (tool patterns, commit conventions, test commands)
|
|
148
|
+
- **AGENTS.md** — Universal rules any agent should follow (architecture, golden paths, conventions)
|
|
149
|
+
- If only one file exists, put it there
|
|
150
|
+
- If neither exists, create CLAUDE.md
|
|
151
|
+
- If CLAUDE.md contains agent-agnostic rules (architecture, golden paths), suggest creating AGENTS.md and moving them there
|
|
152
|
+
4. Find the correct section (invariant, golden path, quality gate, etc.)
|
|
153
|
+
5. Insert the rule
|
|
154
|
+
6. Developer reviews the diff
|
|
155
|
+
|
|
156
|
+
### Rule Crafting Example
|
|
157
|
+
|
|
158
|
+
Raw observation: "better-sqlite3 WASM build fails on Node 22 ARM — must use native build"
|
|
159
|
+
|
|
160
|
+
Bad rule: "Be careful with sqlite builds"
|
|
161
|
+
|
|
162
|
+
Good rule: "better-sqlite3 MUST be installed with native bindings, not WASM. The WASM build fails on Node 22 ARM. Run `npm install better-sqlite3 --build-from-source` if the default install produces WASM artifacts."
|
|
163
|
+
|
|
164
|
+
### From a Myco observation
|
|
165
|
+
|
|
166
|
+
1. Myco surfaces a pattern: "Your team has hit 3 gotchas about X. Should this become a rule?"
|
|
167
|
+
2. If the developer approves:
|
|
168
|
+
- Craft the rule from the observation
|
|
169
|
+
- The rule states the **what** — the observation (in Myco memory) stores the **why**
|
|
170
|
+
- Place it in the correct file and section
|
|
171
|
+
3. If the developer dismisses: the observation stays as context, not a rule
|
|
172
|
+
|
|
173
|
+
### What stays as memory, NOT a rule
|
|
174
|
+
|
|
175
|
+
Reject promotion for:
|
|
176
|
+
- One-off gotchas unlikely to recur (< 3 occurrences)
|
|
177
|
+
- Decision rationale (the rule states what; memory stores why)
|
|
178
|
+
- Branch-specific or time-limited knowledge
|
|
179
|
+
- Anything that would only matter during a specific initiative
|
|
180
|
+
|
|
181
|
+
## References
|
|
182
|
+
|
|
183
|
+
For examples of well-written and poorly-written rules files:
|
|
184
|
+
- `references/rules-good-example.md` — All five sections done right
|
|
185
|
+
- `references/rules-bad-example.md` — Every anti-pattern annotated with fixes
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Rules File — Bad Example
|
|
2
|
+
|
|
3
|
+
This is an example of a poorly written CLAUDE.md. Every section contains anti-patterns that cause agents to freestyle, skip rules, or misinterpret intent. Each problem is annotated below.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Patchwork
|
|
8
|
+
|
|
9
|
+
A deployment tool. Use best practices and write clean code.
|
|
10
|
+
|
|
11
|
+
Try to follow SOLID principles and keep things simple. Use TypeScript patterns when appropriate.
|
|
12
|
+
We want good test coverage. Avoid hardcoded values when possible.
|
|
13
|
+
|
|
14
|
+
Architecture:
|
|
15
|
+
|
|
16
|
+
- Routes
|
|
17
|
+
- Services
|
|
18
|
+
- Database
|
|
19
|
+
|
|
20
|
+
When adding features, follow the existing patterns and make sure things work.
|
|
21
|
+
Try to add tests for important functionality. Keep the codebase clean.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## What's Wrong (and How Agents Exploit It)
|
|
26
|
+
|
|
27
|
+
### 1. "Use best practices" — vague and unenforceable
|
|
28
|
+
|
|
29
|
+
**Problem:** Every agent interprets "best practices" differently. One agent adds dependency injection, another uses functional patterns, a third invents its own service layer.
|
|
30
|
+
|
|
31
|
+
**Why agents exploit it:** It's permission to do whatever they think is best. They always think their approach is a best practice.
|
|
32
|
+
|
|
33
|
+
**Fix:** Specify the practice. "All request input MUST be validated with Zod schemas in `src/schemas/`."
|
|
34
|
+
|
|
35
|
+
### 2. No non-goals — unlimited scope
|
|
36
|
+
|
|
37
|
+
**Problem:** Without explicit boundaries, agents will "improve" anything they touch. They'll add caching layers, restructure folders, create abstraction hierarchies — all unrequested.
|
|
38
|
+
|
|
39
|
+
**Why agents exploit it:** Agents default to being helpful. Without boundaries, everything looks like an opportunity to improve.
|
|
40
|
+
|
|
41
|
+
**Fix:** Add explicit non-goals: "Patchwork is NOT a deployment orchestrator, NOT a monitoring system, NOT a CI/CD pipeline."
|
|
42
|
+
|
|
43
|
+
### 3. "When appropriate" and "when possible" — loophole generators
|
|
44
|
+
|
|
45
|
+
**Problem:** "Use TypeScript patterns when appropriate" and "avoid hardcoded values when possible" give agents a built-in excuse to skip the rule. They'll decide it's "not appropriate" or "not possible" whenever the rule is inconvenient.
|
|
46
|
+
|
|
47
|
+
**Why agents exploit it:** The qualifying phrase is a release valve. Agents will always find a reason the exception applies.
|
|
48
|
+
|
|
49
|
+
**Fix:** Make it absolute or define the exceptions: "No literal strings or numbers outside of `src/constants.ts`. Exception: test fixture data in `tests/fixtures/`."
|
|
50
|
+
|
|
51
|
+
### 4. No anchors — agents invent patterns
|
|
52
|
+
|
|
53
|
+
**Problem:** "Follow existing patterns" doesn't say which patterns or where to find them. Agents scan the codebase, find three different approaches, and pick whichever they prefer — or invent a fourth.
|
|
54
|
+
|
|
55
|
+
**Why agents exploit it:** Without a canonical example to copy, agents rely on their training data, which includes thousands of different patterns.
|
|
56
|
+
|
|
57
|
+
**Fix:** Point to specific files: "Copy `src/routes/patches.ts` for new endpoints."
|
|
58
|
+
|
|
59
|
+
### 5. "Try to add tests" — permission to skip
|
|
60
|
+
|
|
61
|
+
**Problem:** "Try to" means "do it if you feel like it." Agents will skip tests for "simple changes" or "obvious code."
|
|
62
|
+
|
|
63
|
+
**Why agents exploit it:** Agents optimize for speed. If tests are optional, they're the first thing cut.
|
|
64
|
+
|
|
65
|
+
**Fix:** Make it a gate: "ALL changes MUST include tests. Run `npm test` before committing."
|
|
66
|
+
|
|
67
|
+
### 6. "Keep things clean" — means nothing
|
|
68
|
+
|
|
69
|
+
**Problem:** What does "clean" mean? Short functions? No comments? Lots of comments? Alphabetized imports? Every agent has a different opinion.
|
|
70
|
+
|
|
71
|
+
**Why agents exploit it:** It's a vibes-based instruction. Agents will refactor code to match their idea of "clean," often introducing unnecessary changes.
|
|
72
|
+
|
|
73
|
+
**Fix:** Be specific about what clean means in this project: "Functions MUST NOT exceed 50 lines. Files MUST NOT exceed 300 lines. Imports MUST be grouped: node: built-ins, external packages, internal modules."
|
|
74
|
+
|
|
75
|
+
### 7. Architecture section is just labels
|
|
76
|
+
|
|
77
|
+
**Problem:** "Routes, Services, Database" describes what exists but says nothing about the rules. Can a route call the database directly? Can a service import from routes? Who knows.
|
|
78
|
+
|
|
79
|
+
**Why agents exploit it:** Without layering rules, agents take the shortest path. If the database is faster to call from a route, they'll do it.
|
|
80
|
+
|
|
81
|
+
**Fix:** Define the invariants: "Route handlers delegate to services. Services MUST NOT import from routes. Database access MUST go through `src/db/client.ts`."
|
|
82
|
+
|
|
83
|
+
### 8. No quality gates — "make sure things work" is not a gate
|
|
84
|
+
|
|
85
|
+
**Problem:** "Make sure things work" has no verification step. There's no command to run, no coverage threshold, no lint check.
|
|
86
|
+
|
|
87
|
+
**Why agents exploit it:** If there's no specific command to run, agents won't run anything. They'll eyeball the code and claim it works.
|
|
88
|
+
|
|
89
|
+
**Fix:** List exact commands: "`npm run lint && npm run typecheck && npm test` — ALL must pass before committing."
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## The Pattern
|
|
94
|
+
|
|
95
|
+
Bad rules files share these characteristics:
|
|
96
|
+
|
|
97
|
+
| Anti-Pattern | Example | Why Agents Exploit It |
|
|
98
|
+
|-------------|---------|----------------------|
|
|
99
|
+
| Vague verbs | "should", "try to", "prefer" | Not enforceable — agents treat them as suggestions |
|
|
100
|
+
| No examples | "follow good patterns" | Agents invent patterns from training data |
|
|
101
|
+
| No metrics | "keep coverage high" | Subjective — agents set their own threshold (usually 0%) |
|
|
102
|
+
| Loopholes | "when possible", "if needed" | Built-in excuse to skip the rule |
|
|
103
|
+
| Missing scope | (no non-goals section) | Agents "improve" everything they touch |
|
|
104
|
+
| No gates | "add tests" | No way to verify compliance |
|
|
105
|
+
| Just labels | "Routes, Services, Database" | Describes structure without enforcing rules about it |
|
|
106
|
+
| Aspirational | "keep things clean" | Means whatever the agent wants it to mean |
|