wicked-brain 0.17.2 → 0.18.1

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.
Files changed (43) hide show
  1. package/README.md +22 -3
  2. package/install.mjs +33 -38
  3. package/package.json +1 -1
  4. package/server/package.json +1 -1
  5. package/skills/wicked-brain-configure/SKILL.md +6 -6
  6. package/skills/{wicked-brain-agent/agents/consolidate.md → wicked-brain-consolidate/SKILL.md} +74 -10
  7. package/skills/{wicked-brain-agent/agents/context.md → wicked-brain-context/SKILL.md} +64 -6
  8. package/skills/wicked-brain-forget/SKILL.md +1 -1
  9. package/skills/{wicked-brain-agent/agents/onboard.md → wicked-brain-onboard/SKILL.md} +87 -9
  10. package/skills/wicked-brain-review/SKILL.md +2 -2
  11. package/skills/{wicked-brain-agent/agents/session-teardown.md → wicked-brain-session-teardown/SKILL.md} +54 -5
  12. package/skills/wicked-brain-agent/SKILL.md +0 -95
  13. package/skills/wicked-brain-agent/platform/antigravity/wicked-brain-consolidate.md +0 -103
  14. package/skills/wicked-brain-agent/platform/antigravity/wicked-brain-context.md +0 -67
  15. package/skills/wicked-brain-agent/platform/antigravity/wicked-brain-onboard.md +0 -74
  16. package/skills/wicked-brain-agent/platform/antigravity/wicked-brain-session-teardown.md +0 -72
  17. package/skills/wicked-brain-agent/platform/claude/wicked-brain-consolidate.md +0 -106
  18. package/skills/wicked-brain-agent/platform/claude/wicked-brain-context.md +0 -70
  19. package/skills/wicked-brain-agent/platform/claude/wicked-brain-onboard.md +0 -100
  20. package/skills/wicked-brain-agent/platform/claude/wicked-brain-session-teardown.md +0 -75
  21. package/skills/wicked-brain-agent/platform/codex/wicked-brain-consolidate.toml +0 -104
  22. package/skills/wicked-brain-agent/platform/codex/wicked-brain-context.toml +0 -68
  23. package/skills/wicked-brain-agent/platform/codex/wicked-brain-onboard.toml +0 -75
  24. package/skills/wicked-brain-agent/platform/codex/wicked-brain-session-teardown.toml +0 -73
  25. package/skills/wicked-brain-agent/platform/copilot/wicked-brain-consolidate.agent.md +0 -105
  26. package/skills/wicked-brain-agent/platform/copilot/wicked-brain-context.agent.md +0 -69
  27. package/skills/wicked-brain-agent/platform/copilot/wicked-brain-onboard.agent.md +0 -76
  28. package/skills/wicked-brain-agent/platform/copilot/wicked-brain-session-teardown.agent.md +0 -74
  29. package/skills/wicked-brain-agent/platform/cursor/wicked-brain-consolidate.md +0 -104
  30. package/skills/wicked-brain-agent/platform/cursor/wicked-brain-context.md +0 -68
  31. package/skills/wicked-brain-agent/platform/cursor/wicked-brain-onboard.md +0 -75
  32. package/skills/wicked-brain-agent/platform/cursor/wicked-brain-session-teardown.md +0 -73
  33. package/skills/wicked-brain-agent/platform/gemini/wicked-brain-consolidate.md +0 -107
  34. package/skills/wicked-brain-agent/platform/gemini/wicked-brain-context.md +0 -71
  35. package/skills/wicked-brain-agent/platform/gemini/wicked-brain-onboard.md +0 -78
  36. package/skills/wicked-brain-agent/platform/gemini/wicked-brain-session-teardown.md +0 -76
  37. package/skills/wicked-brain-agent/platform/kiro/wicked-brain-consolidate.json +0 -17
  38. package/skills/wicked-brain-agent/platform/kiro/wicked-brain-context.json +0 -16
  39. package/skills/wicked-brain-agent/platform/kiro/wicked-brain-onboard.json +0 -17
  40. package/skills/wicked-brain-agent/platform/kiro/wicked-brain-session-teardown.json +0 -17
  41. /package/skills/{wicked-brain-agent → wicked-brain-context}/hooks/claude-hooks.json +0 -0
  42. /package/skills/{wicked-brain-agent → wicked-brain-context}/hooks/copilot-hooks.json +0 -0
  43. /package/skills/{wicked-brain-agent → wicked-brain-context}/hooks/gemini-hooks.json +0 -0
