monomind 1.11.13 โ 1.11.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/mastermind/idea.md +1 -1
- package/.claude/commands/mastermind/master.md +1 -1
- package/.claude/scheduled_tasks.lock +1 -1
- package/.claude/skills/mastermind/_protocol.md +4 -4
- package/.claude/skills/mastermind/architect.md +4 -7
- package/.claude/skills/mastermind/autodev.md +2 -4
- package/.claude/skills/mastermind/build.md +3 -3
- package/.claude/skills/mastermind/content.md +3 -3
- package/.claude/skills/mastermind/createorg.md +2 -2
- package/.claude/skills/mastermind/finance.md +3 -3
- package/.claude/skills/mastermind/idea.md +0 -8
- package/.claude/skills/mastermind/marketing.md +3 -3
- package/.claude/skills/mastermind/monitor.md +2 -2
- package/.claude/skills/mastermind/ops.md +3 -3
- package/.claude/skills/mastermind/release.md +3 -3
- package/.claude/skills/mastermind/research.md +3 -3
- package/.claude/skills/mastermind/review.md +3 -3
- package/.claude/skills/mastermind/sales.md +3 -3
- package/README.md +286 -129
- package/package.json +2 -2
- package/packages/@monomind/cli/README.md +286 -129
- package/packages/@monomind/cli/bundled-graph/dist/src/build.js +73 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cluster.js +120 -0
- package/packages/@monomind/cli/bundled-graph/package.json +57 -0
- package/packages/@monomind/cli/dist/src/agents/halt-signal.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/agents/halt-signal.js +76 -0
- package/packages/@monomind/cli/dist/src/agents/index.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/agents/index.js +13 -0
- package/packages/@monomind/cli/dist/src/agents/managed-agent.d.ts +41 -0
- package/packages/@monomind/cli/dist/src/agents/managed-agent.js +69 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-experiment.d.ts +23 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-experiment.js +49 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.d.ts +22 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.js +80 -0
- package/packages/@monomind/cli/dist/src/agents/registry-query.d.ts +71 -0
- package/packages/@monomind/cli/dist/src/agents/registry-query.js +125 -0
- package/packages/@monomind/cli/dist/src/agents/score-decay.d.ts +19 -0
- package/packages/@monomind/cli/dist/src/agents/score-decay.js +22 -0
- package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.js +40 -0
- package/packages/@monomind/cli/dist/src/agents/specialization-scorer.d.ts +54 -0
- package/packages/@monomind/cli/dist/src/agents/specialization-scorer.js +212 -0
- package/packages/@monomind/cli/dist/src/agents/termination-watcher.d.ts +30 -0
- package/packages/@monomind/cli/dist/src/agents/termination-watcher.js +84 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-index.d.ts +20 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-index.js +38 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-scanner.d.ts +64 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-scanner.js +308 -0
- package/packages/@monomind/cli/dist/src/agents/version-diff.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/agents/version-diff.js +64 -0
- package/packages/@monomind/cli/dist/src/agents/version-store.d.ts +60 -0
- package/packages/@monomind/cli/dist/src/agents/version-store.js +235 -0
- package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.d.ts +45 -0
- package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.js +404 -0
- package/packages/@monomind/cli/dist/src/commands/agent-wasm.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/commands/agent-wasm.js +333 -0
- package/packages/@monomind/cli/dist/src/commands/doctor.js +55 -1
- package/packages/@monomind/cli/dist/src/commands/ui.js +68 -0
- package/packages/@monomind/cli/dist/src/consensus/index.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/consensus/index.js +6 -0
- package/packages/@monomind/cli/dist/src/context/context-provider.d.ts +44 -0
- package/packages/@monomind/cli/dist/src/context/context-provider.js +25 -0
- package/packages/@monomind/cli/dist/src/context/git-state-provider.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/context/git-state-provider.js +34 -0
- package/packages/@monomind/cli/dist/src/context/index.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/context/index.js +12 -0
- package/packages/@monomind/cli/dist/src/context/project-conventions-provider.d.ts +15 -0
- package/packages/@monomind/cli/dist/src/context/project-conventions-provider.js +19 -0
- package/packages/@monomind/cli/dist/src/context/prompt-assembler.d.ts +26 -0
- package/packages/@monomind/cli/dist/src/context/prompt-assembler.js +93 -0
- package/packages/@monomind/cli/dist/src/context/task-history-provider.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/context/task-history-provider.js +32 -0
- package/packages/@monomind/cli/dist/src/context/user-preferences-provider.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/context/user-preferences-provider.js +27 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-reader.d.ts +31 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-reader.js +81 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-writer.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-writer.js +65 -0
- package/packages/@monomind/cli/dist/src/dlq/index.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/dlq/index.js +7 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-manager.d.ts +33 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-manager.js +107 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-runner.d.ts +23 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-runner.js +59 -0
- package/packages/@monomind/cli/dist/src/eval/index.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/eval/index.js +7 -0
- package/packages/@monomind/cli/dist/src/eval/trace-collector.d.ts +40 -0
- package/packages/@monomind/cli/dist/src/eval/trace-collector.js +102 -0
- package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.js +264 -0
- package/packages/@monomind/cli/dist/src/init/statusline-generator.js +3 -3
- package/packages/@monomind/cli/dist/src/interactive/interrupt.d.ts +22 -0
- package/packages/@monomind/cli/dist/src/interactive/interrupt.js +71 -0
- package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.js +48 -0
- package/packages/@monomind/cli/dist/src/mcp/tool-registry.d.ts +61 -0
- package/packages/@monomind/cli/dist/src/mcp/tool-registry.js +246 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.js +230 -0
- package/packages/@monomind/cli/dist/src/model/complexity-scorer.d.ts +21 -0
- package/packages/@monomind/cli/dist/src/model/complexity-scorer.js +106 -0
- package/packages/@monomind/cli/dist/src/model/index.d.ts +4 -0
- package/packages/@monomind/cli/dist/src/model/index.js +4 -0
- package/packages/@monomind/cli/dist/src/model/model-settings.d.ts +22 -0
- package/packages/@monomind/cli/dist/src/model/model-settings.js +33 -0
- package/packages/@monomind/cli/dist/src/model/model-tier-resolver.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/model/model-tier-resolver.js +65 -0
- package/packages/@monomind/cli/dist/src/monovector/capabilities.d.ts +34 -0
- package/packages/@monomind/cli/dist/src/monovector/capabilities.js +37 -0
- package/packages/@monomind/cli/dist/src/observability/replay-reader.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/orchestration/index.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/orchestration/index.js +6 -0
- package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.js +31 -0
- package/packages/@monomind/cli/dist/src/orchestration/routing-modes.d.ts +68 -0
- package/packages/@monomind/cli/dist/src/orchestration/routing-modes.js +180 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.js +126 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.js +188 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.js +206 -0
- package/packages/@monomind/cli/dist/src/runtime/headless.d.ts +60 -0
- package/packages/@monomind/cli/dist/src/runtime/headless.js +284 -0
- package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.d.ts +50 -0
- package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.js +95 -0
- package/packages/@monomind/cli/dist/src/services/container-worker-pool.d.ts +197 -0
- package/packages/@monomind/cli/dist/src/services/container-worker-pool.js +623 -0
- package/packages/@monomind/cli/dist/src/services/index.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/services/index.js +11 -0
- package/packages/@monomind/cli/dist/src/services/worker-queue.d.ts +201 -0
- package/packages/@monomind/cli/dist/src/services/worker-queue.js +594 -0
- package/packages/@monomind/cli/dist/src/swarm/communication-graph.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/swarm/communication-graph.js +77 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.d.ts +31 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.js +61 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.d.ts +19 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.js +68 -0
- package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.js +205 -0
- package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.js +190 -0
- package/packages/@monomind/cli/dist/src/transfer/test-seraphine.d.ts +6 -0
- package/packages/@monomind/cli/dist/src/transfer/test-seraphine.js +105 -0
- package/packages/@monomind/cli/dist/src/transfer/tests/test-store.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/transfer/tests/test-store.js +214 -0
- package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.js +82 -0
- package/packages/@monomind/cli/dist/src/workflow/context-resolver.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/workflow/context-resolver.js +23 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-builder.d.ts +17 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-builder.js +129 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-executor.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-executor.js +116 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-types.d.ts +41 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-types.js +8 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-parser.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-parser.js +20 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-schema.d.ts +165 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-schema.js +82 -0
- package/packages/@monomind/cli/dist/src/workflow/index.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/workflow/index.js +11 -0
- package/packages/@monomind/cli/dist/src/workflow/template-engine.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/workflow/template-engine.js +40 -0
- package/packages/@monomind/cli/dist/src/workflow/workflow-executor.d.ts +29 -0
- package/packages/@monomind/cli/dist/src/workflow/workflow-executor.js +227 -0
- package/packages/@monomind/cli/package.json +9 -9
- package/packages/@monomind/guidance/dist/adversarial.d.ts +284 -0
- package/packages/@monomind/guidance/dist/adversarial.js +572 -0
- package/packages/@monomind/guidance/dist/analyzer.d.ts +530 -0
- package/packages/@monomind/guidance/dist/analyzer.js +2518 -0
- package/packages/@monomind/guidance/dist/artifacts.d.ts +283 -0
- package/packages/@monomind/guidance/dist/artifacts.js +356 -0
- package/packages/@monomind/guidance/dist/authority.d.ts +290 -0
- package/packages/@monomind/guidance/dist/authority.js +558 -0
- package/packages/@monomind/guidance/dist/capabilities.d.ts +209 -0
- package/packages/@monomind/guidance/dist/capabilities.js +485 -0
- package/packages/@monomind/guidance/dist/coherence.d.ts +233 -0
- package/packages/@monomind/guidance/dist/coherence.js +372 -0
- package/packages/@monomind/guidance/dist/compiler.d.ts +87 -0
- package/packages/@monomind/guidance/dist/compiler.js +419 -0
- package/packages/@monomind/guidance/dist/conformance-kit.d.ts +225 -0
- package/packages/@monomind/guidance/dist/conformance-kit.js +629 -0
- package/packages/@monomind/guidance/dist/continue-gate.d.ts +214 -0
- package/packages/@monomind/guidance/dist/continue-gate.js +353 -0
- package/packages/@monomind/guidance/dist/crypto-utils.d.ts +17 -0
- package/packages/@monomind/guidance/dist/crypto-utils.js +24 -0
- package/packages/@monomind/guidance/dist/evolution.d.ts +282 -0
- package/packages/@monomind/guidance/dist/evolution.js +500 -0
- package/packages/@monomind/guidance/dist/gates.d.ts +79 -0
- package/packages/@monomind/guidance/dist/gates.js +302 -0
- package/packages/@monomind/guidance/dist/gateway.d.ts +206 -0
- package/packages/@monomind/guidance/dist/gateway.js +452 -0
- package/packages/@monomind/guidance/dist/generators.d.ts +153 -0
- package/packages/@monomind/guidance/dist/generators.js +682 -0
- package/packages/@monomind/guidance/dist/headless.d.ts +177 -0
- package/packages/@monomind/guidance/dist/headless.js +342 -0
- package/packages/@monomind/guidance/dist/hooks.d.ts +109 -0
- package/packages/@monomind/guidance/dist/hooks.js +347 -0
- package/packages/@monomind/guidance/dist/index.d.ts +205 -0
- package/packages/@monomind/guidance/dist/index.js +321 -0
- package/packages/@monomind/guidance/dist/ledger.d.ts +162 -0
- package/packages/@monomind/guidance/dist/ledger.js +375 -0
- package/packages/@monomind/guidance/dist/manifest-validator.d.ts +289 -0
- package/packages/@monomind/guidance/dist/manifest-validator.js +838 -0
- package/packages/@monomind/guidance/dist/memory-gate.d.ts +222 -0
- package/packages/@monomind/guidance/dist/memory-gate.js +382 -0
- package/packages/@monomind/guidance/dist/meta-governance.d.ts +265 -0
- package/packages/@monomind/guidance/dist/meta-governance.js +348 -0
- package/packages/@monomind/guidance/dist/optimizer.d.ts +104 -0
- package/packages/@monomind/guidance/dist/optimizer.js +329 -0
- package/packages/@monomind/guidance/dist/persistence.d.ts +189 -0
- package/packages/@monomind/guidance/dist/persistence.js +464 -0
- package/packages/@monomind/guidance/dist/proof.d.ts +185 -0
- package/packages/@monomind/guidance/dist/proof.js +238 -0
- package/packages/@monomind/guidance/dist/retriever.d.ts +116 -0
- package/packages/@monomind/guidance/dist/retriever.js +394 -0
- package/packages/@monomind/guidance/dist/ruvbot-integration.d.ts +370 -0
- package/packages/@monomind/guidance/dist/ruvbot-integration.js +738 -0
- package/packages/@monomind/guidance/dist/temporal.d.ts +426 -0
- package/packages/@monomind/guidance/dist/temporal.js +658 -0
- package/packages/@monomind/guidance/dist/trust.d.ts +283 -0
- package/packages/@monomind/guidance/dist/trust.js +473 -0
- package/packages/@monomind/guidance/dist/truth-anchors.d.ts +276 -0
- package/packages/@monomind/guidance/dist/truth-anchors.js +488 -0
- package/packages/@monomind/guidance/dist/types.d.ts +378 -0
- package/packages/@monomind/guidance/dist/types.js +10 -0
- package/packages/@monomind/guidance/dist/uncertainty.d.ts +372 -0
- package/packages/@monomind/guidance/dist/uncertainty.js +619 -0
- package/packages/@monomind/guidance/dist/wasm-kernel.d.ts +48 -0
- package/packages/@monomind/guidance/dist/wasm-kernel.js +158 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/monoes/monomind/main/assets/mascot.png" alt="Monomind
|
|
2
|
+
<img src="https://raw.githubusercontent.com/monoes/monomind/main/assets/mascot.png" alt="Monomind" width="140" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<h1 align="center">Monomind</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<strong>
|
|
9
|
-
|
|
8
|
+
<strong>Hire an AI team. Set a goal. Walk away.</strong><br/>
|
|
9
|
+
Autonomous Claude Code orchestration with persistent memory, self-coordinating agent orgs, and a codebase knowledge graph.
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
@@ -19,169 +19,283 @@
|
|
|
19
19
|
</p>
|
|
20
20
|
|
|
21
21
|
<p align="center">
|
|
22
|
-
<a href="https://monoes.github.io/monomind
|
|
23
|
-
<a href="
|
|
24
|
-
<a href="
|
|
25
|
-
<a href="
|
|
26
|
-
<a href="
|
|
27
|
-
<a href="https://github.com/monoes/monomind">GitHub</a>
|
|
22
|
+
<a href="https://monoes.github.io/monomind/#orgs">๐ข Orgs</a> ยท
|
|
23
|
+
<a href="https://monoes.github.io/monomind/#getting-started">๐ Quickstart</a> ยท
|
|
24
|
+
<a href="https://monoes.github.io/monomind/#mastermind">โก Mastermind</a> ยท
|
|
25
|
+
<a href="https://monoes.github.io/monomind/#slash">๐ Commands</a> ยท
|
|
26
|
+
<a href="https://monoes.github.io/monomind/#architecture">๐๏ธ Architecture</a>
|
|
28
27
|
</p>
|
|
29
28
|
|
|
30
29
|
---
|
|
31
30
|
|
|
32
31
|
## What is Monomind?
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
Claude Code is already powerful. Monomind makes it **run itself**.
|
|
35
34
|
|
|
36
|
-
|
|
35
|
+
Install once. Wire it into Claude Code. Then instead of prompting Claude to do individual tasks, you tell Monomind what outcome you want โ and it assembles a team, coordinates the work, and delivers.
|
|
37
36
|
|
|
38
37
|
```bash
|
|
38
|
+
# Assemble an AI content team and let it run
|
|
39
|
+
/mastermind:createorg content-team "publish 3 SEO-optimized posts per week"
|
|
40
|
+
/mastermind:runorg --org content-team
|
|
41
|
+
|
|
42
|
+
# Or run the autonomous code improvement loop
|
|
39
43
|
/mastermind:autodev --tillend --focus security
|
|
40
44
|
```
|
|
41
45
|
|
|
42
|
-
|
|
46
|
+
That's it. Come back later.
|
|
43
47
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## ๐ข Autonomous Organizations
|
|
51
|
+
|
|
52
|
+
> **This is the headline feature.** Build a persistent AI organization โ roles, hierarchy, shared task board โ and start it as a background daemon that runs without you.
|
|
53
|
+
|
|
54
|
+
### The idea
|
|
55
|
+
|
|
56
|
+
Every business function needs a team. Monomind lets you design that team in one command, then run it forever. The org persists across sessions. It checkpoints, recovers from failures, and coordinates its agents through a shared task board โ all automatically.
|
|
57
|
+
|
|
58
|
+
```mermaid
|
|
59
|
+
flowchart TD
|
|
60
|
+
U(["You"])
|
|
61
|
+
CO["/mastermind:createorg\nDefine goal + roles"]
|
|
62
|
+
RO["/mastermind:runorg\nStart daemon"]
|
|
63
|
+
BOSS["Boss Agent\ncoordinator"]
|
|
64
|
+
W["Writer\nContent Creator"]
|
|
65
|
+
S["SEO Specialist"]
|
|
66
|
+
R["Reviewer"]
|
|
67
|
+
M["Growth Marketer"]
|
|
68
|
+
BOARD[("Shared\nTask Board")]
|
|
69
|
+
MEM[("AgentDB\nMemory")]
|
|
70
|
+
|
|
71
|
+
U --> CO --> RO --> BOSS
|
|
72
|
+
BOSS -->|spawns| W
|
|
73
|
+
BOSS -->|spawns| S
|
|
74
|
+
BOSS -->|spawns| R
|
|
75
|
+
BOSS -->|spawns| M
|
|
76
|
+
BOSS <-->|claims + reports| BOARD
|
|
77
|
+
W <-->|stores output| MEM
|
|
78
|
+
S <-->|reads context| MEM
|
|
79
|
+
|
|
80
|
+
style BOSS fill:#00D2AA22,stroke:#00D2AA
|
|
81
|
+
style BOARD fill:#F59E0B22,stroke:#F59E0B
|
|
82
|
+
style MEM fill:#8B5CF622,stroke:#8B5CF6
|
|
47
83
|
```
|
|
48
84
|
|
|
49
|
-
|
|
85
|
+
### Two commands to a running org
|
|
50
86
|
|
|
51
|
-
|
|
87
|
+
**Step 1 โ Design it:**
|
|
52
88
|
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
|
|
89
|
+
```
|
|
90
|
+
/ mastermind:createorg content-team
|
|
91
|
+
"Build and publish 3 blog posts per week on AI dev tools"
|
|
56
92
|
|
|
57
|
-
|
|
58
|
-
cd your-project
|
|
59
|
-
monomind init
|
|
93
|
+
Deriving roles from goal...
|
|
60
94
|
|
|
61
|
-
|
|
62
|
-
|
|
95
|
+
โ ORG: content-team
|
|
96
|
+
โ TOPOLOGY: star (5 roles)
|
|
63
97
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
98
|
+
boss โ coordinator
|
|
99
|
+
writer โ Content Creator
|
|
100
|
+
reviewer โ reviewer
|
|
101
|
+
marketer โ Growth Hacker
|
|
102
|
+
seo โ SEO Specialist
|
|
67
103
|
|
|
68
|
-
|
|
104
|
+
Type "go" to save, or describe changes.
|
|
105
|
+
โ go
|
|
69
106
|
|
|
70
|
-
|
|
71
|
-
/mastermind:
|
|
107
|
+
โ Saved .monomind/orgs/content-team.json
|
|
108
|
+
โ Run: /mastermind:runorg --org content-team
|
|
72
109
|
```
|
|
73
110
|
|
|
74
|
-
**
|
|
111
|
+
**Step 2 โ Start it:**
|
|
75
112
|
|
|
76
|
-
|
|
113
|
+
```bash
|
|
114
|
+
/mastermind:runorg --org content-team
|
|
77
115
|
|
|
78
|
-
|
|
116
|
+
# Boss agent spawns in background
|
|
117
|
+
# Coordinates all roles via shared task board
|
|
118
|
+
# Checkpoints every 30 minutes
|
|
119
|
+
# Loops until you stop it
|
|
120
|
+
```
|
|
79
121
|
|
|
80
|
-
###
|
|
122
|
+
### What runs under the hood
|
|
81
123
|
|
|
124
|
+
| What | How |
|
|
125
|
+
|---|---|
|
|
126
|
+
| **Boss agent** | Coordinator type, no supervisor โ owns the goal |
|
|
127
|
+
| **Role agents** | Spawned on demand, specialized by task type |
|
|
128
|
+
| **Task board** | Todo โ Doing โ Done, shared across all agents |
|
|
129
|
+
| **Memory** | All output stored in org-scoped AgentDB namespace |
|
|
130
|
+
| **Checkpoint** | State saved every 30 min โ survives crashes and restarts |
|
|
131
|
+
| **Governance** | `auto` (free), `board` (approve sensitive), `strict` (approve all external actions) |
|
|
132
|
+
|
|
133
|
+
### Topology is auto-derived
|
|
134
|
+
|
|
135
|
+
```mermaid
|
|
136
|
+
graph LR
|
|
137
|
+
A["1-3 roles"] -->|mesh| B["All-to-all\ndirect comms"]
|
|
138
|
+
C["4-6 roles"] -->|star| D["Boss to workers\nfan-out"]
|
|
139
|
+
E["7+ roles"] -->|hierarchical| F["Boss to leads to workers\nmiddle management"]
|
|
82
140
|
```
|
|
83
|
-
Phase 1 Research Parallel scan: git log, file analysis, TODO/FIXME grep,
|
|
84
|
-
monograph god nodes, memory search for prior work.
|
|
85
|
-
Returns ranked list of 3โ5 improvement candidates.
|
|
86
141
|
|
|
87
|
-
|
|
88
|
-
Stores selection to AgentDB. Avoids repeating past work.
|
|
142
|
+
### Pre-built org types
|
|
89
143
|
|
|
90
|
-
|
|
91
|
-
|
|
144
|
+
| Org | Goal | Roles |
|
|
145
|
+
|---|---|---|
|
|
146
|
+
| `content-team` | 3 posts/week on AI tools | Director ยท Writer ยท Reviewer ยท SEO ยท Growth |
|
|
147
|
+
| `dev-squad` | Features from design spec | Lead ยท Architect ยท Developer ยท QA |
|
|
148
|
+
| `research-lab` | Weekly competitive intelligence | Director ยท Researcher ยท Analyst ยท Writer |
|
|
149
|
+
| `sales-engine` | ICP research + outreach sequences | Director ยท Outbound ยท Email ยท Researcher |
|
|
150
|
+
| `ops-squad` | 24/7 monitoring + incident response | SRE ยท Security ยท Perf ยท Incident Cmdr |
|
|
92
151
|
|
|
93
|
-
|
|
94
|
-
run in parallel. Auto-fixes. Repeats up to 5ร until clean.
|
|
152
|
+
### Org management commands
|
|
95
153
|
|
|
96
|
-
|
|
97
|
-
|
|
154
|
+
```bash
|
|
155
|
+
/mastermind:createorg <name> "<goal>" # design org from a goal
|
|
156
|
+
/mastermind:runorg --org <name> # start as background daemon
|
|
157
|
+
/mastermind:orgs # list all orgs + status
|
|
158
|
+
/mastermind:orgstatus --org <name> # detailed status for one org
|
|
159
|
+
/mastermind:stoporg --org <name> # stop a running org
|
|
160
|
+
/mastermind:approve # review pending approval requests
|
|
98
161
|
```
|
|
99
162
|
|
|
100
|
-
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## โก The Autonomous Build Loop
|
|
166
|
+
|
|
167
|
+
For code, `/mastermind:autodev` is the equivalent of Orgs โ a loop that researches, builds, and reviews your codebase without stopping.
|
|
168
|
+
|
|
169
|
+
```mermaid
|
|
170
|
+
flowchart LR
|
|
171
|
+
R["Research\nParallel scan:\ngit log, files\nTODOs, graph\nmemory"] --> S
|
|
172
|
+
S["Select\nFeasibility x\nblast-radius x\nfocus"] --> B
|
|
173
|
+
B["Build\nArchitect\nCoder\nTester\nReviewer"] --> V
|
|
174
|
+
V["Review Loop\nCode + Security\n+ Reality\nmax 5 iterations"] --> L
|
|
175
|
+
L["Log + Loop\nStore to memory\n--tillend:\nschedule next"]
|
|
176
|
+
L -->|"more to do"| R
|
|
101
177
|
|
|
178
|
+
style R fill:#00D2AA22,stroke:#00D2AA
|
|
179
|
+
style B fill:#8B5CF622,stroke:#8B5CF6
|
|
180
|
+
style V fill:#F59E0B22,stroke:#F59E0B
|
|
181
|
+
style L fill:#10B98122,stroke:#10B981
|
|
102
182
|
```
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
/mastermind:autodev --tillend # loop until nothing left
|
|
186
|
+
/mastermind:autodev --tillend --focus security # bias toward security fixes
|
|
187
|
+
/mastermind:autodev 3 # exactly 3 improvements
|
|
107
188
|
```
|
|
108
189
|
|
|
109
|
-
###
|
|
190
|
+
### Universal loop flags
|
|
110
191
|
|
|
111
|
-
|
|
192
|
+
| Flag | Purpose |
|
|
193
|
+
|---|---|
|
|
194
|
+
| `--tillend` | Repeat until empty round (zero findings, zero actions) |
|
|
195
|
+
| `--repeat <N>` | Repeat exactly N times |
|
|
196
|
+
| `--focus <area>` | Bias toward: `security` ยท `dx` ยท `performance` |
|
|
197
|
+
| `--auto` | No confirmation prompts |
|
|
198
|
+
| `--maxruns <N>` | Safety cap (default 50) |
|
|
112
199
|
|
|
113
200
|
---
|
|
114
201
|
|
|
115
|
-
##
|
|
202
|
+
## ๐ Quickstart
|
|
116
203
|
|
|
117
|
-
|
|
204
|
+
```bash
|
|
205
|
+
# 1. Install
|
|
206
|
+
npm install -g monomind
|
|
118
207
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
| `/mastermind:autodev --tillend` | Loops until zero findings remain |
|
|
123
|
-
| `/mastermind:build` | Build a feature from a brief |
|
|
124
|
-
| `/mastermind:review` | Iterative code review until clean |
|
|
125
|
-
| `/mastermind:debug` | Systematic root-cause debugging |
|
|
126
|
-
| `/mastermind:tdd` | Test-Driven Development: RedโGreenโRefactor |
|
|
127
|
-
| `/mastermind:plan` | Write a comprehensive implementation plan |
|
|
208
|
+
# 2. Initialize in your project
|
|
209
|
+
cd your-project
|
|
210
|
+
monomind init
|
|
128
211
|
|
|
129
|
-
|
|
212
|
+
# 3. Wire into Claude Code as an MCP server
|
|
213
|
+
claude mcp add monomind npx monomind mcp start
|
|
130
214
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
215
|
+
# 4. Start the background daemon
|
|
216
|
+
monomind daemon start
|
|
217
|
+
|
|
218
|
+
# 5. Health check
|
|
219
|
+
monomind doctor --fix
|
|
220
|
+
```
|
|
137
221
|
|
|
138
|
-
|
|
222
|
+
Open Claude Code. You now have 80+ slash commands available:
|
|
139
223
|
|
|
140
224
|
```bash
|
|
141
|
-
/mastermind:
|
|
142
|
-
/mastermind:
|
|
143
|
-
/mastermind:
|
|
144
|
-
/mastermind:stoporg # stop a running org
|
|
225
|
+
/mastermind:autodev --tillend # start autonomous code loop
|
|
226
|
+
/mastermind:createorg my-team # create your first AI org
|
|
227
|
+
/mastermind:help # show all commands
|
|
145
228
|
```
|
|
146
229
|
|
|
147
|
-
|
|
230
|
+
---
|
|
148
231
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
232
|
+
## ๐ง Memory That Persists
|
|
233
|
+
|
|
234
|
+
Every session, every agent, every org writes to **AgentDB** โ a hybrid SQLite + HNSW vector store that survives across sessions. The next time you run anything, Monomind already knows what was built, what failed, and which patterns work.
|
|
235
|
+
|
|
236
|
+
```mermaid
|
|
237
|
+
graph TD
|
|
238
|
+
L0["L0 - In-flight\nCurrent session drawers\nephemeral"]
|
|
239
|
+
L1["L1 - Working\nCross-session memory\nBM25 K1=1.5, B=0.75"]
|
|
240
|
+
L2["L2 - Long-term\nAgentDB + HNSW index\nSemantic search"]
|
|
241
|
+
L3["L3 - Shared\nCross-agent namespace\nFederated swarm reads"]
|
|
242
|
+
|
|
243
|
+
L0 -->|promoted| L1 --> L2 --> L3
|
|
244
|
+
|
|
245
|
+
style L0 fill:#00D2AA11,stroke:#00D2AA
|
|
246
|
+
style L1 fill:#F59E0B11,stroke:#F59E0B
|
|
247
|
+
style L2 fill:#8B5CF611,stroke:#8B5CF6
|
|
248
|
+
style L3 fill:#EF444411,stroke:#EF4444
|
|
152
249
|
```
|
|
153
250
|
|
|
154
|
-
|
|
251
|
+
```bash
|
|
252
|
+
monomind memory store "key insight" --namespace my-project
|
|
253
|
+
monomind memory search "auth implementation" # BM25 + semantic hybrid
|
|
254
|
+
```
|
|
155
255
|
|
|
156
256
|
---
|
|
157
257
|
|
|
158
|
-
##
|
|
258
|
+
## ๐บ๏ธ Monograph โ Your Codebase, as a Graph
|
|
259
|
+
|
|
260
|
+
Before touching any file, Monomind queries **Monograph** โ a SQLite-backed knowledge graph of your entire codebase. Nodes are files, classes, and functions. Edges are imports, calls, and dependencies.
|
|
159
261
|
|
|
160
262
|
```bash
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
monomind doctor # diagnose your setup
|
|
263
|
+
/mastermind:understand # build the graph
|
|
264
|
+
/mastermind:graph-status # nodes ยท edges ยท freshness
|
|
265
|
+
|
|
266
|
+
# Inside Claude Code, Monograph runs automatically:
|
|
267
|
+
# โ "what files does auth.ts import?"
|
|
268
|
+
# โ "what breaks if I change UserService?"
|
|
269
|
+
# โ "find all callers of validateToken()"
|
|
169
270
|
```
|
|
170
271
|
|
|
272
|
+
23 MCP tools. Impact analysis. Shortest-path queries. Community detection. Zero grep.
|
|
273
|
+
|
|
171
274
|
---
|
|
172
275
|
|
|
173
|
-
##
|
|
276
|
+
## ๐ฃ Hooks & Workers
|
|
174
277
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
278
|
+
Monomind wires 22 hook events into Claude Code. Every edit, task, command, and session fires hooks that log patterns, route agents, and train the intelligence system.
|
|
279
|
+
|
|
280
|
+
```mermaid
|
|
281
|
+
flowchart LR
|
|
282
|
+
CE["Claude Code\nEvent"] --> H["Hook Router"]
|
|
283
|
+
H --> P["pre-edit\npre-task\npre-command"]
|
|
284
|
+
H --> SS["session-start\nsession-end\nnotify"]
|
|
285
|
+
H --> I["route\nlearn\nbuild-agents"]
|
|
286
|
+
H --> T["teammate-idle\ntask-completed"]
|
|
181
287
|
|
|
182
|
-
|
|
288
|
+
I --> DB[("AgentDB\npatterns.json")]
|
|
289
|
+
DB -->|next session| CE
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**12 background workers** run continuously: `security` ยท `health` ยท `swarm` ยท `learning` ยท `patterns` ยท `git` ยท `performance` and more.
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## ๐ก๏ธ MonoFence AI โ Security Layer
|
|
183
297
|
|
|
184
|
-
|
|
298
|
+
Every agent boundary is defended by **monofence-ai** โ real-time detection of prompt injection, jailbreaks, homoglyphs, base64 evasion, multi-turn escalation, and PII leakage.
|
|
185
299
|
|
|
186
300
|
```typescript
|
|
187
301
|
import { isSafe, createMonoDefence } from 'monofence-ai';
|
|
@@ -190,50 +304,93 @@ isSafe('Ignore all previous instructions'); // โ false (~0.04ms)
|
|
|
190
304
|
|
|
191
305
|
const fence = createMonoDefence({ enableContextTracking: true });
|
|
192
306
|
const result = await fence.detect(userInput);
|
|
193
|
-
// result.safe
|
|
307
|
+
// result.safe ยท result.threats ยท result.overallRisk
|
|
194
308
|
```
|
|
195
309
|
|
|
196
|
-
Features: **EvasionDetector** (homoglyphs, leetspeak, base64) ยท **ContextTracker** (multi-turn escalation) ยท **OutputScanner** (PII leakage, echo attacks) ยท **Allowlist** (5 built-in + custom rules) ยท **SecurityHook** (pre-task blocking)
|
|
197
|
-
|
|
198
310
|
---
|
|
199
311
|
|
|
200
|
-
##
|
|
312
|
+
## ๐ 80+ Slash Commands
|
|
201
313
|
|
|
202
|
-
|
|
203
|
-
Claude Code โโ MCP Server โโ Monomind Daemon
|
|
204
|
-
โ
|
|
205
|
-
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
|
|
206
|
-
โผ โผ โผ
|
|
207
|
-
AgentDB Monograph Hooks
|
|
208
|
-
(vector memory) (knowledge graph) (17 hook types)
|
|
209
|
-
โ โ โ
|
|
210
|
-
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
|
|
211
|
-
โผ
|
|
212
|
-
Agent Swarm
|
|
213
|
-
architect ยท coder ยท tester ยท reviewer
|
|
214
|
-
security ยท perf ยท docs ยท researcher
|
|
215
|
-
```
|
|
314
|
+
Everything runs from inside Claude Code via slash commands. Here's the highlight reel:
|
|
216
315
|
|
|
217
|
-
|
|
316
|
+
### Development
|
|
317
|
+
| Command | What it does |
|
|
318
|
+
|---|---|
|
|
319
|
+
| `/mastermind:autodev` | Autonomous research โ build โ review loop |
|
|
320
|
+
| `/mastermind:build` | Build a feature from a brief |
|
|
321
|
+
| `/mastermind:review` | Iterative review until zero findings |
|
|
322
|
+
| `/mastermind:debug` | Systematic root-cause debugging |
|
|
323
|
+
| `/mastermind:tdd` | Red โ Green โ Refactor |
|
|
324
|
+
| `/mastermind:architect` | Architecture review + file structure |
|
|
325
|
+
| `/mastermind:plan` | Comprehensive implementation plan |
|
|
326
|
+
| `/mastermind:worktree` | Feature work in isolated git worktree |
|
|
327
|
+
|
|
328
|
+
### Organizations
|
|
329
|
+
| Command | What it does |
|
|
330
|
+
|---|---|
|
|
331
|
+
| `/mastermind:createorg` | Design an autonomous agent org |
|
|
332
|
+
| `/mastermind:runorg` | Start it as a background daemon |
|
|
333
|
+
| `/mastermind:orgs` | List all orgs + status |
|
|
334
|
+
| `/mastermind:approve` | Action pending approval requests |
|
|
335
|
+
|
|
336
|
+
### Business Domains
|
|
337
|
+
| Command | What it does |
|
|
338
|
+
|---|---|
|
|
339
|
+
| `/mastermind:marketing` | Campaigns, copy, SEO, social |
|
|
340
|
+
| `/mastermind:content` | Blog posts, threads, newsletters |
|
|
341
|
+
| `/mastermind:sales` | Outreach, proposals, pipeline |
|
|
342
|
+
| `/mastermind:finance` | Budgets, invoicing, modeling |
|
|
343
|
+
| `/mastermind:ops` | Operations and workflow automation |
|
|
344
|
+
|
|
345
|
+
**[โ Full reference (80+ commands)](https://monoes.github.io/monomind/#slash)**
|
|
218
346
|
|
|
219
347
|
---
|
|
220
348
|
|
|
221
|
-
##
|
|
349
|
+
## ๐ฆ Packages
|
|
350
|
+
|
|
351
|
+
| Package | npm | Purpose |
|
|
352
|
+
|---|---|---|
|
|
353
|
+
| `monomind` | [](https://www.npmjs.com/package/monomind) | Umbrella โ **install this one** |
|
|
354
|
+
| `@monoes/monomindcli` | [](https://www.npmjs.com/package/@monoes/monomindcli) | CLI engine (41 commands) |
|
|
355
|
+
| `monofence-ai` | [](https://www.npmjs.com/package/monofence-ai) | AI manipulation defence |
|
|
356
|
+
| `@monoes/monograph` | [](https://www.npmjs.com/package/@monoes/monograph) | Code knowledge graph |
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## ๐๏ธ How It's Built
|
|
361
|
+
|
|
362
|
+
```mermaid
|
|
363
|
+
graph TD
|
|
364
|
+
CC["Claude Code"]
|
|
365
|
+
MCP["MCP Server\nmonomind mcp start"]
|
|
366
|
+
D["Background Daemon\n12 workers"]
|
|
367
|
+
|
|
368
|
+
CC <-->|"23 tools: monograph, memory, swarm"| MCP
|
|
369
|
+
MCP <--> D
|
|
370
|
+
|
|
371
|
+
D --> ADB[("AgentDB\nSQLite + HNSW")]
|
|
372
|
+
D --> MG[("Monograph\ncode graph")]
|
|
373
|
+
D --> HK["Hooks\n22 event types"]
|
|
374
|
+
D --> SW["Swarm\n6 topologies\n5 consensus algos"]
|
|
375
|
+
|
|
376
|
+
CC -->|"Task tool - spawns agents"| AG["Agent Swarm\narchitect, coder\ntester, reviewer\nsecurity, perf"]
|
|
377
|
+
AG <-->|reads and writes| ADB
|
|
378
|
+
|
|
379
|
+
style CC fill:#00D2AA22,stroke:#00D2AA
|
|
380
|
+
style AG fill:#8B5CF622,stroke:#8B5CF6
|
|
381
|
+
style ADB fill:#F59E0B22,stroke:#F59E0B
|
|
382
|
+
```
|
|
222
383
|
|
|
223
|
-
|
|
224
|
-
- **60+ agent types** for every engineering task
|
|
225
|
-
- **Self-learning routing** โ agents improve with every session
|
|
226
|
-
- **Monograph** โ full codebase knowledge graph, always fresh
|
|
227
|
-
- **AgentDB** โ hybrid SQLite + HNSW vector memory
|
|
228
|
-
- **17 hook types** โ pre/post edit, task, command, session
|
|
229
|
-
- **Security layer** โ monofence-ai defends every agent boundary
|
|
230
|
-
- **One command** to set direction. Nothing else needed.
|
|
384
|
+
**Claude Code handles all execution.** MCP tools only coordinate. Your data never leaves your machine.
|
|
231
385
|
|
|
232
386
|
---
|
|
233
387
|
|
|
234
388
|
## Resources
|
|
235
389
|
|
|
236
|
-
- ๐ [Documentation](https://monoes.github.io/monomind/)
|
|
390
|
+
- ๐ [Full Documentation](https://monoes.github.io/monomind/)
|
|
391
|
+
- ๐ข [Autonomous Orgs](https://monoes.github.io/monomind/#orgs)
|
|
392
|
+
- โก [Mastermind Reference](https://monoes.github.io/monomind/#mastermind)
|
|
393
|
+
- ๐ [All Slash Commands](https://monoes.github.io/monomind/#slash)
|
|
237
394
|
- ๐ [Issues](https://github.com/monoes/monomind/issues)
|
|
238
395
|
- ๐ฌ [Discussions](https://github.com/monoes/monomind/discussions)
|
|
239
396
|
- ๐ฆ [Changelog v1.11](https://github.com/monoes/monomind/blob/main/CHANGELOG-v1.11.md)
|
|
@@ -241,6 +398,6 @@ Monomind coordinates. Claude Code creates. You ship.
|
|
|
241
398
|
---
|
|
242
399
|
|
|
243
400
|
<p align="center">
|
|
244
|
-
<img src="https://raw.githubusercontent.com/monoes/monomind/main/assets/mascot.png" alt="Monomind" width="
|
|
401
|
+
<img src="https://raw.githubusercontent.com/monoes/monomind/main/assets/mascot.png" alt="Monomind" width="72" /><br/>
|
|
245
402
|
<sub>Built with โฅ by <a href="https://github.com/monoes">monoes</a> ยท MIT License</sub>
|
|
246
403
|
</p>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import Graph from 'graphology';
|
|
2
|
+
// Mirrors upstream graphify's _normalize_id: lowercase + collapse non-alphanumeric to underscores.
|
|
3
|
+
function normalizeId(s) {
|
|
4
|
+
return s.replace(/[^a-zA-Z0-9]+/g, '_').replace(/^_+|_+$/g, '').toLowerCase();
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Build a graphology Graph from extracted nodes and edges.
|
|
8
|
+
* Deduplicates nodes by id, merges parallel edges with higher weight.
|
|
9
|
+
*/
|
|
10
|
+
export function buildGraph(extraction) {
|
|
11
|
+
const graph = new Graph({ type: 'directed', multi: false });
|
|
12
|
+
// Add all nodes โ merge attributes if already present (dedup by id)
|
|
13
|
+
for (const node of extraction.nodes) {
|
|
14
|
+
if (!graph.hasNode(node.id)) {
|
|
15
|
+
graph.addNode(node.id, { ...node });
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
graph.mergeNodeAttributes(node.id, { ...node });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
// Build normalized ID lookup to remap mismatched edge endpoints before stubbing.
|
|
22
|
+
const normToId = new Map();
|
|
23
|
+
graph.forEachNode((id) => {
|
|
24
|
+
normToId.set(normalizeId(id), id);
|
|
25
|
+
});
|
|
26
|
+
// Add edges โ skip self-loops, remap via normalization, stub only true externals
|
|
27
|
+
for (const edge of extraction.edges) {
|
|
28
|
+
let src = edge.source;
|
|
29
|
+
let tgt = edge.target;
|
|
30
|
+
if (!graph.hasNode(src)) {
|
|
31
|
+
const remapped = normToId.get(normalizeId(src));
|
|
32
|
+
if (remapped) {
|
|
33
|
+
src = remapped;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
graph.addNode(src, { id: src, label: src, fileType: 'unknown', sourceFile: '' });
|
|
37
|
+
normToId.set(normalizeId(src), src);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (!graph.hasNode(tgt)) {
|
|
41
|
+
const remapped = normToId.get(normalizeId(tgt));
|
|
42
|
+
if (remapped) {
|
|
43
|
+
tgt = remapped;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
graph.addNode(tgt, { id: tgt, label: tgt, fileType: 'unknown', sourceFile: '' });
|
|
47
|
+
normToId.set(normalizeId(tgt), tgt);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (src === tgt)
|
|
51
|
+
continue;
|
|
52
|
+
try {
|
|
53
|
+
graph.addEdge(src, tgt, {
|
|
54
|
+
relation: edge.relation,
|
|
55
|
+
confidence: edge.confidence,
|
|
56
|
+
confidenceScore: edge.confidenceScore,
|
|
57
|
+
weight: edge.weight ?? 1,
|
|
58
|
+
sourceFile: edge.sourceFile,
|
|
59
|
+
sourceLocation: edge.sourceLocation,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// Edge already exists โ bump its weight
|
|
64
|
+
const existing = graph.edge(src, tgt);
|
|
65
|
+
if (existing) {
|
|
66
|
+
const prev = graph.getEdgeAttribute(existing, 'weight') ?? 1;
|
|
67
|
+
graph.setEdgeAttribute(existing, 'weight', prev + 1);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return graph;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=build.js.map
|