@polderlabs/bizar 3.16.0 → 3.19.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/cli/{plan-templates.mjs → artifact-templates.mjs} +26 -26
- package/cli/{plan.mjs → artifact.mjs} +134 -134
- package/cli/{plan.test.mjs → artifact.test.mjs} +108 -108
- package/cli/banner.mjs +1 -1
- package/cli/bin.mjs +9 -33
- package/cli/install.mjs +1 -1
- package/cli/prompts.mjs +2 -2
- package/config/AGENTS.md +9 -51
- package/config/agents/baldr.md +2 -24
- package/config/agents/browser-harness.md +80 -0
- package/config/agents/forseti.md +1 -23
- package/config/agents/frigg.md +3 -24
- package/config/agents/heimdall.md +2 -24
- package/config/agents/hermod.md +1 -23
- package/config/agents/mimir.md +1 -23
- package/config/agents/odin.md +1 -25
- package/config/agents/quick.md +1 -18
- package/config/agents/semble-search.md +1 -1
- package/config/agents/thor.md +2 -29
- package/config/agents/tyr.md +2 -29
- package/config/agents/vidarr.md +1 -28
- package/config/agents/vor.md +6 -28
- package/config/opencode.json.template +2 -16
- package/config/rules/uncertainty.md +1 -1
- package/config/skills/bizar/SKILL.md +1 -1
- package/package.json +1 -1
- package/cli/graph-build-from-cache.mjs +0 -124
- package/cli/graph.mjs +0 -642
- package/cli/graph.test.mjs +0 -218
package/config/agents/quick.md
CHANGED
|
@@ -15,8 +15,6 @@ permission:
|
|
|
15
15
|
webfetch: allow
|
|
16
16
|
websearch: allow
|
|
17
17
|
task: deny
|
|
18
|
-
hindsight_recall: allow
|
|
19
|
-
hindsight_retain: allow
|
|
20
18
|
---
|
|
21
19
|
|
|
22
20
|
## Codebase Search — Use Semble First
|
|
@@ -62,21 +60,6 @@ If a task requires:
|
|
|
62
60
|
|
|
63
61
|
…then tell the user to use `@odin` instead. You are not a router.
|
|
64
62
|
|
|
65
|
-
## Hindsight Memory Protocol
|
|
66
|
-
|
|
67
|
-
You MUST use **per-project banks** — never the default bank for project work.
|
|
68
|
-
|
|
69
|
-
### Bank Selection
|
|
70
|
-
1. Call `hindsight_list_banks` to discover available banks
|
|
71
|
-
2. Use `bank_id: "<project-name>"` in all Hindsight calls
|
|
72
|
-
3. If no bank exists for the project, create it with `hindsight_create_bank(bank_id: "<project-name>")`
|
|
73
|
-
4. The default bank is for general/system knowledge only
|
|
74
|
-
|
|
75
|
-
### Before Work
|
|
76
|
-
- `hindsight_recall` with the correct `bank_id` for existing context
|
|
77
|
-
|
|
78
|
-
### After Work
|
|
79
|
-
- `hindsight_retain` completion summary into the project bank
|
|
80
63
|
|
|
81
64
|
## Loop Guard Handling
|
|
82
65
|
|
|
@@ -102,4 +85,4 @@ When uncertain or stuck, follow `config/rules/uncertainty.md` — stop and resea
|
|
|
102
85
|
|
|
103
86
|
**Follow the global baseline in `config/AGENTS.md` → "General Agent Baseline — Always-On Behavior".** It covers identity, refusal, tone, formatting, lists, user wellbeing, evenhandedness, mistakes, knowledge cutoff and research-first, MCP servers and skills, mandatory skill-read, file creation, file handling, search, copyright, harmful content, citations, images, memory privacy, execution, clarification, and communication.
|
|
104
87
|
|
|
105
|
-
The section above was adapted from the upstream Claude Fable 5 system prompt, with every Claude-specific tool / function / directory translated to the BizarHarness equivalent (opencode tools, Semble, Skills CLI,
|
|
88
|
+
The section above was adapted from the upstream Claude Fable 5 system prompt, with every Claude-specific tool / function / directory translated to the BizarHarness equivalent (opencode tools, Semble, Skills CLI, Obsidian, agent-browser, the dashboard artifact pipeline). Do not duplicate the rules here — read the global baseline and apply it.
|
|
@@ -59,4 +59,4 @@ When uncertain or stuck, follow `config/rules/uncertainty.md` — stop and resea
|
|
|
59
59
|
|
|
60
60
|
**Follow the global baseline in `config/AGENTS.md` → "General Agent Baseline — Always-On Behavior".** It covers identity, refusal, tone, formatting, lists, user wellbeing, evenhandedness, mistakes, knowledge cutoff and research-first, MCP servers and skills, mandatory skill-read, file creation, file handling, search, copyright, harmful content, citations, images, memory privacy, execution, clarification, and communication.
|
|
61
61
|
|
|
62
|
-
The section above was adapted from the upstream Claude Fable 5 system prompt, with every Claude-specific tool / function / directory translated to the BizarHarness equivalent (opencode tools, Semble, Skills CLI,
|
|
62
|
+
The section above was adapted from the upstream Claude Fable 5 system prompt, with every Claude-specific tool / function / directory translated to the BizarHarness equivalent (opencode tools, Semble, Skills CLI, Obsidian, agent-browser, the dashboard artifact pipeline). Do not duplicate the rules here — read the global baseline and apply it.
|
package/config/agents/thor.md
CHANGED
|
@@ -13,8 +13,6 @@ permission:
|
|
|
13
13
|
todowrite: allow
|
|
14
14
|
webfetch: allow
|
|
15
15
|
websearch: allow
|
|
16
|
-
hindsight_recall: allow
|
|
17
|
-
hindsight_retain: allow
|
|
18
16
|
---
|
|
19
17
|
|
|
20
18
|
## Codebase Search — Use Semble First
|
|
@@ -54,37 +52,12 @@ You do NOT do codebase research or exploration — that goes to @mimir.
|
|
|
54
52
|
## Tools Available
|
|
55
53
|
|
|
56
54
|
- Semble search for codebase context (quick lookups only, not deep research)
|
|
57
|
-
|
|
55
|
+
|
|
58
56
|
- read, write, edit, glob, grep for file operations
|
|
59
57
|
- bash for commands
|
|
60
58
|
- webfetch, websearch for external information
|
|
61
59
|
- todowrite for tracking multi-step progress
|
|
62
60
|
|
|
63
|
-
## Hindsight Memory Protocol
|
|
64
|
-
|
|
65
|
-
You MUST use **per-project banks** — never the default bank for project work.
|
|
66
|
-
|
|
67
|
-
### Bank Selection
|
|
68
|
-
1. Call `hindsight_list_banks` to discover available banks
|
|
69
|
-
2. Use `bank_id: "<project-name>"` in all Hindsight calls
|
|
70
|
-
3. If no bank exists for the project, create it with `hindsight_create_bank(bank_id: "<project-name>")`
|
|
71
|
-
4. The default bank is for general/system knowledge only
|
|
72
|
-
|
|
73
|
-
### Before Work
|
|
74
|
-
- `hindsight_recall` with the correct `bank_id` for existing context
|
|
75
|
-
|
|
76
|
-
### During Work
|
|
77
|
-
- `hindsight_retain` important findings with the correct `bank_id`
|
|
78
|
-
- Tag memories with `project:<repo-name>`
|
|
79
|
-
|
|
80
|
-
### After Work
|
|
81
|
-
- `hindsight_retain` completion summary into the project bank
|
|
82
|
-
- Create or update mental models for sustained project context
|
|
83
|
-
|
|
84
|
-
### Auto Self-Improvement
|
|
85
|
-
- After completing work, Odin dispatches @heimdall to auto-extract patterns from this session
|
|
86
|
-
- Include in your output: key decisions made, bugs encountered, patterns worth remembering
|
|
87
|
-
- This happens automatically — you do not need to request it
|
|
88
61
|
|
|
89
62
|
## Loop Guard Handling
|
|
90
63
|
|
|
@@ -144,4 +117,4 @@ End your final summary with: `Siblings: <list>. Conflicts: <list or "none">. Git
|
|
|
144
117
|
|
|
145
118
|
**Follow the global baseline in `config/AGENTS.md` → "General Agent Baseline — Always-On Behavior".** It covers identity, refusal, tone, formatting, lists, user wellbeing, evenhandedness, mistakes, knowledge cutoff and research-first, MCP servers and skills, mandatory skill-read, file creation, file handling, search, copyright, harmful content, citations, images, memory privacy, execution, clarification, and communication.
|
|
146
119
|
|
|
147
|
-
The section above was adapted from the upstream Claude Fable 5 system prompt, with every Claude-specific tool / function / directory translated to the BizarHarness equivalent (opencode tools, Semble, Skills CLI,
|
|
120
|
+
The section above was adapted from the upstream Claude Fable 5 system prompt, with every Claude-specific tool / function / directory translated to the BizarHarness equivalent (opencode tools, Semble, Skills CLI, Obsidian, agent-browser, the dashboard artifact pipeline). Do not duplicate the rules here — read the global baseline and apply it.
|
package/config/agents/tyr.md
CHANGED
|
@@ -13,8 +13,6 @@ permission:
|
|
|
13
13
|
todowrite: allow
|
|
14
14
|
webfetch: allow
|
|
15
15
|
websearch: allow
|
|
16
|
-
hindsight_recall: allow
|
|
17
|
-
hindsight_retain: allow
|
|
18
16
|
---
|
|
19
17
|
|
|
20
18
|
## Codebase Search — Use Semble First
|
|
@@ -53,37 +51,12 @@ Odin sends you only the most demanding tasks:
|
|
|
53
51
|
## Tools Available
|
|
54
52
|
|
|
55
53
|
- Semble search for codebase exploration
|
|
56
|
-
|
|
54
|
+
|
|
57
55
|
- read, write, edit, glob, grep for file operations
|
|
58
56
|
- bash for commands
|
|
59
57
|
- webfetch, websearch for external information
|
|
60
58
|
- todowrite for tracking multi-step progress
|
|
61
59
|
|
|
62
|
-
## Hindsight Memory Protocol
|
|
63
|
-
|
|
64
|
-
You MUST use **per-project banks** — never the default bank for project work.
|
|
65
|
-
|
|
66
|
-
### Bank Selection
|
|
67
|
-
1. Call `hindsight_list_banks` to discover available banks
|
|
68
|
-
2. Use `bank_id: "<project-name>"` in all Hindsight calls
|
|
69
|
-
3. If no bank exists for the project, create it with `hindsight_create_bank(bank_id: "<project-name>")`
|
|
70
|
-
4. The default bank is for general/system knowledge only
|
|
71
|
-
|
|
72
|
-
### Before Work
|
|
73
|
-
- `hindsight_recall` with the correct `bank_id` for existing context
|
|
74
|
-
|
|
75
|
-
### During Work
|
|
76
|
-
- `hindsight_retain` important findings with the correct `bank_id`
|
|
77
|
-
- Tag memories with `project:<repo-name>`
|
|
78
|
-
|
|
79
|
-
### After Work
|
|
80
|
-
- `hindsight_retain` completion summary into the project bank
|
|
81
|
-
- Create or update mental models for sustained project context
|
|
82
|
-
|
|
83
|
-
### Auto Self-Improvement
|
|
84
|
-
- After completing work, Odin dispatches @heimdall to auto-extract patterns from this session
|
|
85
|
-
- Include in your output: key decisions made, bugs encountered, patterns worth remembering
|
|
86
|
-
- This happens automatically — you do not need to request it
|
|
87
60
|
|
|
88
61
|
## Loop Guard Handling
|
|
89
62
|
|
|
@@ -143,4 +116,4 @@ End your final summary with: `Siblings: <list>. Conflicts: <list or "none">. Git
|
|
|
143
116
|
|
|
144
117
|
**Follow the global baseline in `config/AGENTS.md` → "General Agent Baseline — Always-On Behavior".** It covers identity, refusal, tone, formatting, lists, user wellbeing, evenhandedness, mistakes, knowledge cutoff and research-first, MCP servers and skills, mandatory skill-read, file creation, file handling, search, copyright, harmful content, citations, images, memory privacy, execution, clarification, and communication.
|
|
145
118
|
|
|
146
|
-
The section above was adapted from the upstream Claude Fable 5 system prompt, with every Claude-specific tool / function / directory translated to the BizarHarness equivalent (opencode tools, Semble, Skills CLI,
|
|
119
|
+
The section above was adapted from the upstream Claude Fable 5 system prompt, with every Claude-specific tool / function / directory translated to the BizarHarness equivalent (opencode tools, Semble, Skills CLI, Obsidian, agent-browser, the dashboard artifact pipeline). Do not duplicate the rules here — read the global baseline and apply it.
|
package/config/agents/vidarr.md
CHANGED
|
@@ -13,8 +13,6 @@ permission:
|
|
|
13
13
|
todowrite: allow
|
|
14
14
|
webfetch: allow
|
|
15
15
|
websearch: allow
|
|
16
|
-
hindsight_recall: allow
|
|
17
|
-
hindsight_retain: allow
|
|
18
16
|
---
|
|
19
17
|
|
|
20
18
|
## Codebase Search — Use Semble First
|
|
@@ -63,31 +61,6 @@ You have access to the most capable model in the pantheon. You are expected to:
|
|
|
63
61
|
- After completing, write a clear postmortem explaining what went wrong before and how you fixed it
|
|
64
62
|
- Be humble — if you are also stuck, say so clearly rather than wasting compute
|
|
65
63
|
|
|
66
|
-
## Hindsight Memory Protocol
|
|
67
|
-
|
|
68
|
-
You MUST use **per-project banks** — never the default bank for project work.
|
|
69
|
-
|
|
70
|
-
### Bank Selection
|
|
71
|
-
1. Call `hindsight_list_banks` to discover available banks
|
|
72
|
-
2. Use `bank_id: "<project-name>"` in all Hindsight calls
|
|
73
|
-
3. If no bank exists for the project, create it with `hindsight_create_bank(bank_id: "<project-name>")`
|
|
74
|
-
4. The default bank is for general/system knowledge only
|
|
75
|
-
|
|
76
|
-
### Before Work
|
|
77
|
-
- `hindsight_recall` with the correct `bank_id` for existing context
|
|
78
|
-
|
|
79
|
-
### During Work
|
|
80
|
-
- `hindsight_retain` important findings with the correct `bank_id`
|
|
81
|
-
- Tag memories with `project:<repo-name>`
|
|
82
|
-
|
|
83
|
-
### After Work
|
|
84
|
-
- `hindsight_retain` completion summary into the project bank
|
|
85
|
-
- Create or update mental models for sustained project context
|
|
86
|
-
|
|
87
|
-
### Auto Self-Improvement
|
|
88
|
-
- After completing work, Odin dispatches @heimdall to auto-extract patterns from this session
|
|
89
|
-
- Include in your output: key decisions made, bugs encountered, patterns worth remembering
|
|
90
|
-
- This happens automatically — you do not need to request it
|
|
91
64
|
|
|
92
65
|
## Loop Guard Handling
|
|
93
66
|
|
|
@@ -147,4 +120,4 @@ End your final summary with: `Siblings: <list>. Conflicts: <list or "none">. Git
|
|
|
147
120
|
|
|
148
121
|
**Follow the global baseline in `config/AGENTS.md` → "General Agent Baseline — Always-On Behavior".** It covers identity, refusal, tone, formatting, lists, user wellbeing, evenhandedness, mistakes, knowledge cutoff and research-first, MCP servers and skills, mandatory skill-read, file creation, file handling, search, copyright, harmful content, citations, images, memory privacy, execution, clarification, and communication.
|
|
149
122
|
|
|
150
|
-
The section above was adapted from the upstream Claude Fable 5 system prompt, with every Claude-specific tool / function / directory translated to the BizarHarness equivalent (opencode tools, Semble, Skills CLI,
|
|
123
|
+
The section above was adapted from the upstream Claude Fable 5 system prompt, with every Claude-specific tool / function / directory translated to the BizarHarness equivalent (opencode tools, Semble, Skills CLI, Obsidian, agent-browser, the dashboard artifact pipeline). Do not duplicate the rules here — read the global baseline and apply it.
|
package/config/agents/vor.md
CHANGED
|
@@ -7,8 +7,6 @@ permission:
|
|
|
7
7
|
read: allow
|
|
8
8
|
list: allow
|
|
9
9
|
question: allow
|
|
10
|
-
hindsight_recall: allow
|
|
11
|
-
hindsight_retain: allow
|
|
12
10
|
---
|
|
13
11
|
|
|
14
12
|
## Codebase Search — Use Semble First
|
|
@@ -37,9 +35,9 @@ ls .bizar/PROJECT.md 2>/dev/null && read .bizar/PROJECT.md
|
|
|
37
35
|
ls .bizar/AGENTS_SELF_IMPROVEMENT.md 2>/dev/null && read .bizar/AGENTS_SELF_IMPROVEMENT.md
|
|
38
36
|
```
|
|
39
37
|
|
|
40
|
-
Also recall from
|
|
38
|
+
Also recall from Obsidian:
|
|
41
39
|
```
|
|
42
|
-
|
|
40
|
+
obsidian_search(query: "<project-name> context")
|
|
43
41
|
```
|
|
44
42
|
|
|
45
43
|
If `.bizar/PROJECT.md` doesn't exist (Odin forgot to have Mimir create it), try to identify the project yourself:
|
|
@@ -85,7 +83,7 @@ Route to Vör when:
|
|
|
85
83
|
## Workflow
|
|
86
84
|
|
|
87
85
|
1. You receive the raw request from Odin
|
|
88
|
-
2. **Research first**: read `.bizar/PROJECT.md`,
|
|
86
|
+
2. **Research first**: read `.bizar/PROJECT.md`, obsidian_recall, check project files for framework/pattern clues
|
|
89
87
|
3. **Assess clarity**: if the intent is now clear given project context, skip questioning — return a brief
|
|
90
88
|
4. **Question (if still ambiguous)**: call `question` with **project-specific** questions referencing actual files, framework, and patterns you found
|
|
91
89
|
5. Wait for user answers
|
|
@@ -94,7 +92,7 @@ Route to Vör when:
|
|
|
94
92
|
|
|
95
93
|
## Rules
|
|
96
94
|
|
|
97
|
-
- **Research before asking** — always read project files and
|
|
95
|
+
- **Research before asking** — always read project files and Obsidian vault first
|
|
98
96
|
- NEVER implement anything — you only ask questions
|
|
99
97
|
- NEVER use `bash`, `glob`, `grep`, `edit`, or `write` — you don't have those
|
|
100
98
|
- Do NOT write questions as text in your response — always use the `question` tool
|
|
@@ -104,28 +102,8 @@ Route to Vör when:
|
|
|
104
102
|
- When a custom answer is needed, users can type their own answer (the `question` tool supports this)
|
|
105
103
|
- For complex ambiguity, ask 2-3 short questions rather than 1 big one
|
|
106
104
|
- After answers come back, produce a brief summary of the clarified requirements
|
|
107
|
-
- Use `
|
|
105
|
+
- Use `obsidian_write_note` to save clarified requirements as a daily note in the project vault
|
|
108
106
|
|
|
109
|
-
## Hindsight Memory Protocol
|
|
110
|
-
|
|
111
|
-
You MUST use **per-project banks** — never the default bank for project work.
|
|
112
|
-
|
|
113
|
-
### Bank Selection
|
|
114
|
-
1. Call `hindsight_list_banks` to discover available banks
|
|
115
|
-
2. Use `bank_id: "<project-name>"` in all Hindsight calls
|
|
116
|
-
3. If no bank exists for the project, create it with `hindsight_create_bank(bank_id: "<project-name>")`
|
|
117
|
-
4. The default bank is for general/system knowledge only
|
|
118
|
-
|
|
119
|
-
### Before Work
|
|
120
|
-
- `hindsight_recall` with the correct `bank_id` for existing context
|
|
121
|
-
|
|
122
|
-
### During Work
|
|
123
|
-
- `hindsight_retain` important findings with the correct `bank_id`
|
|
124
|
-
- Tag memories with `project:<repo-name>`
|
|
125
|
-
|
|
126
|
-
### After Work
|
|
127
|
-
- `hindsight_retain` completion summary into the project bank
|
|
128
|
-
- Create or update mental models for sustained project context
|
|
129
107
|
|
|
130
108
|
## Loop Guard Handling
|
|
131
109
|
|
|
@@ -161,4 +139,4 @@ When uncertain or stuck, follow `config/rules/uncertainty.md` — stop and resea
|
|
|
161
139
|
|
|
162
140
|
**Follow the global baseline in `config/AGENTS.md` → "General Agent Baseline — Always-On Behavior".** It covers identity, refusal, tone, formatting, lists, user wellbeing, evenhandedness, mistakes, knowledge cutoff and research-first, MCP servers and skills, mandatory skill-read, file creation, file handling, search, copyright, harmful content, citations, images, memory privacy, execution, clarification, and communication.
|
|
163
141
|
|
|
164
|
-
The section above was adapted from the upstream Claude Fable 5 system prompt, with every Claude-specific tool / function / directory translated to the BizarHarness equivalent (opencode tools, Semble, Skills CLI,
|
|
142
|
+
The section above was adapted from the upstream Claude Fable 5 system prompt, with every Claude-specific tool / function / directory translated to the BizarHarness equivalent (opencode tools, Semble, Skills CLI, Obsidian, agent-browser, the dashboard artifact pipeline). Do not duplicate the rules here — read the global baseline and apply it.
|
|
@@ -11,16 +11,6 @@
|
|
|
11
11
|
"url": "https://mcp.supabase.com/mcp",
|
|
12
12
|
"enabled": false
|
|
13
13
|
},
|
|
14
|
-
"hindsight": {
|
|
15
|
-
"type": "remote",
|
|
16
|
-
"url": "https://memory-api.polderlabs.io/mcp",
|
|
17
|
-
"enabled": false,
|
|
18
|
-
"oauth": false,
|
|
19
|
-
"headers": {
|
|
20
|
-
"Authorization": "Bearer __HINDSIGHT_BEARER_TOKEN__",
|
|
21
|
-
"Content-Type": "application/json"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
14
|
"semble": {
|
|
25
15
|
"type": "local",
|
|
26
16
|
"command": [
|
|
@@ -72,9 +62,7 @@
|
|
|
72
62
|
"permission": {
|
|
73
63
|
"read": "allow",
|
|
74
64
|
"list": "allow",
|
|
75
|
-
"question": "allow"
|
|
76
|
-
"hindsight_recall": "allow",
|
|
77
|
-
"hindsight_retain": "allow"
|
|
65
|
+
"question": "allow",,
|
|
78
66
|
}
|
|
79
67
|
},
|
|
80
68
|
"frigg": {
|
|
@@ -89,9 +77,7 @@
|
|
|
89
77
|
"grep": "allow",
|
|
90
78
|
"bash": "allow",
|
|
91
79
|
"webfetch": "allow",
|
|
92
|
-
"websearch": "allow"
|
|
93
|
-
"hindsight_recall": "allow",
|
|
94
|
-
"hindsight_retain": "allow",
|
|
80
|
+
"websearch": "allow",,,
|
|
95
81
|
"question": "allow"
|
|
96
82
|
}
|
|
97
83
|
},
|
|
@@ -17,7 +17,7 @@ Every stuck situation must move through these phases in order:
|
|
|
17
17
|
- `semble search "<concept>"` for codebase patterns
|
|
18
18
|
- `webfetch` for official documentation
|
|
19
19
|
- `read` for related files in the repo
|
|
20
|
-
- `
|
|
20
|
+
- `obsidian_search` for prior project context
|
|
21
21
|
- `skill <name>` for domain-specific guidance
|
|
22
22
|
- Ask the user if you are still uncertain after research
|
|
23
23
|
3. **Act with confidence.** After research, make one decisive attempt. If it still fails, return to phase 2 with the new information. Never return to phase 1.
|
|
@@ -20,7 +20,7 @@ chmod +x install.sh
|
|
|
20
20
|
|
|
21
21
|
Odin is the only primary agent. Every request hits him first. He NEVER does work — he decomposes into parallel streams and dispatches to subagents.
|
|
22
22
|
|
|
23
|
-
All subagents use
|
|
23
|
+
All subagents use Obsidian vault memory with **per-project vaults**. Call `obsidian_list_vaults` at session start to discover available vaults, determine the project name, and use the matching `<project-name>` vault. The default vault is for general/cross-project knowledge only.
|
|
24
24
|
|
|
25
25
|
## Agent Reference
|
|
26
26
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polderlabs/bizar",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.19.0",
|
|
4
4
|
"description": "Norse-pantheon multi-agent system for opencode — 13 agents across 4 cost tiers with cost-aware routing, plans, and a configurable agent harness.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* cli/graph-build-from-cache.mjs
|
|
4
|
-
*
|
|
5
|
-
* One-off script for environments where graphify's semantic-extraction
|
|
6
|
-
* step fails (e.g. no LLM API key + remaining non-code docs that the
|
|
7
|
-
* `.graphifyignore` can't filter) but the AST cache is intact.
|
|
8
|
-
*
|
|
9
|
-
* graphify's pipeline has two stages:
|
|
10
|
-
* 1. AST extraction (local, tree-sitter) — writes per-file JSON to
|
|
11
|
-
* `.bizar/graph/cache/ast/v0.8.46/<hash>.json` regardless of LLM status.
|
|
12
|
-
* 2. Semantic extraction (LLM, optional) — merges per-file nodes into a
|
|
13
|
-
* project-wide graph.
|
|
14
|
-
*
|
|
15
|
-
* If stage 2 aborts, `graph.json` is never written and the dashboard has
|
|
16
|
-
* nothing to render. This script reconstructs `graph.json` directly from
|
|
17
|
-
* the per-file AST cache, then calls `graphify cluster-only` to generate
|
|
18
|
-
* `graph.html` + `GRAPH_REPORT.md`.
|
|
19
|
-
*
|
|
20
|
-
* Usage:
|
|
21
|
-
* node cli/graph-build-from-cache.mjs # use .bizar/graph/
|
|
22
|
-
* node cli/graph-build-from-cache.mjs /tmp/other/graph # custom dir
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import { readFileSync, writeFileSync, existsSync, readdirSync } from 'node:fs';
|
|
26
|
-
import { join, resolve } from 'node:path';
|
|
27
|
-
|
|
28
|
-
const graphDirArg = process.argv[2] || '.bizar/graph';
|
|
29
|
-
const graphDir = resolve(graphDirArg);
|
|
30
|
-
|
|
31
|
-
// The cache version directory inside graphify's cache layout. Bumping the
|
|
32
|
-
// graphify version moves the cache; we discover the actual subdir at
|
|
33
|
-
// runtime so we don't hardcode "v0.8.46".
|
|
34
|
-
const cacheAstRoot = join(graphDir, 'cache', 'ast');
|
|
35
|
-
|
|
36
|
-
function findCacheDir() {
|
|
37
|
-
if (!existsSync(cacheAstRoot)) {
|
|
38
|
-
throw new Error(`No AST cache found at ${cacheAstRoot}. Run \`bizar graph build\` first to populate it.`);
|
|
39
|
-
}
|
|
40
|
-
const entries = readdirSync(cacheAstRoot);
|
|
41
|
-
if (entries.length === 0) {
|
|
42
|
-
throw new Error(`AST cache directory ${cacheAstRoot} is empty.`);
|
|
43
|
-
}
|
|
44
|
-
// graphify uses one version directory like v0.8.46. Pick the first.
|
|
45
|
-
return join(cacheAstRoot, entries[0]);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function buildGraphFromCache(cacheDir) {
|
|
49
|
-
const files = readdirSync(cacheDir).filter((f) => f.endsWith('.json'));
|
|
50
|
-
console.log(` Reading ${files.length} AST cache files from ${cacheDir}...`);
|
|
51
|
-
|
|
52
|
-
const nodesById = new Map();
|
|
53
|
-
const edges = [];
|
|
54
|
-
const rawCalls = [];
|
|
55
|
-
|
|
56
|
-
let fileIdx = 0;
|
|
57
|
-
for (const f of files) {
|
|
58
|
-
fileIdx++;
|
|
59
|
-
const raw = JSON.parse(readFileSync(join(cacheDir, f), 'utf8'));
|
|
60
|
-
for (const n of raw.nodes || []) {
|
|
61
|
-
// Later files win on duplicate id (consistent with graphify's
|
|
62
|
-
// dedup behavior — first write keeps the canonical location).
|
|
63
|
-
if (!nodesById.has(n.id)) nodesById.set(n.id, n);
|
|
64
|
-
}
|
|
65
|
-
for (const e of raw.edges || []) edges.push(e);
|
|
66
|
-
for (const rc of raw.raw_calls || []) rawCalls.push(rc);
|
|
67
|
-
if (fileIdx % 50 === 0) {
|
|
68
|
-
console.log(` merged ${fileIdx}/${files.length} files`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Re-key node.community so it matches the dashboard's expected schema.
|
|
73
|
-
// The AST cache uses `community` as a numeric cluster id; we keep it as-is.
|
|
74
|
-
const nodes = Array.from(nodesById.values());
|
|
75
|
-
|
|
76
|
-
const graph = {
|
|
77
|
-
directed: false,
|
|
78
|
-
multigraph: false,
|
|
79
|
-
graph: {},
|
|
80
|
-
nodes,
|
|
81
|
-
links: edges,
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
console.log(` Built graph: ${nodes.length} nodes, ${edges.length} edges (raw_calls=${rawCalls.length})`);
|
|
85
|
-
return { graph, rawCalls };
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function writeOutputs(graphDir, graph) {
|
|
89
|
-
// graph.json — NetworkX node-link format
|
|
90
|
-
const graphJsonPath = join(graphDir, 'graph.json');
|
|
91
|
-
writeFileSync(graphJsonPath, JSON.stringify(graph, null, 2), 'utf8');
|
|
92
|
-
console.log(` ✓ Wrote ${graphJsonPath}`);
|
|
93
|
-
|
|
94
|
-
// .graphify_analysis.json — graphify's secondary output. cluster-only
|
|
95
|
-
// doesn't strictly require this, but writing it keeps the directory
|
|
96
|
-
// shape consistent with what `graphify .` would have produced.
|
|
97
|
-
const analysis = {
|
|
98
|
-
schema_version: 1,
|
|
99
|
-
generated_at: new Date().toISOString(),
|
|
100
|
-
clusters: [],
|
|
101
|
-
};
|
|
102
|
-
const analysisPath = join(graphDir, '.graphify_analysis.json');
|
|
103
|
-
writeFileSync(analysisPath, JSON.stringify(analysis, null, 2), 'utf8');
|
|
104
|
-
console.log(` ✓ Wrote ${analysisPath}`);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function main() {
|
|
108
|
-
console.log(` Graph dir: ${graphDir}`);
|
|
109
|
-
if (!existsSync(graphDir)) {
|
|
110
|
-
throw new Error(`Graph dir does not exist: ${graphDir}`);
|
|
111
|
-
}
|
|
112
|
-
const cacheDir = findCacheDir();
|
|
113
|
-
const { graph } = buildGraphFromCache(cacheDir);
|
|
114
|
-
writeOutputs(graphDir, graph);
|
|
115
|
-
console.log('');
|
|
116
|
-
console.log(' Next step: run `bizar graph cluster-only` to generate graph.html.');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
try {
|
|
120
|
-
main();
|
|
121
|
-
} catch (err) {
|
|
122
|
-
console.error(`\n Error: ${err.message}\n`);
|
|
123
|
-
process.exit(1);
|
|
124
|
-
}
|