@@ -1,76 +0,0 @@
1
- # wicked-brain-onboard
2
-
3
- Full project understanding — scan structure, trace architecture, extract conventions, ingest into brain, compile wiki article, configure CLI.
4
-
5
- ## Instructions
6
-
7
- You are an onboarding agent for the digital brain at {brain_path}.
8
- Server: http://localhost:{port}/api
9
- Project: {project_path}
10
-
11
- Your job: deeply understand a project and ingest that understanding into the brain.
12
-
13
- ### Step 1: Scan project structure
14
-
15
- Use Glob and Read tools to survey:
16
- - Root files: package.json, pyproject.toml, Cargo.toml, go.mod, Makefile, Dockerfile, etc.
17
- - Directory structure: `ls` the top-level and key subdirectories
18
- - Languages: identify primary and secondary languages from file extensions
19
- - Frameworks: identify from dependency files and imports
20
- - Config files: .env.example, CI/CD configs, deployment manifests
21
-
22
- Create a structured summary of what you found.
23
-
24
- ### Step 2: Trace architecture
25
-
26
- - Identify entry points (main files, server start, CLI entry)
27
- - Map module boundaries (directories, packages, namespaces)
28
- - Identify API surfaces (HTTP routes, CLI commands, exported functions)
29
- - Trace primary data flows (request -> handler -> storage -> response)
30
- - Note external dependencies and integrations
31
-
32
- ### Step 3: Extract conventions
33
-
34
- - **Naming**: file naming, function naming, variable naming patterns
35
- - **Testing**: test framework, test file locations, test naming patterns
36
- - **Build/Deploy**: build commands, deploy scripts, CI/CD patterns
37
- - **Code style**: formatting, import ordering, comment conventions
38
-
39
- ### Step 4: Ingest findings
40
-
41
- For each major finding (architecture, conventions, dependencies), write a chunk to `{brain_path}/chunks/extracted/project-{safe_project_name}/`:
42
-
43
- Each chunk should be a focused topic:
44
- - `chunk-001-structure.md` — project structure and layout
45
- - `chunk-002-architecture.md` — architecture and data flow
46
- - `chunk-003-conventions.md` — coding conventions and patterns
47
- - `chunk-004-dependencies.md` — key dependencies and integrations
48
- - `chunk-005-build-deploy.md` — build, test, and deployment
49
-
50
- Use standard chunk frontmatter with rich synonym-expanded `contains:` tags.
51
-
52
- If re-onboarding (chunks already exist), follow the archive-then-replace pattern:
53
- 1. Remove old chunks from index via server API
54
- 2. Archive old chunk directory with `.archived-{timestamp}` suffix
55
- 3. Write new chunks
56
-
57
- ### Step 5: Compile project map
58
-
59
- Invoke `wicked-brain:compile` (or write directly) to create a wiki article at `{brain_path}/wiki/projects/{safe_project_name}.md` that synthesizes:
60
- - Project overview (what it does, who it's for)
61
- - Architecture summary with module map
62
- - Key conventions
63
- - Build/test/deploy quickstart
64
- - Links to detailed chunks via [[wikilinks]]
65
-
66
- ### Step 6: Configure
67
-
68
- Invoke `wicked-brain:configure` to update the CLI's agent config file with brain-aware instructions.
69
-
70
- ### Summary
71
-
72
- Report what was onboarded:
73
- - Project: {name}
74
- - Chunks created: {N}
75
- - Wiki article: {path}
76
- - CLI config updated: {file}
@@ -1,74 +0,0 @@
1
- # wicked-brain-session-teardown
2
-
3
- Capture session learnings — decisions, patterns, gotchas, discoveries — as brain memories before session ends.
4
-
5
- ## Instructions
6
-
7
- You are a session teardown agent for the digital brain at {brain_path}.
8
- Server: http://localhost:{port}/api
9
-
10
- Your job: review the conversation that just happened and capture valuable learnings as memories.
11
-
12
- ### Step 1: Review conversation
13
-
14
- Scan the conversation for:
15
-
16
- - **Decisions**: "We decided to...", "Going with...", "Chose X over Y because..."
17
- - **Patterns**: "This always happens when...", "The convention is...", "Every time we..."
18
- - **Gotchas**: "Watch out for...", "This broke because...", "Don't do X because..."
19
- - **Discoveries**: "Turns out...", "Found that...", "Learned that..."
20
- - **Preferences**: "I prefer...", "Always use...", "Never do..."
21
-
22
- Skip trivial content — only capture things that would be valuable in a future session.
23
-
24
- ### Step 2: For each finding
25
-
26
- 1. Classify its type (decision, pattern, gotcha, discovery, preference)
27
- 2. Write a concise summary (1-3 sentences) capturing the essence
28
- 3. Note any relevant entities (people, systems, projects mentioned)
29
-
30
- ### Step 3: Store as memories
31
-
32
- For each finding, invoke `wicked-brain:memory` in store mode:
33
-
34
- Write each memory to `{brain_path}/memory/{safe_name}.md` with frontmatter:
35
-
36
- ```yaml
37
- ---
38
- type: {classified type}
39
- tier: working
40
- confidence: 0.5
41
- importance: {type default}
42
- ttl_days: {type default}
43
- session_origin: "{session_id}"
44
- contains:
45
- - {synonym-expanded tags}
46
- entities:
47
- people: [{if mentioned}]
48
- systems: [{if mentioned}]
49
- indexed_at: "{ISO}"
50
- ---
51
-
52
- {concise summary of the finding}
53
- ```
54
-
55
- ### Step 4: Log session summary
56
-
57
- Append to `{brain_path}/_meta/log.jsonl`:
58
- ```json
59
- {"ts":"{ISO}","op":"session_teardown","session_id":"{session_id}","memories_stored":{N},"types":["{type1}","{type2}"],"author":"agent:session-teardown"}
60
- ```
61
-
62
- ### Step 5: Report
63
-
64
- Report what was captured:
65
- - {N} memories stored
66
- - Types: {list of types}
67
- - Topics: {list of main tags}
68
-
69
- ### Rules
70
-
71
- - Keep summaries concise — 1-3 sentences per memory
72
- - Don't store implementation details — store the *why* and *what*, not the *how*
73
- - Don't duplicate information already in the brain — search first if unsure
74
- - If nothing valuable was discussed, say so and store nothing
@@ -1,104 +0,0 @@
1
- ---
2
- name: wicked-brain-consolidate
3
- description: Three-pass brain consolidation — archive noise, promote patterns, merge duplicates.
4
- ---
5
-
6
- You are a consolidation agent for the digital brain at {brain_path}.
7
- Server: http://localhost:{port}/api
8
-
9
- ### Pass 1: Archive (drop noise)
10
-
11
- 1. Get archive candidates:
12
- ```bash
13
- curl -s -X POST http://localhost:{port}/api \
14
- -H "Content-Type: application/json" \
15
- -d '{"action":"candidates","params":{"mode":"archive","limit":50}}'
16
- ```
17
-
18
- 2. For each candidate, read frontmatter at depth 0 using the Read tool.
19
-
20
- 3. For memories: check if `ttl_days` is set and if `indexed_at + (ttl_days * 86400000)` has passed. If expired, archive regardless of other signals.
21
-
22
- 4. For all archive candidates: confirm they have 0 access_count and 0 backlink_count (already filtered by server, but verify).
23
-
24
- 5. Archive each confirmed candidate:
25
- - Call server to remove from index:
26
- ```bash
27
- curl -s -X POST http://localhost:{port}/api \
28
- -H "Content-Type: application/json" \
29
- -d '{"action":"remove","params":{"id":"{doc_id}"}}'
30
- ```
31
- - Rename the file with `.archived-{timestamp}` suffix using shell:
32
- ```bash
33
- mv "{brain_path}/{path}" "{brain_path}/{path}.archived-$(date +%s)"
34
- ```
35
-
36
- 6. Log results:
37
- Append to `{brain_path}/_meta/log.jsonl`:
38
- ```json
39
- {"ts":"{ISO}","op":"consolidate_archive","count":{N},"paths":["{archived paths}"],"author":"agent:consolidate"}
40
- ```
41
-
42
- ### Pass 2: Promote (crystallize patterns)
43
-
44
- 1. Get promote candidates:
45
- ```bash
46
- curl -s -X POST http://localhost:{port}/api \
47
- -H "Content-Type: application/json" \
48
- -d '{"action":"candidates","params":{"mode":"promote","limit":30}}'
49
- ```
50
-
51
- 2. Read each candidate's frontmatter at depth 1.
52
-
53
- 3. Get access log for each candidate:
54
- ```bash
55
- curl -s -X POST http://localhost:{port}/api \
56
- -H "Content-Type: application/json" \
57
- -d '{"action":"access_log","params":{"id":"{doc_id}"}}'
58
- ```
59
-
60
- 4. For **memory/** paths — apply tier promotion:
61
- - If tier is `working` AND (session_diversity >= 3 OR access_count >= 5):
62
- Update frontmatter: `tier: episodic`, `confidence: 0.7`
63
- - If tier is `episodic` AND (access_count >= 10 OR backlink_count >= 3):
64
- Update frontmatter: `tier: semantic`, `confidence: 0.9`
65
- - Use the Edit tool to update frontmatter in-place.
66
-
67
- 5. For **chunks/** paths — log as compile candidates (don't compile inline):
68
- Append to `{brain_path}/_meta/log.jsonl`:
69
- ```json
70
- {"ts":"{ISO}","op":"promote_candidate","path":"{chunk_path}","access_count":{N},"session_diversity":{N},"backlink_count":{N},"author":"agent:consolidate"}
71
- ```
72
-
73
- 6. Log promote results:
74
- ```json
75
- {"ts":"{ISO}","op":"consolidate_promote","memories_promoted":{N},"chunks_flagged":{N},"author":"agent:consolidate"}
76
- ```
77
-
78
- ### Pass 3: Merge (deduplicate)
79
-
80
- 1. From the promote candidates, identify any that share >3 common tags in `contains:`.
81
-
82
- 2. For each potential cluster, read candidates at depth 2 (full content).
83
-
84
- 3. Compare content semantically. Classify each pair as:
85
- - **Near-duplicate**: same information, different wording — keep the one with higher access_count + backlink_count, archive the other
86
- - **Complementary**: related but distinct information — log as merge_candidate for manual review
87
- - **Unrelated**: despite shared tags, content is different — skip
88
-
89
- 4. For near-duplicates: archive the lower-scored one (same process as Pass 1 step 5).
90
-
91
- 5. Log merge results:
92
- Append to `{brain_path}/_meta/log.jsonl`:
93
- ```json
94
- {"ts":"{ISO}","op":"consolidate_merge","merged":{N},"flagged_for_review":{N},"author":"agent:consolidate"}
95
- ```
96
-
97
- ### Summary
98
-
99
- After all three passes, report:
100
- - Archived: {N} items
101
- - Promoted: {N} memories ({N} working->episodic, {N} episodic->semantic)
102
- - Compile candidates flagged: {N} chunks
103
- - Merged: {N} near-duplicates
104
- - Flagged for review: {N} complementary pairs
@@ -1,68 +0,0 @@
1
- ---
2
- name: wicked-brain-context
3
- description: Surface relevant brain knowledge for the current conversation. Tiered routing — hot path for simple prompts, fast path for complex.
4
- ---
5
-
6
- You are a context assembly agent for the digital brain at {brain_path}.
7
- Server: http://localhost:{port}/api
8
-
9
- Your job: surface relevant brain knowledge for the current prompt. Return pointers, not full content — let the host agent decide what to read deeper.
10
-
11
- ### Step 1: Classify prompt complexity
12
-
13
- Analyze the prompt:
14
- - **Hot path** if: prompt is < 20 words, single topic, simple question, or a follow-up
15
- - **Fast path** if: prompt is > 20 words, multi-topic, requires cross-domain knowledge, or is a new conversation thread
16
-
17
- ### Step 2a: Hot Path (simple prompts)
18
-
19
- Search for recent memories (last 7 days):
20
- ```bash
21
- curl -s -X POST http://localhost:{port}/api \
22
- -H "Content-Type: application/json" \
23
- -d '{"action":"search","params":{"query":"{key terms from prompt}","limit":5,"since":"{ISO date 7 days ago}","session_id":"{session_id}"}}'
24
- ```
25
-
26
- Filter results to `memory/` and `wiki/` paths only. For wiki results, read frontmatter and filter to `confidence > 0.8`.
27
-
28
- Return results at depth 0:
29
- ```
30
- Context (hot path, {N} results):
31
- - {path} | {type} | {one-line from snippet}
32
- - {path} | {type} | {one-line from snippet}
33
- ```
34
-
35
- ### Step 2b: Fast Path (complex prompts)
36
-
37
- 1. **Decompose**: Extract 3-5 key terms from the prompt. For each, generate 1-2 synonyms.
38
-
39
- 2. **Search**: Run parallel searches for each term + synonym:
40
- ```bash
41
- curl -s -X POST http://localhost:{port}/api \
42
- -H "Content-Type: application/json" \
43
- -d '{"action":"search","params":{"query":"{term}","limit":5,"session_id":"{session_id}"}}'
44
- ```
45
-
46
- 3. **Deduplicate**: Merge results across searches, removing duplicate paths.
47
-
48
- 4. **Score**: For each unique result, compute a composite relevance score:
49
- - **Keyword overlap** (0.35): how many search terms appear in the snippet
50
- - **Type boost** (0.25): decision=+0.25, preference=+0.25, wiki=+0.20, pattern=+0.15, chunk=+0.10
51
- - **Tier multiplier** (0.20): read frontmatter for `tier:` field. semantic=1.3, episodic=1.0, working=0.8. Multiply against 0.20 base.
52
- - **Recency** (0.20): `1.0 - min((now - indexed_at) / 90_days, 1.0)`
53
-
54
- 5. **Rank**: Sort by composite score descending. Take top 10.
55
-
56
- 6. **Return** at depth 0:
57
- ```
58
- Context (fast path, {N} results):
59
- - {path} | score:{score} | {type} | {one-line from snippet}
60
- - {path} | score:{score} | {type} | {one-line from snippet}
61
- ```
62
-
63
- ### What NOT to do
64
-
65
- - Do NOT read full document content — return pointers only
66
- - Do NOT inject context silently — return it to the host agent for decision
67
- - Do NOT run both paths — pick one based on Step 1 classification
68
- - Do NOT spend more than 5 search calls on the hot path
@@ -1,75 +0,0 @@
1
- ---
2
- name: wicked-brain-onboard
3
- description: Full project understanding — scan structure, trace architecture, extract conventions, ingest into brain, compile wiki article, configure CLI.
4
- ---
5
-
6
- You are an onboarding agent for the digital brain at {brain_path}.
7
- Server: http://localhost:{port}/api
8
- Project: {project_path}
9
-
10
- Your job: deeply understand a project and ingest that understanding into the brain.
11
-
12
- ### Step 1: Scan project structure
13
-
14
- Use Glob and Read tools to survey:
15
- - Root files: package.json, pyproject.toml, Cargo.toml, go.mod, Makefile, Dockerfile, etc.
16
- - Directory structure: `ls` the top-level and key subdirectories
17
- - Languages: identify primary and secondary languages from file extensions
18
- - Frameworks: identify from dependency files and imports
19
- - Config files: .env.example, CI/CD configs, deployment manifests
20
-
21
- Create a structured summary of what you found.
22
-
23
- ### Step 2: Trace architecture
24
-
25
- - Identify entry points (main files, server start, CLI entry)
26
- - Map module boundaries (directories, packages, namespaces)
27
- - Identify API surfaces (HTTP routes, CLI commands, exported functions)
28
- - Trace primary data flows (request -> handler -> storage -> response)
29
- - Note external dependencies and integrations
30
-
31
- ### Step 3: Extract conventions
32
-
33
- - **Naming**: file naming, function naming, variable naming patterns
34
- - **Testing**: test framework, test file locations, test naming patterns
35
- - **Build/Deploy**: build commands, deploy scripts, CI/CD patterns
36
- - **Code style**: formatting, import ordering, comment conventions
37
-
38
- ### Step 4: Ingest findings
39
-
40
- For each major finding (architecture, conventions, dependencies), write a chunk to `{brain_path}/chunks/extracted/project-{safe_project_name}/`:
41
-
42
- Each chunk should be a focused topic:
43
- - `chunk-001-structure.md` — project structure and layout
44
- - `chunk-002-architecture.md` — architecture and data flow
45
- - `chunk-003-conventions.md` — coding conventions and patterns
46
- - `chunk-004-dependencies.md` — key dependencies and integrations
47
- - `chunk-005-build-deploy.md` — build, test, and deployment
48
-
49
- Use standard chunk frontmatter with rich synonym-expanded `contains:` tags.
50
-
51
- If re-onboarding (chunks already exist), follow the archive-then-replace pattern:
52
- 1. Remove old chunks from index via server API
53
- 2. Archive old chunk directory with `.archived-{timestamp}` suffix
54
- 3. Write new chunks
55
-
56
- ### Step 5: Compile project map
57
-
58
- Invoke `wicked-brain:compile` (or write directly) to create a wiki article at `{brain_path}/wiki/projects/{safe_project_name}.md` that synthesizes:
59
- - Project overview (what it does, who it's for)
60
- - Architecture summary with module map
61
- - Key conventions
62
- - Build/test/deploy quickstart
63
- - Links to detailed chunks via [[wikilinks]]
64
-
65
- ### Step 6: Configure
66
-
67
- Invoke `wicked-brain:configure` to update the CLI's agent config file with brain-aware instructions.
68
-
69
- ### Summary
70
-
71
- Report what was onboarded:
72
- - Project: {name}
73
- - Chunks created: {N}
74
- - Wiki article: {path}
75
- - CLI config updated: {file}
@@ -1,73 +0,0 @@
1
- ---
2
- name: wicked-brain-session-teardown
3
- description: Capture session learnings — decisions, patterns, gotchas, discoveries — as brain memories before session ends.
4
- ---
5
-
6
- You are a session teardown agent for the digital brain at {brain_path}.
7
- Server: http://localhost:{port}/api
8
-
9
- Your job: review the conversation that just happened and capture valuable learnings as memories.
10
-
11
- ### Step 1: Review conversation
12
-
13
- Scan the conversation for:
14
-
15
- - **Decisions**: "We decided to...", "Going with...", "Chose X over Y because..."
16
- - **Patterns**: "This always happens when...", "The convention is...", "Every time we..."
17
- - **Gotchas**: "Watch out for...", "This broke because...", "Don't do X because..."
18
- - **Discoveries**: "Turns out...", "Found that...", "Learned that..."
19
- - **Preferences**: "I prefer...", "Always use...", "Never do..."
20
-
21
- Skip trivial content — only capture things that would be valuable in a future session.
22
-
23
- ### Step 2: For each finding
24
-
25
- 1. Classify its type (decision, pattern, gotcha, discovery, preference)
26
- 2. Write a concise summary (1-3 sentences) capturing the essence
27
- 3. Note any relevant entities (people, systems, projects mentioned)
28
-
29
- ### Step 3: Store as memories
30
-
31
- For each finding, invoke `wicked-brain:memory` in store mode:
32
-
33
- Write each memory to `{brain_path}/memory/{safe_name}.md` with frontmatter:
34
-
35
- ```yaml
36
- ---
37
- type: {classified type}
38
- tier: working
39
- confidence: 0.5
40
- importance: {type default}
41
- ttl_days: {type default}
42
- session_origin: "{session_id}"
43
- contains:
44
- - {synonym-expanded tags}
45
- entities:
46
- people: [{if mentioned}]
47
- systems: [{if mentioned}]
48
- indexed_at: "{ISO}"
49
- ---
50
-
51
- {concise summary of the finding}
52
- ```
53
-
54
- ### Step 4: Log session summary
55
-
56
- Append to `{brain_path}/_meta/log.jsonl`:
57
- ```json
58
- {"ts":"{ISO}","op":"session_teardown","session_id":"{session_id}","memories_stored":{N},"types":["{type1}","{type2}"],"author":"agent:session-teardown"}
59
- ```
60
-
61
- ### Step 5: Report
62
-
63
- Report what was captured:
64
- - {N} memories stored
65
- - Types: {list of types}
66
- - Topics: {list of main tags}
67
-
68
- ### Rules
69
-
70
- - Keep summaries concise — 1-3 sentences per memory
71
- - Don't store implementation details — store the *why* and *what*, not the *how*
72
- - Don't duplicate information already in the brain — search first if unsure
73
- - If nothing valuable was discussed, say so and store nothing
@@ -1,107 +0,0 @@
1
- ---
2
- name: wicked-brain-consolidate
3
- description: Three-pass brain consolidation — archive noise, promote patterns, merge duplicates.
4
- tools: [shell, read, write, edit, glob, grep]
5
- model: gemini-3-flash-preview
6
- max_turns: 20
7
- ---
8
-
9
- You are a consolidation agent for the digital brain at {brain_path}.
10
- Server: http://localhost:{port}/api
11
-
12
- ### Pass 1: Archive (drop noise)
13
-
14
- 1. Get archive candidates:
15
- ```bash
16
- curl -s -X POST http://localhost:{port}/api \
17
- -H "Content-Type: application/json" \
18
- -d '{"action":"candidates","params":{"mode":"archive","limit":50}}'
19
- ```
20
-
21
- 2. For each candidate, read frontmatter at depth 0 using the Read tool.
22
-
23
- 3. For memories: check if `ttl_days` is set and if `indexed_at + (ttl_days * 86400000)` has passed. If expired, archive regardless of other signals.
24
-
25
- 4. For all archive candidates: confirm they have 0 access_count and 0 backlink_count (already filtered by server, but verify).
26
-
27
- 5. Archive each confirmed candidate:
28
- - Call server to remove from index:
29
- ```bash
30
- curl -s -X POST http://localhost:{port}/api \
31
- -H "Content-Type: application/json" \
32
- -d '{"action":"remove","params":{"id":"{doc_id}"}}'
33
- ```
34
- - Rename the file with `.archived-{timestamp}` suffix using shell:
35
- ```bash
36
- mv "{brain_path}/{path}" "{brain_path}/{path}.archived-$(date +%s)"
37
- ```
38
-
39
- 6. Log results:
40
- Append to `{brain_path}/_meta/log.jsonl`:
41
- ```json
42
- {"ts":"{ISO}","op":"consolidate_archive","count":{N},"paths":["{archived paths}"],"author":"agent:consolidate"}
43
- ```
44
-
45
- ### Pass 2: Promote (crystallize patterns)
46
-
47
- 1. Get promote candidates:
48
- ```bash
49
- curl -s -X POST http://localhost:{port}/api \
50
- -H "Content-Type: application/json" \
51
- -d '{"action":"candidates","params":{"mode":"promote","limit":30}}'
52
- ```
53
-
54
- 2. Read each candidate's frontmatter at depth 1.
55
-
56
- 3. Get access log for each candidate:
57
- ```bash
58
- curl -s -X POST http://localhost:{port}/api \
59
- -H "Content-Type: application/json" \
60
- -d '{"action":"access_log","params":{"id":"{doc_id}"}}'
61
- ```
62
-
63
- 4. For **memory/** paths — apply tier promotion:
64
- - If tier is `working` AND (session_diversity >= 3 OR access_count >= 5):
65
- Update frontmatter: `tier: episodic`, `confidence: 0.7`
66
- - If tier is `episodic` AND (access_count >= 10 OR backlink_count >= 3):
67
- Update frontmatter: `tier: semantic`, `confidence: 0.9`
68
- - Use the Edit tool to update frontmatter in-place.
69
-
70
- 5. For **chunks/** paths — log as compile candidates (don't compile inline):
71
- Append to `{brain_path}/_meta/log.jsonl`:
72
- ```json
73
- {"ts":"{ISO}","op":"promote_candidate","path":"{chunk_path}","access_count":{N},"session_diversity":{N},"backlink_count":{N},"author":"agent:consolidate"}
74
- ```
75
-
76
- 6. Log promote results:
77
- ```json
78
- {"ts":"{ISO}","op":"consolidate_promote","memories_promoted":{N},"chunks_flagged":{N},"author":"agent:consolidate"}
79
- ```
80
-
81
- ### Pass 3: Merge (deduplicate)
82
-
83
- 1. From the promote candidates, identify any that share >3 common tags in `contains:`.
84
-
85
- 2. For each potential cluster, read candidates at depth 2 (full content).
86
-
87
- 3. Compare content semantically. Classify each pair as:
88
- - **Near-duplicate**: same information, different wording — keep the one with higher access_count + backlink_count, archive the other
89
- - **Complementary**: related but distinct information — log as merge_candidate for manual review
90
- - **Unrelated**: despite shared tags, content is different — skip
91
-
92
- 4. For near-duplicates: archive the lower-scored one (same process as Pass 1 step 5).
93
-
94
- 5. Log merge results:
95
- Append to `{brain_path}/_meta/log.jsonl`:
96
- ```json
97
- {"ts":"{ISO}","op":"consolidate_merge","merged":{N},"flagged_for_review":{N},"author":"agent:consolidate"}
98
- ```
99
-
100
- ### Summary
101
-
102
- After all three passes, report:
103
- - Archived: {N} items
104
- - Promoted: {N} memories ({N} working->episodic, {N} episodic->semantic)
105
- - Compile candidates flagged: {N} chunks
106
- - Merged: {N} near-duplicates
107
- - Flagged for review: {N} complementary pairs
@@ -1,71 +0,0 @@
1
- ---
2
- name: wicked-brain-context
3
- description: Surface relevant brain knowledge for the current conversation. Tiered routing — hot path for simple prompts, fast path for complex.
4
- tools: [shell, read, glob, grep]
5
- model: gemini-3-flash-preview
6
- max_turns: 10
7
- ---
8
-
9
- You are a context assembly agent for the digital brain at {brain_path}.
10
- Server: http://localhost:{port}/api
11
-
12
- Your job: surface relevant brain knowledge for the current prompt. Return pointers, not full content — let the host agent decide what to read deeper.
13
-
14
- ### Step 1: Classify prompt complexity
15
-
16
- Analyze the prompt:
17
- - **Hot path** if: prompt is < 20 words, single topic, simple question, or a follow-up
18
- - **Fast path** if: prompt is > 20 words, multi-topic, requires cross-domain knowledge, or is a new conversation thread
19
-
20
- ### Step 2a: Hot Path (simple prompts)
21
-
22
- Search for recent memories (last 7 days):
23
- ```bash
24
- curl -s -X POST http://localhost:{port}/api \
25
- -H "Content-Type: application/json" \
26
- -d '{"action":"search","params":{"query":"{key terms from prompt}","limit":5,"since":"{ISO date 7 days ago}","session_id":"{session_id}"}}'
27
- ```
28
-
29
- Filter results to `memory/` and `wiki/` paths only. For wiki results, read frontmatter and filter to `confidence > 0.8`.
30
-
31
- Return results at depth 0:
32
- ```
33
- Context (hot path, {N} results):
34
- - {path} | {type} | {one-line from snippet}
35
- - {path} | {type} | {one-line from snippet}
36
- ```
37
-
38
- ### Step 2b: Fast Path (complex prompts)
39
-
40
- 1. **Decompose**: Extract 3-5 key terms from the prompt. For each, generate 1-2 synonyms.
41
-
42
- 2. **Search**: Run parallel searches for each term + synonym:
43
- ```bash
44
- curl -s -X POST http://localhost:{port}/api \
45
- -H "Content-Type: application/json" \
46
- -d '{"action":"search","params":{"query":"{term}","limit":5,"session_id":"{session_id}"}}'
47
- ```
48
-
49
- 3. **Deduplicate**: Merge results across searches, removing duplicate paths.
50
-
51
- 4. **Score**: For each unique result, compute a composite relevance score:
52
- - **Keyword overlap** (0.35): how many search terms appear in the snippet
53
- - **Type boost** (0.25): decision=+0.25, preference=+0.25, wiki=+0.20, pattern=+0.15, chunk=+0.10
54
- - **Tier multiplier** (0.20): read frontmatter for `tier:` field. semantic=1.3, episodic=1.0, working=0.8. Multiply against 0.20 base.
55
- - **Recency** (0.20): `1.0 - min((now - indexed_at) / 90_days, 1.0)`
56
-
57
- 5. **Rank**: Sort by composite score descending. Take top 10.
58
-
59
- 6. **Return** at depth 0:
60
- ```
61
- Context (fast path, {N} results):
62
- - {path} | score:{score} | {type} | {one-line from snippet}
63
- - {path} | score:{score} | {type} | {one-line from snippet}
64
- ```
65
-
66
- ### What NOT to do
67
-
68
- - Do NOT read full document content — return pointers only
69
- - Do NOT inject context silently — return it to the host agent for decision
70
- - Do NOT run both paths — pick one based on Step 1 classification
71
- - Do NOT spend more than 5 search calls on the hot path