wicked-brain 0.17.1 → 0.18.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.
Files changed (64) hide show
  1. package/README.md +22 -3
  2. package/install.mjs +29 -38
  3. package/package.json +1 -1
  4. package/server/package.json +1 -1
  5. package/skills/wicked-brain-batch/SKILL.md +1 -1
  6. package/skills/wicked-brain-compile/SKILL.md +1 -1
  7. package/skills/wicked-brain-configure/SKILL.md +7 -7
  8. package/skills/wicked-brain-confirm/SKILL.md +1 -1
  9. package/skills/{wicked-brain-agent/agents/consolidate.md → wicked-brain-consolidate/SKILL.md} +74 -10
  10. package/skills/{wicked-brain-agent/agents/context.md → wicked-brain-context/SKILL.md} +64 -6
  11. package/skills/wicked-brain-dlq/SKILL.md +1 -1
  12. package/skills/wicked-brain-enhance/SKILL.md +1 -1
  13. package/skills/wicked-brain-forget/SKILL.md +2 -2
  14. package/skills/wicked-brain-graph/SKILL.md +1 -1
  15. package/skills/wicked-brain-ingest/SKILL.md +1 -1
  16. package/skills/wicked-brain-init/SKILL.md +1 -1
  17. package/skills/wicked-brain-lint/SKILL.md +1 -1
  18. package/skills/wicked-brain-lsp/SKILL.md +1 -1
  19. package/skills/wicked-brain-memory/SKILL.md +1 -1
  20. package/skills/wicked-brain-migrate/SKILL.md +1 -1
  21. package/skills/{wicked-brain-agent/agents/onboard.md → wicked-brain-onboard/SKILL.md} +87 -9
  22. package/skills/wicked-brain-query/SKILL.md +1 -1
  23. package/skills/wicked-brain-read/SKILL.md +1 -1
  24. package/skills/wicked-brain-retag/SKILL.md +1 -1
  25. package/skills/wicked-brain-review/SKILL.md +3 -3
  26. package/skills/wicked-brain-search/SKILL.md +1 -1
  27. package/skills/wicked-brain-server/SKILL.md +1 -1
  28. package/skills/{wicked-brain-agent/agents/session-teardown.md → wicked-brain-session-teardown/SKILL.md} +54 -5
  29. package/skills/wicked-brain-status/SKILL.md +1 -1
  30. package/skills/wicked-brain-synonyms/SKILL.md +1 -1
  31. package/skills/wicked-brain-ui/SKILL.md +1 -1
  32. package/skills/wicked-brain-update/SKILL.md +1 -1
  33. package/skills/wicked-brain-agent/SKILL.md +0 -95
  34. package/skills/wicked-brain-agent/platform/antigravity/wicked-brain-consolidate.md +0 -103
  35. package/skills/wicked-brain-agent/platform/antigravity/wicked-brain-context.md +0 -67
  36. package/skills/wicked-brain-agent/platform/antigravity/wicked-brain-onboard.md +0 -74
  37. package/skills/wicked-brain-agent/platform/antigravity/wicked-brain-session-teardown.md +0 -72
  38. package/skills/wicked-brain-agent/platform/claude/wicked-brain-consolidate.md +0 -106
  39. package/skills/wicked-brain-agent/platform/claude/wicked-brain-context.md +0 -70
  40. package/skills/wicked-brain-agent/platform/claude/wicked-brain-onboard.md +0 -100
  41. package/skills/wicked-brain-agent/platform/claude/wicked-brain-session-teardown.md +0 -75
  42. package/skills/wicked-brain-agent/platform/codex/wicked-brain-consolidate.toml +0 -104
  43. package/skills/wicked-brain-agent/platform/codex/wicked-brain-context.toml +0 -68
  44. package/skills/wicked-brain-agent/platform/codex/wicked-brain-onboard.toml +0 -75
  45. package/skills/wicked-brain-agent/platform/codex/wicked-brain-session-teardown.toml +0 -73
  46. package/skills/wicked-brain-agent/platform/copilot/wicked-brain-consolidate.agent.md +0 -105
  47. package/skills/wicked-brain-agent/platform/copilot/wicked-brain-context.agent.md +0 -69
  48. package/skills/wicked-brain-agent/platform/copilot/wicked-brain-onboard.agent.md +0 -76
  49. package/skills/wicked-brain-agent/platform/copilot/wicked-brain-session-teardown.agent.md +0 -74
  50. package/skills/wicked-brain-agent/platform/cursor/wicked-brain-consolidate.md +0 -104
  51. package/skills/wicked-brain-agent/platform/cursor/wicked-brain-context.md +0 -68
  52. package/skills/wicked-brain-agent/platform/cursor/wicked-brain-onboard.md +0 -75
  53. package/skills/wicked-brain-agent/platform/cursor/wicked-brain-session-teardown.md +0 -73
  54. package/skills/wicked-brain-agent/platform/gemini/wicked-brain-consolidate.md +0 -107
  55. package/skills/wicked-brain-agent/platform/gemini/wicked-brain-context.md +0 -71
  56. package/skills/wicked-brain-agent/platform/gemini/wicked-brain-onboard.md +0 -78
  57. package/skills/wicked-brain-agent/platform/gemini/wicked-brain-session-teardown.md +0 -76
  58. package/skills/wicked-brain-agent/platform/kiro/wicked-brain-consolidate.json +0 -17
  59. package/skills/wicked-brain-agent/platform/kiro/wicked-brain-context.json +0 -16
  60. package/skills/wicked-brain-agent/platform/kiro/wicked-brain-onboard.json +0 -17
  61. package/skills/wicked-brain-agent/platform/kiro/wicked-brain-session-teardown.json +0 -17
  62. /package/skills/{wicked-brain-agent → wicked-brain-context}/hooks/claude-hooks.json +0 -0
  63. /package/skills/{wicked-brain-agent → wicked-brain-context}/hooks/copilot-hooks.json +0 -0
  64. /package/skills/{wicked-brain-agent → wicked-brain-context}/hooks/gemini-hooks.json +0 -0
@@ -1,9 +1,29 @@
1
- # onboard
1
+ ---
2
+ name: wicked-brain:onboard
3
+ description: |
4
+ Full project understanding - detect repo mode, scan, investigate 5
5
+ perspectives, extract symbols, ingest chunks, compile support wiki,
6
+ configure CLI.
7
+
8
+ Use when: onboarding a new project, re-onboarding after big changes, brain
9
+ has no project wiki yet.
10
+ model: sonnet
11
+ allowed-tools: Read, Write, Edit, Bash, Grep, Glob
12
+ context: fork
13
+ ---
14
+
15
+ # wicked-brain:onboard
16
+
17
+ You are an onboarding agent for the digital brain. This is a heavy
18
+ project-understanding pipeline that runs in an isolated (forked) context so it
19
+ has a longer token budget and file-writing tools for large-scale compilation.
20
+
21
+ ## Overview (pipeline)
2
22
 
3
- ## Depth 0 Summary
4
- Full project understanding pipeline. Scans project, extracts findings from 5 perspectives (product, engineering, quality, ops, data), ingests as structured chunks, compiles a progressive-loading support wiki, and configures the CLI.
23
+ Full project understanding pipeline. Scans project, extracts findings from 5
24
+ perspectives (product, engineering, quality, ops, data), ingests as structured
25
+ chunks, compiles a progressive-loading support wiki, and configures the CLI.
5
26
 
6
- ## Depth 1 — Pipeline Steps
7
27
  0. Detect: run `wicked-brain-onboard-wiki` to classify repo mode, write `.wicked-brain/mode.json`, and stamp the contributor-wiki pointer into CLAUDE.md / AGENTS.md if present
8
28
  1. Scan: directory structure, key files, languages, frameworks, dependencies
9
29
  2. Investigate: gather facts from each of the 5 perspectives
@@ -15,13 +35,40 @@ Full project understanding pipeline. Scans project, extracts findings from 5 per
15
35
  Parameters: brain_path, port, project_path (defaults to cwd)
16
36
  Depends on: wicked-brain:ingest, wicked-brain:compile, wicked-brain:configure
17
37
 
18
- ## Depth 2 — Full Subagent Instructions
38
+ ## Config
39
+
40
+ Resolve the brain config via the shared resolution in
41
+ wicked-brain:init § "Resolving the brain config". In short: try
42
+ `~/.wicked-brain/projects/{cwd_basename}/_meta/config.json` first, fall back
43
+ to `~/.wicked-brain/_meta/config.json` (legacy flat), else trigger
44
+ wicked-brain:init. Read the resolved file for brain path and server port.
45
+
46
+ Do NOT read a bare relative `_meta/config.json` — the model will resolve it
47
+ against the current working directory and brain files will end up in the
48
+ project root.
49
+
50
+ ## Bus event (start)
51
+
52
+ At the start of the run, emit a dispatch event (fire-and-forget — if the bus is
53
+ not installed, silently skip):
54
+
55
+ ```bash
56
+ npx wicked-bus emit \
57
+ --type "wicked.agent.dispatched" \
58
+ --domain "wicked-brain" \
59
+ --subdomain "brain.agent" \
60
+ --payload '{"agent":"onboard","brain_id":"{brain_id}"}' 2>/dev/null || true
61
+ ```
62
+
63
+ ## Pipeline
19
64
 
20
65
  You are an onboarding agent for the digital brain at {brain_path}.
21
66
  Server: http://localhost:{port}/api
22
67
  Project: {project_path}
23
68
 
24
- Your job: deeply understand a project from 5 perspectives and produce a support wiki that serves engineers, testers, ops, and product owners — all through progressive loading so only what's needed gets loaded.
69
+ Your job: deeply understand a project from 5 perspectives and produce a support
70
+ wiki that serves engineers, testers, ops, and product owners — all through
71
+ progressive loading so only what's needed gets loaded.
25
72
 
26
73
  ### Step 0: Detect repo mode and stamp wiki pointer
27
74
 
@@ -80,9 +127,19 @@ Gather facts for each perspective. You'll write these as chunks in Step 4.
80
127
  - Module map: which file owns what responsibility
81
128
  - Data flow: request lifecycle from entry to storage to response
82
129
  - Extension points: where to add new functionality (new action, new migration, new skill)
130
+ - Conventions (so new work matches the repo's style):
131
+ - **Naming**: file, function, and variable naming patterns
132
+ - **Code style**: formatting, comment conventions, and import
133
+ ordering/grouping — detect from config files (`.eslintrc*`, `.eslintrc.json`,
134
+ `.prettierrc`, `pyproject.toml` ruff/black config, `rustfmt.toml`) and from
135
+ grouping in existing source
136
+ - **Build/Deploy/CI-CD**: build commands, deploy scripts, and CI/CD patterns
137
+ (`.github/workflows/`, Makefile targets, package.json scripts, etc.)
83
138
 
84
139
  #### Quality perspective
85
- - Test infrastructure: framework, runner command, test file locations
140
+ - Test infrastructure: framework, runner command, test file locations and
141
+ naming patterns — look for `*.test.*`, `*.spec.*`, `test_*.py`, and files
142
+ under `test/` or `__tests__/`
86
143
  - Test coverage: what's tested, what's manual-only
87
144
  - Functional capabilities: every feature × how to verify it works
88
145
  - Regression requirements: what MUST pass before a release
@@ -177,7 +234,20 @@ List symbols grouped by module/directory:
177
234
 
178
235
  Use standard chunk frontmatter with rich synonym-expanded `contains:` tags.
179
236
 
180
- If re-onboarding (chunks already exist), follow the archive-then-replace pattern:
237
+ #### Monorepo guidance
238
+
239
+ If the project has multiple top-level packages or apps (e.g., a `packages/`,
240
+ `apps/`, or `services/` directory with independent `package.json` / `pyproject.toml`
241
+ files), treat each package as a separate chunk group:
242
+ - Write chunks to `{brain_path}/chunks/extracted/project-{safe_project_name}-{package_name}/`
243
+ - Also write a shared overview chunk at `project-{safe_project_name}/chunk-000-overview.md`
244
+ that summarises the monorepo layout, inter-package relationships, and shared tooling.
245
+
246
+ #### Re-onboarding
247
+
248
+ Re-onboarding is triggered **manually** by the user saying "re-onboard this
249
+ project" (or equivalent). It does not run automatically. When re-onboarding
250
+ (chunks already exist), follow the archive-then-replace pattern:
181
251
  1. Remove old chunks from index via server API
182
252
  2. Archive old chunk directory with `.archived-{timestamp}` suffix
183
253
  3. Write new chunks
@@ -228,7 +298,7 @@ returns at depth 1. Put detail after the first paragraph.
228
298
  | Article | Depth 0 answers | Depth 1 answers | Depth 2 answers |
229
299
  |---------|-----------------|-----------------|-----------------|
230
300
  | product.md | "How many features?" | "What are the features?" | "How do I use each one? What are the limits?" |
231
- | engineering.md | "How many modules/deps?" | "What are the components and how do they connect?" | "What symbols does module X export? How do I extend it?" |
301
+ | engineering.md | "How many modules/deps?" | "What are the components and how do they connect?" | "What symbols does module X export? How do I extend it? What naming/code-style/test/build conventions must I match?" |
232
302
  | quality.md | "What's the test coverage?" | "What capabilities need testing?" | "How do I verify capability X works? What are the edge cases?" |
233
303
  | operations.md | "How many config files?" | "What can go wrong?" | "How do I fix X? Full troubleshooting playbook." |
234
304
  | data.md | "What data sources?" | "What's the schema?" | "What are the constraints? How does the lifecycle work?" |
@@ -248,3 +318,11 @@ Report what was onboarded:
248
318
  - Chunks created: {N} (6 perspective-based)
249
319
  - Wiki articles: {list of 5 articles}
250
320
  - CLI config updated: {file}
321
+
322
+ ## Cross-Platform Notes
323
+
324
+ - `curl` is cross-platform (Windows 10+) — OK for server API calls.
325
+ - The `.archived-{timestamp}` rename on re-onboarding uses shell on
326
+ macOS/Linux; on Windows use the equivalent move. Preserve the
327
+ `.archived-{timestamp}` suffix convention either way.
328
+ - All paths must use forward slashes.
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: wicked-brain:query
2
+ name: wicked-brain-query
3
3
  description: |
4
4
  Answer questions by searching and synthesizing brain content. Dispatches a
5
5
  query subagent that searches, reads, follows links, and produces a cited answer.
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: wicked-brain:read
2
+ name: wicked-brain-read
3
3
  description: |
4
4
  Read a chunk or wiki article from the brain with progressive loading.
5
5
  Depth 0: frontmatter + stats. Depth 1: + summary + headings. Depth 2: full content.
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: wicked-brain:retag
2
+ name: wicked-brain-retag
3
3
  description: |
4
4
  Backfill synonym-expanded tags on chunks and memories that have fewer than
5
5
  5 tags. Run periodically or as part of consolidation.
@@ -1,8 +1,8 @@
1
1
  ---
2
- name: wicked-brain:review
2
+ name: wicked-brain-review
3
3
  description: |
4
4
  Browse stored memories with filters on type, tier, and recency. Read-only —
5
- use wicked-brain:forget to archive or wicked-brain:agent dispatch consolidate
5
+ use wicked-brain:forget to archive or wicked-brain:consolidate
6
6
  to promote.
7
7
 
8
8
  Use when: "review my memories", "browse decisions", "what have I stored",
@@ -79,7 +79,7 @@ Age is derived from `indexed_at` relative to now (`Xd` / `Xh`).
79
79
 
80
80
  After the list, suggest one of:
81
81
  - `wicked-brain:forget path=…` to archive a specific entry
82
- - `wicked-brain:agent dispatch consolidate` to promote patterns and drop expired entries
82
+ - `wicked-brain:consolidate` to promote patterns and drop expired entries
83
83
  - `wicked-brain:retag` if many entries have thin `contains:` arrays
84
84
 
85
85
  ## Notes
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: wicked-brain:search
2
+ name: wicked-brain-search
3
3
  description: |
4
4
  Search the digital brain for relevant content. A single CLI call for the
5
5
  common single-brain case; fans out to linked brains only when they exist.
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: wicked-brain:server
2
+ name: wicked-brain-server
3
3
  description: |
4
4
  Manages the wicked-brain background server. Most callers should use
5
5
  `wicked-brain-call` directly — it auto-starts the server. This skill is
@@ -1,9 +1,28 @@
1
- # session-teardown
1
+ ---
2
+ name: wicked-brain:session-teardown
3
+ description: |
4
+ Capture session learnings - decisions, patterns, gotchas, discoveries - as
5
+ brain memories before session ends.
6
+
7
+ Use when: session/topic is wrapping up, before /clear or exit, user says
8
+ capture what we learned.
9
+ model: sonnet
10
+ allowed-tools: Read, Write, Edit, Bash, Grep, Glob
11
+ context: fork
12
+ ---
13
+
14
+ # wicked-brain:session-teardown
15
+
16
+ You are a session teardown agent for the digital brain. This runs in an
17
+ isolated (forked) context so it has a longer token budget and file-writing
18
+ tools to review the conversation and persist learnings.
2
19
 
3
- ## Depth 0 — Summary
4
- Capture session learnings before exit. Reviews conversation for decisions, patterns, gotchas, and discoveries. Stores each as a memory via wicked-brain:memory.
20
+ ## Overview (pipeline)
21
+
22
+ Capture session learnings before exit. Reviews conversation for decisions,
23
+ patterns, gotchas, and discoveries. Stores each as a memory via
24
+ wicked-brain:memory.
5
25
 
6
- ## Depth 1 — Pipeline Steps
7
26
  1. Review conversation for memorable content (decisions, patterns, gotchas, discoveries)
8
27
  2. For each finding: classify type, generate tags, determine TTL
9
28
  3. Store via wicked-brain:memory skill (store mode)
@@ -12,7 +31,32 @@ Capture session learnings before exit. Reviews conversation for decisions, patte
12
31
  Parameters: brain_path, port, session_id
13
32
  Depends on: wicked-brain:memory skill
14
33
 
15
- ## Depth 2 — Full Subagent Instructions
34
+ ## Config
35
+
36
+ Resolve the brain config via the shared resolution in
37
+ wicked-brain:init § "Resolving the brain config". In short: try
38
+ `~/.wicked-brain/projects/{cwd_basename}/_meta/config.json` first, fall back
39
+ to `~/.wicked-brain/_meta/config.json` (legacy flat), else trigger
40
+ wicked-brain:init. Read the resolved file for brain path and server port.
41
+
42
+ Do NOT read a bare relative `_meta/config.json` — the model will resolve it
43
+ against the current working directory and brain files will end up in the
44
+ project root.
45
+
46
+ ## Bus event (start)
47
+
48
+ At the start of the run, emit a dispatch event (fire-and-forget — if the bus is
49
+ not installed, silently skip):
50
+
51
+ ```bash
52
+ npx wicked-bus emit \
53
+ --type "wicked.agent.dispatched" \
54
+ --domain "wicked-brain" \
55
+ --subdomain "brain.agent" \
56
+ --payload '{"agent":"session-teardown","brain_id":"{brain_id}"}' 2>/dev/null || true
57
+ ```
58
+
59
+ ## Pipeline
16
60
 
17
61
  You are a session teardown agent for the digital brain at {brain_path}.
18
62
  Server: http://localhost:{port}/api
@@ -82,3 +126,8 @@ Report what was captured:
82
126
  - Don't store implementation details — store the *why* and *what*, not the *how*
83
127
  - Don't duplicate information already in the brain — search first if unsure
84
128
  - If nothing valuable was discussed, say so and store nothing
129
+
130
+ ## Cross-Platform Notes
131
+
132
+ - `curl` is cross-platform (Windows 10+) — OK for server API calls.
133
+ - Memory files and log appends must use forward-slash paths.
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: wicked-brain:status
2
+ name: wicked-brain-status
3
3
  description: |
4
4
  Show brain health, stats, and orientation with progressive loading.
5
5
  Depth 0: summary. Depth 1: + topic distribution. Depth 2: full orientation.
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: wicked-brain:synonyms
2
+ name: wicked-brain-synonyms
3
3
  description: |
4
4
  Manage the brain's synonym map for search expansion. Add, remove, or review
5
5
  synonym mappings. Can also auto-suggest synonyms from search miss data and
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: wicked-brain:ui
2
+ name: wicked-brain-ui
3
3
  description: |
4
4
  Open the read-only brain viewer (Material-styled search + wiki browser) in
5
5
  the default web browser. Use when the user says "open the brain viewer",
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: wicked-brain:update
2
+ name: wicked-brain-update
3
3
  description: |
4
4
  Check for and install wicked-brain updates. Compares installed version against
5
5
  npm registry, updates skills across all detected CLIs, and updates the server.
@@ -1,95 +0,0 @@
1
- ---
2
- name: wicked-brain:agent
3
- description: |
4
- This skill should be used when the user says "list brain agents",
5
- "dispatch the consolidation agent", "run brain context assembly",
6
- "onboard a new project", or "session teardown". Factory skill for listing
7
- and dispatching wicked-brain agents. Agents enforce multi-step pipelines
8
- for consolidation, context assembly, session teardown, and project
9
- onboarding.
10
- ---
11
-
12
- # wicked-brain:agent
13
-
14
- Factory skill for wicked-brain agents. Lists available agents and dispatches them.
15
-
16
- ## Config
17
-
18
- Resolve the brain config via the shared resolution in
19
- wicked-brain:init § "Resolving the brain config". In short: try
20
- `~/.wicked-brain/projects/{cwd_basename}/_meta/config.json` first, fall back
21
- to `~/.wicked-brain/_meta/config.json` (legacy flat), else trigger
22
- wicked-brain:init. Read the resolved file for brain path and server port.
23
-
24
- Do NOT read a bare relative `_meta/config.json` — the model will resolve it
25
- against the current working directory and brain files will end up in the
26
- project root.
27
-
28
- ## Parameters
29
-
30
- - **action** (required): `list` or `dispatch`
31
- - **agent** (dispatch mode): name of agent to dispatch (`consolidate`, `context`, `session-teardown`, `onboard`)
32
- - **depth** (list mode, optional): 0 (summary), 1 (pipeline steps), 2 (full instructions). Default: 0.
33
- - **params** (dispatch mode, optional): parameters to pass to the agent
34
-
35
- ## List Mode
36
-
37
- Read agent definitions from the `agents/` subdirectory relative to this skill file. Return at requested depth.
38
-
39
- **Depth 0** — one-line summaries:
40
- - `consolidate`: Three-pass lifecycle — archive noise, promote patterns, merge duplicates
41
- - `context`: Tiered knowledge surfacing — hot path for simple prompts, fast path for complex
42
- - `session-teardown`: Capture session learnings — decisions, patterns, gotchas into memory
43
- - `onboard`: Full project understanding — scan, trace, ingest, compile, configure
44
-
45
- **Depth 1** — pipeline steps (read the agent's `## Depth 1` section)
46
-
47
- **Depth 2** — full subagent instructions (read the agent's `## Depth 2` section)
48
-
49
- ## Dispatch Mode
50
-
51
- Dispatching a named agent (rather than running inline) gives it isolated
52
- context, a longer token budget, and access to file-writing tools. This makes
53
- it better suited for heavy background tasks — consolidation, full project
54
- onboarding, or large-scale compilation — where inline execution would exhaust
55
- context or produce incomplete results.
56
-
57
- 1. Read the requested agent's `.md` file from `agents/` at depth 2
58
- 2. Dispatch as a subagent with those instructions using the host CLI's mechanism:
59
- - Claude Code: use `Agent` tool
60
- - Gemini CLI: `@agent_name` dispatch
61
- - Copilot CLI: `/agent` command
62
- - Other CLIs: inline execution (run the pipeline steps in current context)
63
- 3. Pass brain_path, port, and any additional params to the subagent
64
-
65
- If the host CLI does not support subagent dispatch, fall back to inline execution — run the pipeline steps directly in the current context.
66
-
67
- ## Bus Events
68
-
69
- When dispatching an agent, emit:
70
-
71
- ```bash
72
- npx wicked-bus emit \
73
- --type "wicked.agent.dispatched" \
74
- --domain "wicked-brain" \
75
- --subdomain "brain.agent" \
76
- --payload '{"agent":"{agent_name}","brain_id":"{brain_id}"}' 2>/dev/null || true
77
- ```
78
-
79
- The consolidate agent should also emit `wicked.brain.consolidated` on completion:
80
-
81
- ```bash
82
- npx wicked-bus emit \
83
- --type "wicked.brain.consolidated" \
84
- --domain "wicked-brain" \
85
- --subdomain "brain" \
86
- --payload '{"brain_id":"{brain_id}","archived":{N},"promoted":{M},"merged":{P}}' 2>/dev/null || true
87
- ```
88
-
89
- Fire-and-forget — if the bus is not installed, silently skip.
90
-
91
- ## Cross-Platform Notes
92
-
93
- - Agent definitions are portable markdown — they work on all platforms
94
- - Dispatch mechanism varies by CLI but instructions are identical
95
- - Factory skill uses Read tool to load agent files (not shell commands)
@@ -1,103 +0,0 @@
1
- # wicked-brain-consolidate
2
-
3
- Three-pass brain consolidation — archive noise, promote patterns, merge duplicates. Use when brain needs maintenance or after significant ingestion.
4
-
5
- You are a consolidation agent for the digital brain at {brain_path}.
6
- Server: http://localhost:{port}/api
7
-
8
- ### Pass 1: Archive (drop noise)
9
-
10
- 1. Get archive candidates:
11
- ```bash
12
- curl -s -X POST http://localhost:{port}/api \
13
- -H "Content-Type: application/json" \
14
- -d '{"action":"candidates","params":{"mode":"archive","limit":50}}'
15
- ```
16
-
17
- 2. For each candidate, read frontmatter at depth 0 using the Read tool.
18
-
19
- 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.
20
-
21
- 4. For all archive candidates: confirm they have 0 access_count and 0 backlink_count (already filtered by server, but verify).
22
-
23
- 5. Archive each confirmed candidate:
24
- - Call server to remove from index:
25
- ```bash
26
- curl -s -X POST http://localhost:{port}/api \
27
- -H "Content-Type: application/json" \
28
- -d '{"action":"remove","params":{"id":"{doc_id}"}}'
29
- ```
30
- - Rename the file with `.archived-{timestamp}` suffix using shell:
31
- ```bash
32
- mv "{brain_path}/{path}" "{brain_path}/{path}.archived-$(date +%s)"
33
- ```
34
-
35
- 6. Log results:
36
- Append to `{brain_path}/_meta/log.jsonl`:
37
- ```json
38
- {"ts":"{ISO}","op":"consolidate_archive","count":{N},"paths":["{archived paths}"],"author":"agent:consolidate"}
39
- ```
40
-
41
- ### Pass 2: Promote (crystallize patterns)
42
-
43
- 1. Get promote candidates:
44
- ```bash
45
- curl -s -X POST http://localhost:{port}/api \
46
- -H "Content-Type: application/json" \
47
- -d '{"action":"candidates","params":{"mode":"promote","limit":30}}'
48
- ```
49
-
50
- 2. Read each candidate's frontmatter at depth 1.
51
-
52
- 3. Get access log for each candidate:
53
- ```bash
54
- curl -s -X POST http://localhost:{port}/api \
55
- -H "Content-Type: application/json" \
56
- -d '{"action":"access_log","params":{"id":"{doc_id}"}}'
57
- ```
58
-
59
- 4. For **memory/** paths — apply tier promotion:
60
- - If tier is `working` AND (session_diversity >= 3 OR access_count >= 5):
61
- Update frontmatter: `tier: episodic`, `confidence: 0.7`
62
- - If tier is `episodic` AND (access_count >= 10 OR backlink_count >= 3):
63
- Update frontmatter: `tier: semantic`, `confidence: 0.9`
64
- - Use the Edit tool to update frontmatter in-place.
65
-
66
- 5. For **chunks/** paths — log as compile candidates (don't compile inline):
67
- Append to `{brain_path}/_meta/log.jsonl`:
68
- ```json
69
- {"ts":"{ISO}","op":"promote_candidate","path":"{chunk_path}","access_count":{N},"session_diversity":{N},"backlink_count":{N},"author":"agent:consolidate"}
70
- ```
71
-
72
- 6. Log promote results:
73
- ```json
74
- {"ts":"{ISO}","op":"consolidate_promote","memories_promoted":{N},"chunks_flagged":{N},"author":"agent:consolidate"}
75
- ```
76
-
77
- ### Pass 3: Merge (deduplicate)
78
-
79
- 1. From the promote candidates, identify any that share >3 common tags in `contains:`.
80
-
81
- 2. For each potential cluster, read candidates at depth 2 (full content).
82
-
83
- 3. Compare content semantically. Classify each pair as:
84
- - **Near-duplicate**: same information, different wording — keep the one with higher access_count + backlink_count, archive the other
85
- - **Complementary**: related but distinct information — log as merge_candidate for manual review
86
- - **Unrelated**: despite shared tags, content is different — skip
87
-
88
- 4. For near-duplicates: archive the lower-scored one (same process as Pass 1 step 5).
89
-
90
- 5. Log merge results:
91
- Append to `{brain_path}/_meta/log.jsonl`:
92
- ```json
93
- {"ts":"{ISO}","op":"consolidate_merge","merged":{N},"flagged_for_review":{N},"author":"agent:consolidate"}
94
- ```
95
-
96
- ### Summary
97
-
98
- After all three passes, report:
99
- - Archived: {N} items
100
- - Promoted: {N} memories ({N} working->episodic, {N} episodic->semantic)
101
- - Compile candidates flagged: {N} chunks
102
- - Merged: {N} near-duplicates
103
- - Flagged for review: {N} complementary pairs
@@ -1,67 +0,0 @@
1
- # wicked-brain-context
2
-
3
- Surface relevant brain knowledge for the current conversation. Tiered routing — hot path for simple prompts, fast path for complex.
4
-
5
- You are a context assembly agent for the digital brain at {brain_path}.
6
- Server: http://localhost:{port}/api
7
-
8
- Your job: surface relevant brain knowledge for the current prompt. Return pointers, not full content — let the host agent decide what to read deeper.
9
-
10
- ### Step 1: Classify prompt complexity
11
-
12
- Analyze the prompt:
13
- - **Hot path** if: prompt is < 20 words, single topic, simple question, or a follow-up
14
- - **Fast path** if: prompt is > 20 words, multi-topic, requires cross-domain knowledge, or is a new conversation thread
15
-
16
- ### Step 2a: Hot Path (simple prompts)
17
-
18
- Search for recent memories (last 7 days):
19
- ```bash
20
- curl -s -X POST http://localhost:{port}/api \
21
- -H "Content-Type: application/json" \
22
- -d '{"action":"search","params":{"query":"{key terms from prompt}","limit":5,"since":"{ISO date 7 days ago}","session_id":"{session_id}"}}'
23
- ```
24
-
25
- Filter results to `memory/` and `wiki/` paths only. For wiki results, read frontmatter and filter to `confidence > 0.8`.
26
-
27
- Return results at depth 0:
28
- ```
29
- Context (hot path, {N} results):
30
- - {path} | {type} | {one-line from snippet}
31
- - {path} | {type} | {one-line from snippet}
32
- ```
33
-
34
- ### Step 2b: Fast Path (complex prompts)
35
-
36
- 1. **Decompose**: Extract 3-5 key terms from the prompt. For each, generate 1-2 synonyms.
37
-
38
- 2. **Search**: Run parallel searches for each term + synonym:
39
- ```bash
40
- curl -s -X POST http://localhost:{port}/api \
41
- -H "Content-Type: application/json" \
42
- -d '{"action":"search","params":{"query":"{term}","limit":5,"session_id":"{session_id}"}}'
43
- ```
44
-
45
- 3. **Deduplicate**: Merge results across searches, removing duplicate paths.
46
-
47
- 4. **Score**: For each unique result, compute a composite relevance score:
48
- - **Keyword overlap** (0.35): how many search terms appear in the snippet
49
- - **Type boost** (0.25): decision=+0.25, preference=+0.25, wiki=+0.20, pattern=+0.15, chunk=+0.10
50
- - **Tier multiplier** (0.20): read frontmatter for `tier:` field. semantic=1.3, episodic=1.0, working=0.8. Multiply against 0.20 base.
51
- - **Recency** (0.20): `1.0 - min((now - indexed_at) / 90_days, 1.0)`
52
-
53
- 5. **Rank**: Sort by composite score descending. Take top 10.
54
-
55
- 6. **Return** at depth 0:
56
- ```
57
- Context (fast path, {N} results):
58
- - {path} | score:{score} | {type} | {one-line from snippet}
59
- - {path} | score:{score} | {type} | {one-line from snippet}
60
- ```
61
-
62
- ### What NOT to do
63
-
64
- - Do NOT read full document content — return pointers only
65
- - Do NOT inject context silently — return it to the host agent for decision
66
- - Do NOT run both paths — pick one based on Step 1 classification
67
- - Do NOT spend more than 5 search calls on the hot path
@@ -1,74 +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
- You are an onboarding agent for the digital brain at {brain_path}.
6
- Server: http://localhost:{port}/api
7
- Project: {project_path}
8
-
9
- Your job: deeply understand a project and ingest that understanding into the brain.
10
-
11
- ### Step 1: Scan project structure
12
-
13
- Use Glob and Read tools to survey:
14
- - Root files: package.json, pyproject.toml, Cargo.toml, go.mod, Makefile, Dockerfile, etc.
15
- - Directory structure: `ls` the top-level and key subdirectories
16
- - Languages: identify primary and secondary languages from file extensions
17
- - Frameworks: identify from dependency files and imports
18
- - Config files: .env.example, CI/CD configs, deployment manifests
19
-
20
- Create a structured summary of what you found.
21
-
22
- ### Step 2: Trace architecture
23
-
24
- - Identify entry points (main files, server start, CLI entry)
25
- - Map module boundaries (directories, packages, namespaces)
26
- - Identify API surfaces (HTTP routes, CLI commands, exported functions)
27
- - Trace primary data flows (request -> handler -> storage -> response)
28
- - Note external dependencies and integrations
29
-
30
- ### Step 3: Extract conventions
31
-
32
- - **Naming**: file naming, function naming, variable naming patterns
33
- - **Testing**: test framework, test file locations, test naming patterns
34
- - **Build/Deploy**: build commands, deploy scripts, CI/CD patterns
35
- - **Code style**: formatting, import ordering, comment conventions
36
-
37
- ### Step 4: Ingest findings
38
-
39
- For each major finding (architecture, conventions, dependencies), write a chunk to `{brain_path}/chunks/extracted/project-{safe_project_name}/`:
40
-
41
- Each chunk should be a focused topic:
42
- - `chunk-001-structure.md` — project structure and layout
43
- - `chunk-002-architecture.md` — architecture and data flow
44
- - `chunk-003-conventions.md` — coding conventions and patterns
45
- - `chunk-004-dependencies.md` — key dependencies and integrations
46
- - `chunk-005-build-deploy.md` — build, test, and deployment
47
-
48
- Use standard chunk frontmatter with rich synonym-expanded `contains:` tags.
49
-
50
- If re-onboarding (chunks already exist), follow the archive-then-replace pattern:
51
- 1. Remove old chunks from index via server API
52
- 2. Archive old chunk directory with `.archived-{timestamp}` suffix
53
- 3. Write new chunks
54
-
55
- ### Step 5: Compile project map
56
-
57
- Invoke `wicked-brain:compile` (or write directly) to create a wiki article at `{brain_path}/wiki/projects/{safe_project_name}.md` that synthesizes:
58
- - Project overview (what it does, who it's for)
59
- - Architecture summary with module map
60
- - Key conventions
61
- - Build/test/deploy quickstart
62
- - Links to detailed chunks via [[wikilinks]]
63
-
64
- ### Step 6: Configure
65
-
66
- Invoke `wicked-brain:configure` to update the CLI's agent config file with brain-aware instructions.
67
-
68
- ### Summary
69
-
70
- Report what was onboarded:
71
- - Project: {name}
72
- - Chunks created: {N}
73
- - Wiki article: {path}
74
- - CLI config updated: {file}