@codewithjuber/forgekit 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +12 -0
- package/.claude-plugin/plugin.json +20 -0
- package/.codex-plugin/plugin.json +29 -0
- package/.mcp.json +8 -0
- package/ARCHITECTURE.md +314 -0
- package/CHANGELOG.md +467 -0
- package/LICENSE +21 -0
- package/ONBOARDING.md +180 -0
- package/README.md +286 -0
- package/bin/claude-init.sh +90 -0
- package/bin/claude-taste.sh +33 -0
- package/bin/learn-consolidate.sh +51 -0
- package/brand.json +15 -0
- package/global/CLAUDE.md +31 -0
- package/global/crew/frontend-verifier.md +36 -0
- package/global/crew/independent-reviewer.md +29 -0
- package/global/crew/scout.md +24 -0
- package/global/crew/verifier.md +28 -0
- package/global/guards/_guardlib.sh +36 -0
- package/global/guards/cortex.sh +14 -0
- package/global/guards/cost-budget.sh +41 -0
- package/global/guards/doom-loop.sh +25 -0
- package/global/guards/format-on-edit.sh +32 -0
- package/global/guards/lean-guard.sh +20 -0
- package/global/guards/protect-paths.sh +45 -0
- package/global/guards/recall-load.sh +22 -0
- package/global/guards/secret-redact.sh +18 -0
- package/global/guards/session-learner.sh +72 -0
- package/global/recall/MEMORY.md +7 -0
- package/global/rules/self-correction.md +17 -0
- package/global/rules/stack-notes.md +24 -0
- package/global/rules/tech-currency.md +19 -0
- package/global/settings.template.json +183 -0
- package/global/statusline.sh +51 -0
- package/global/taste/brutalist.json +9 -0
- package/global/taste/brutalist.md +19 -0
- package/global/taste/corporate.json +9 -0
- package/global/taste/corporate.md +19 -0
- package/global/taste/editorial.json +9 -0
- package/global/taste/editorial.md +19 -0
- package/global/taste/minimalist.json +9 -0
- package/global/taste/minimalist.md +20 -0
- package/global/taste/playful.json +9 -0
- package/global/taste/playful.md +19 -0
- package/global/tools/atlas/SKILL.md +27 -0
- package/global/tools/code-modernization/SKILL.md +275 -0
- package/global/tools/code-modernization/references/cost-impact-preflight.md +54 -0
- package/global/tools/code-modernization/references/design-patterns-cheatsheet.md +24 -0
- package/global/tools/code-modernization/references/research-protocol.md +42 -0
- package/global/tools/code-modernization/scripts/preflight_scan.py +190 -0
- package/global/tools/cognitive-substrate/SKILL.md +56 -0
- package/global/tools/cognitive-substrate/references/capability-map.md +17 -0
- package/global/tools/cost-guard/SKILL.md +50 -0
- package/global/tools/design-md/SKILL.md +54 -0
- package/global/tools/dev-radar/SKILL.md +56 -0
- package/global/tools/explore-plan-code/SKILL.md +24 -0
- package/global/tools/lean/SKILL.md +41 -0
- package/global/tools/recall/SKILL.md +31 -0
- package/global/tools/reuse-first/SKILL.md +64 -0
- package/global/tools/self-improve/SKILL.md +44 -0
- package/global/tools/taste/SKILL.md +26 -0
- package/global/tools/tech-selector/SKILL.md +35 -0
- package/global/tools/ui-workflow/SKILL.md +44 -0
- package/hooks/hooks.json +107 -0
- package/install.sh +88 -0
- package/package.json +93 -0
- package/public/index.html +45 -0
- package/scripts/build-pages.mjs +180 -0
- package/scripts/bump.mjs +322 -0
- package/skills/cognitive-substrate/SKILL.md +56 -0
- package/skills/cognitive-substrate/references/capability-map.md +17 -0
- package/source/mcp.json +10 -0
- package/source/rules.json +106 -0
- package/source/substrate.json +41 -0
- package/src/adjudicate.js +84 -0
- package/src/anchor.js +210 -0
- package/src/atlas.js +487 -0
- package/src/brain.js +84 -0
- package/src/brand.js +25 -0
- package/src/cli.js +1509 -0
- package/src/context.js +273 -0
- package/src/cortex.js +251 -0
- package/src/cortex_distill.js +55 -0
- package/src/cortex_features.js +81 -0
- package/src/cortex_hook.js +197 -0
- package/src/cortex_hook_main.js +139 -0
- package/src/cortex_mcp.js +352 -0
- package/src/cost_report.js +271 -0
- package/src/dash.html +396 -0
- package/src/dash.js +220 -0
- package/src/diagnose.js +0 -0
- package/src/doctor.js +315 -0
- package/src/embed.js +244 -0
- package/src/emit/_shared.js +39 -0
- package/src/emit/aider.js +22 -0
- package/src/emit/claude.js +44 -0
- package/src/emit/codex.js +17 -0
- package/src/emit/continue.js +28 -0
- package/src/emit/copilot.js +12 -0
- package/src/emit/cursor.js +23 -0
- package/src/emit/gemini.js +40 -0
- package/src/emit/mcp.js +94 -0
- package/src/emit/windsurf.js +22 -0
- package/src/emit/zed.js +34 -0
- package/src/eval.js +47 -0
- package/src/extract.js +82 -0
- package/src/harden.js +44 -0
- package/src/imagine.js +301 -0
- package/src/init.js +178 -0
- package/src/lean.js +149 -0
- package/src/ledger.js +475 -0
- package/src/ledger_bridge.js +279 -0
- package/src/ledger_read.js +152 -0
- package/src/ledger_store.js +360 -0
- package/src/lessons.js +185 -0
- package/src/lessons_store.js +137 -0
- package/src/metrics.js +54 -0
- package/src/model_tiers.js +17 -0
- package/src/model_tiers.json +39 -0
- package/src/predictor.js +143 -0
- package/src/preflight.js +410 -0
- package/src/providers.js +320 -0
- package/src/recall.js +103 -0
- package/src/reuse.js +0 -0
- package/src/route.js +323 -0
- package/src/scope.js +122 -0
- package/src/skillgate.js +89 -0
- package/src/speclock.js +64 -0
- package/src/substrate.js +492 -0
- package/src/sync.js +132 -0
- package/src/taste.js +55 -0
- package/src/uicheck.js +96 -0
- package/src/uifingerprint.js +861 -0
- package/src/uivisual.js +334 -0
- package/src/util.js +71 -0
- package/src/verify.js +117 -0
- package/templates/project-layer/.claude/settings.json +22 -0
- package/templates/project-layer/.claude/skills/hostlelo-deploy/SKILL.md +38 -0
- package/templates/project-layer/AGENTS.md +28 -0
- package/templates/project-layer/CLAUDE.md +40 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/claude-code-marketplace.json",
|
|
3
|
+
"name": "forge",
|
|
4
|
+
"owner": { "name": "CodeWithJuber" },
|
|
5
|
+
"plugins": [
|
|
6
|
+
{
|
|
7
|
+
"name": "forgekit",
|
|
8
|
+
"source": ".",
|
|
9
|
+
"description": "One config, every AI coding tool. Cross-tool rules emitter, enforced guards, code-graph, memory, and cost governor."
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
|
|
3
|
+
"name": "forgekit",
|
|
4
|
+
"displayName": "Forge",
|
|
5
|
+
"version": "0.8.0",
|
|
6
|
+
"description": "One config, every AI coding tool — cognitive substrate, tools, crew, guards, atlas, lean, recall from one source.",
|
|
7
|
+
"author": { "name": "CodeWithJuber" },
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": "https://github.com/CodeWithJuber/forgekit",
|
|
10
|
+
"homepage": "https://github.com/CodeWithJuber/forgekit#readme",
|
|
11
|
+
"keywords": ["config", "cross-tool", "agents-md", "ai-coding", "claude-code", "cognitive-substrate"],
|
|
12
|
+
"skills": "./global/tools",
|
|
13
|
+
"agents": [
|
|
14
|
+
"./global/crew/frontend-verifier.md",
|
|
15
|
+
"./global/crew/independent-reviewer.md",
|
|
16
|
+
"./global/crew/scout.md",
|
|
17
|
+
"./global/crew/verifier.md"
|
|
18
|
+
],
|
|
19
|
+
"hooks": "./hooks/hooks.json"
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "forgekit",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "One config, every AI coding tool — cognitive substrate, MCP tools, guards, atlas, recall, and routing from one source.",
|
|
5
|
+
"author": { "name": "CodeWithJuber", "url": "https://github.com/CodeWithJuber" },
|
|
6
|
+
"homepage": "https://github.com/CodeWithJuber/forgekit#readme",
|
|
7
|
+
"repository": "https://github.com/CodeWithJuber/forgekit",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"keywords": ["codex", "mcp", "ai-coding", "agents-md", "cognitive-substrate"],
|
|
10
|
+
"skills": "skills",
|
|
11
|
+
"mcpServers": ".mcp.json",
|
|
12
|
+
"interface": {
|
|
13
|
+
"displayName": "Forge",
|
|
14
|
+
"shortDescription": "Cognitive substrate and one config for every AI coding tool.",
|
|
15
|
+
"longDescription": "Forge adds a pre-action cognitive substrate for coding agents: assumption gating, transparent model routing, impact prediction, scope decomposition, memory/learning context, and verification checklists. It also emits shared rules and MCP config for Codex, Claude Code, Cursor, Gemini, Aider, Copilot, Windsurf/Devin, Zed, Continue, and Roo.",
|
|
16
|
+
"developerName": "CodeWithJuber",
|
|
17
|
+
"category": "Productivity",
|
|
18
|
+
"capabilities": ["MCP", "Skills", "Code Review", "Verification"],
|
|
19
|
+
"websiteURL": "https://github.com/CodeWithJuber/forgekit",
|
|
20
|
+
"privacyPolicyURL": "https://github.com/CodeWithJuber/forgekit/blob/master/SECURITY.md",
|
|
21
|
+
"termsOfServiceURL": "https://github.com/CodeWithJuber/forgekit/blob/master/LICENSE",
|
|
22
|
+
"defaultPrompt": [
|
|
23
|
+
"Run Forge substrate before this edit.",
|
|
24
|
+
"Predict impact for this symbol.",
|
|
25
|
+
"Route this task to the right model tier."
|
|
26
|
+
],
|
|
27
|
+
"brandColor": "#137A72"
|
|
28
|
+
}
|
|
29
|
+
}
|
package/.mcp.json
ADDED
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
# forgekit — architecture
|
|
2
|
+
|
|
3
|
+
> **One brain for every AI coding agent.** A large language model is stateless: one
|
|
4
|
+
> context window, wiped every call. It has no memory of what your team learned, no
|
|
5
|
+
> foresight about what an edit will break, and no enforced guardrails. forgekit is the
|
|
6
|
+
> **cognitive substrate** — the layer that runs *before* the model edits code, supplying
|
|
7
|
+
> proof-carrying memory, impact foresight, and enforced guardrails — and a **cross-tool
|
|
8
|
+
> config compiler** that delivers that brain as native config into every tool at once.
|
|
9
|
+
|
|
10
|
+
This document is the architecture reference. It is organized around four diagrams:
|
|
11
|
+
|
|
12
|
+
1. the four-layer config compiler (one source → native configs),
|
|
13
|
+
2. the pre-action gate pipeline (`forge substrate`),
|
|
14
|
+
3. the proof-carrying-memory ledger and team merge,
|
|
15
|
+
4. the reuse / context loop.
|
|
16
|
+
|
|
17
|
+
The runtime is **zero-dependency Node**. The code graph is `.forge/atlas.json` — plain
|
|
18
|
+
JSON, not a database. The ledger is a directory of content-addressed claims under
|
|
19
|
+
`.forge/ledger/`, committable to git. Optional tiers (`FORGE_EMBED` embeddings,
|
|
20
|
+
Playwright for `uicheck visual`) are opt-in and add no required dependencies.
|
|
21
|
+
|
|
22
|
+
Every command referenced below is real and wired in `src/cli.js`. Run `forge --help`
|
|
23
|
+
for the full list.
|
|
24
|
+
|
|
25
|
+
## Locked decisions
|
|
26
|
+
- **Brand = `Forge`** — CLI `forge`; layer names: skills→**tools**, agents→**crew**,
|
|
27
|
+
hooks→**guards**, code-graph→**atlas**, minimalism→**lean**, memory→**recall**.
|
|
28
|
+
Brand stored as **one token** (`brand.json` → `FORGE_BRAND`); rebrand = 1 edit.
|
|
29
|
+
- **Distributable id = `forgekit`** (npm package + marketplace id) — fixed even if
|
|
30
|
+
the brand token changes, so a rename never breaks install.
|
|
31
|
+
- **Scope = full multi-tool day 1** — nine tools plus MCP, from one canonical source.
|
|
32
|
+
- **Install = all three channels** (plugin + hardened installer + npm CLI), all
|
|
33
|
+
three pointing at the *same* tree ("one tree, three front doors").
|
|
34
|
+
- **Own `lean` + `atlas`** — as *thin layers over proven primitives*, not
|
|
35
|
+
from-scratch reimplementations (reuse-first).
|
|
36
|
+
|
|
37
|
+
## 1. A four-layer config compiler with ONE source
|
|
38
|
+
|
|
39
|
+
You author the substrate once. `forge sync` compiles that source into each tool's
|
|
40
|
+
native config. The four layers are how the brain is expressed; the compiler is how it
|
|
41
|
+
is delivered.
|
|
42
|
+
|
|
43
|
+
```mermaid
|
|
44
|
+
%%{init: {'theme':'base','themeVariables':{'primaryColor':'#201a15','primaryTextColor':'#f2ede7','primaryBorderColor':'#372c22','lineColor':'#f26430','secondaryColor':'#272019','tertiaryColor':'#171310','fontFamily':'ui-sans-serif, system-ui, sans-serif'}}}%%
|
|
45
|
+
flowchart TD
|
|
46
|
+
S["source/<br/>rules.json · substrate.json · mcp.json"] -->|"forge sync<br/>content-hash + DO-NOT-EDIT headers"| N["native configs<br/>CLAUDE.md · AGENTS.md · .cursor · .gemini · .aider · …"]
|
|
47
|
+
S -. configures .-> L
|
|
48
|
+
subgraph L["the four layers"]
|
|
49
|
+
direction LR
|
|
50
|
+
T["tools<br/>model-invoked skills"]
|
|
51
|
+
C["crew<br/>isolated sub-agents"]
|
|
52
|
+
G["guards (enforced)<br/>deterministic hooks"]
|
|
53
|
+
M["mcp<br/>atlas + substrate server"]
|
|
54
|
+
end
|
|
55
|
+
K["local events<br/>cortex · recall · reuse · diagnose"] --> LG[("PCM ledger<br/>.forge/ledger/")]
|
|
56
|
+
O["independent oracles<br/>tests · CI · human accept/revert"] -->|"move confidence"| LG
|
|
57
|
+
LG <-->|"git union-merge, conflict-free"| TM["teammate ledgers"]
|
|
58
|
+
classDef accent fill:#f26430,stroke:#f26430,color:#171310;
|
|
59
|
+
class G accent;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The four layers, brand-named and emitted cross-tool:
|
|
63
|
+
|
|
64
|
+
- **tools** (`~/.forge/tools/` → `~/.claude/skills/`) — model-invoked capabilities.
|
|
65
|
+
- **crew** (`~/.forge/crew/` → `~/.claude/agents/`) — isolated sub-agents
|
|
66
|
+
(scout / verifier / frontend-verifier).
|
|
67
|
+
- **guards** (`~/.forge/guards/` → `settings.json` hooks) — **the only layer that
|
|
68
|
+
*enforces* rather than suggests.** A guard is a deterministic hook the model cannot
|
|
69
|
+
drift from. Prose rules in CLAUDE.md get acknowledged and then forgotten after
|
|
70
|
+
compaction; a guard does not. Every enforceable invariant belongs here.
|
|
71
|
+
- **mcp** — the protocol layer. Forge ships the `atlas` code-graph server and the
|
|
72
|
+
substrate tools (`substrate_check` / `predict_impact` / `assumption_gate`).
|
|
73
|
+
|
|
74
|
+
Cross-cutting concerns thread through all four: **atlas** (the code graph), **lean**
|
|
75
|
+
(minimalism — shipped as *both* a tool and a Stop-guard, so it applies whether or not
|
|
76
|
+
the model invokes it), and **recall** (memory).
|
|
77
|
+
|
|
78
|
+
## 2. The pre-action gate — `forge substrate`
|
|
79
|
+
|
|
80
|
+
**cognitive substrate** — the layer that runs *before* the model edits code. `forge
|
|
81
|
+
substrate "<task>"` (and the MCP tool `substrate_check`) runs one ordered pass of
|
|
82
|
+
checks and returns a single verdict. It composes the individually-callable stages
|
|
83
|
+
(`preflight`, `route`, `atlas`, `impact`, `reuse`, `context`, `scope`, `lean`,
|
|
84
|
+
`anchor`, `verify`) into one pre-action contract.
|
|
85
|
+
|
|
86
|
+
```mermaid
|
|
87
|
+
%%{init: {'theme':'base','themeVariables':{'primaryColor':'#201a15','primaryTextColor':'#f2ede7','primaryBorderColor':'#372c22','lineColor':'#f26430','secondaryColor':'#272019','tertiaryColor':'#171310','fontFamily':'ui-sans-serif, system-ui, sans-serif'}}}%%
|
|
88
|
+
flowchart LR
|
|
89
|
+
RE["referenced<br/>entities"] --> PF["preflight<br/>assumption gap"]
|
|
90
|
+
PF --> RT["route<br/>cheapest tier"]
|
|
91
|
+
RT --> AT["atlas<br/>code graph"]
|
|
92
|
+
AT --> IM["impact<br/>blast radius"]
|
|
93
|
+
IM --> PT["predict<br/>failing tests"]
|
|
94
|
+
PT --> RU["reuse<br/>cache hit?"]
|
|
95
|
+
RU --> CX["context<br/>completeness gate"]
|
|
96
|
+
CX --> SC["scope<br/>coupled files"]
|
|
97
|
+
SC --> ME["memory<br/>recall + lessons"]
|
|
98
|
+
ME --> MN["minimality<br/>lean footprint"]
|
|
99
|
+
MN --> GA["goal-anchor<br/>drift check"]
|
|
100
|
+
GA --> VD["verdict"]
|
|
101
|
+
classDef accent fill:#f26430,stroke:#f26430,color:#171310;
|
|
102
|
+
class VD accent;
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**blast radius** — the set of files an edit is predicted to impact, read from the code
|
|
106
|
+
graph. `forge impact` computes it; the pipeline surfaces it before the model touches
|
|
107
|
+
anything.
|
|
108
|
+
|
|
109
|
+
The verdict is **advisory by default** — it reports, it does not block. Set
|
|
110
|
+
`FORGE_ENFORCE=1` to turn the strongest signals into a hard block:
|
|
111
|
+
|
|
112
|
+
- a **vacuous or underspecified** prompt (preflight finds no actionable intent),
|
|
113
|
+
- **un-assemblable required context** (the completeness gate cannot cover the edit set),
|
|
114
|
+
- a **blast radius over threshold** (default ~25 files).
|
|
115
|
+
|
|
116
|
+
Everything else stays a warning the human can override.
|
|
117
|
+
|
|
118
|
+
## 3. Proof-carrying memory — the ledger + team merge
|
|
119
|
+
|
|
120
|
+
**proof-carrying memory (PCM)** — every stored fact, lesson, or reuse artifact is a
|
|
121
|
+
*claim* that carries its own evidence. It is trusted only once independent oracles
|
|
122
|
+
(tests, CI, a human accept/revert) raise its confidence above a floor. A wrong lesson
|
|
123
|
+
decays out instead of ossifying.
|
|
124
|
+
|
|
125
|
+
All memory subsystems converge on one store. `recall`, `remember`/`brain`, `cortex`
|
|
126
|
+
lessons, `reuse` artifacts, and doom-loop `diagnose` results all write content-addressed
|
|
127
|
+
claims into `.forge/ledger/`. Because a claim's bytes are a pure function of
|
|
128
|
+
`(kind, body, scope)`, every replica computes the same identity — so teammate ledgers
|
|
129
|
+
fold together over plain git with no conflicts.
|
|
130
|
+
|
|
131
|
+
```mermaid
|
|
132
|
+
%%{init: {'theme':'base','themeVariables':{'primaryColor':'#201a15','primaryTextColor':'#f2ede7','primaryBorderColor':'#372c22','lineColor':'#f26430','secondaryColor':'#272019','tertiaryColor':'#171310','fontFamily':'ui-sans-serif, system-ui, sans-serif'}}}%%
|
|
133
|
+
flowchart LR
|
|
134
|
+
subgraph EV["local events"]
|
|
135
|
+
direction TB
|
|
136
|
+
E1["recall / remember"]
|
|
137
|
+
E2["cortex lesson"]
|
|
138
|
+
E3["reuse mint"]
|
|
139
|
+
E4["diagnose"]
|
|
140
|
+
end
|
|
141
|
+
EV -->|"content-addressed claims"| LG[(".forge/ledger")]
|
|
142
|
+
O["independent oracles<br/>tests · CI · human accept/revert"] -->|"append evidence<br/>move confidence"| LG
|
|
143
|
+
TM["teammate ledgers"] <-->|"git union-merge<br/>conflict-free"| LG
|
|
144
|
+
LG --> RV["merged read view<br/>recall list · lesson inject · brain index"]
|
|
145
|
+
classDef accent fill:#f26430,stroke:#f26430,color:#171310;
|
|
146
|
+
class LG accent;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Mechanically: evidence and tombstones are append-only, hash-deduped logs; confidence
|
|
150
|
+
(`val`) is a decayed Beta posterior moved only by oracles; merge is a join-semilattice
|
|
151
|
+
(property-tested: commutative, associative, idempotent), so ledgers converge in any
|
|
152
|
+
order. `forge init` emits the union-merge `.gitattributes` rule; `forge ledger merge`
|
|
153
|
+
folds in any other ledger tree. The legacy stores remain the read path — the ledger is
|
|
154
|
+
where their events converge. Surface: `forge ledger stats | verify | show | blame |
|
|
155
|
+
query | ratify | retract | merge | import` (`--personal` for the per-user ledger).
|
|
156
|
+
Decision recorded in
|
|
157
|
+
[`docs/adr/0006-proof-carrying-memory.md`](docs/adr/0006-proof-carrying-memory.md).
|
|
158
|
+
|
|
159
|
+
## 4. The reuse / context loop
|
|
160
|
+
|
|
161
|
+
`forge reuse` is a proof-carrying code cache. A generated artifact is only served again
|
|
162
|
+
when its evidence still holds — the confidence is above the floor *and* its atlas
|
|
163
|
+
dependencies still resolve. Otherwise it falls through to generation and mints a fresh
|
|
164
|
+
claim on the way back.
|
|
165
|
+
|
|
166
|
+
```mermaid
|
|
167
|
+
%%{init: {'theme':'base','themeVariables':{'primaryColor':'#201a15','primaryTextColor':'#f2ede7','primaryBorderColor':'#372c22','lineColor':'#f26430','secondaryColor':'#272019','tertiaryColor':'#171310','fontFamily':'ui-sans-serif, system-ui, sans-serif'}}}%%
|
|
168
|
+
flowchart LR
|
|
169
|
+
SP["spec"] --> FP["fingerprint<br/>MinHash + LSH"]
|
|
170
|
+
FP --> LD["match ladder<br/>exact → near → adapt → miss"]
|
|
171
|
+
LD --> GT{"confidence ≥ floor<br/>AND deps resolve?"}
|
|
172
|
+
GT -->|"yes"| SV["serve (proof holds)"]
|
|
173
|
+
GT -->|"miss"| GN["generate"]
|
|
174
|
+
GN -->|"mint claim"| MT[(".forge/ledger")]
|
|
175
|
+
MT -.->|"available next time"| FP
|
|
176
|
+
classDef accent fill:#f26430,stroke:#f26430,color:#171310;
|
|
177
|
+
class SV accent;
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The completeness gate on the retrieval side is `forge context "<task>"`: it assembles a
|
|
181
|
+
budgeted context via set-cover over the predicted edit set (`R(edit)`), applies a
|
|
182
|
+
compression ladder, and reports the *computed missing set* — the inputs it could not
|
|
183
|
+
assemble. That missing set is exactly what the substrate pipeline's context stage reads
|
|
184
|
+
to decide whether an edit is safe to start. Surface: `forge reuse query | mint | stats`.
|
|
185
|
+
|
|
186
|
+
## Component map — the reuse ledger (30 components)
|
|
187
|
+
|
|
188
|
+
**Reuse (rename + swap brand token, logic unchanged):**
|
|
189
|
+
`tech-selector · reuse-first · dev-radar · code-modernization · explore-plan-code ·
|
|
190
|
+
cost-guard · ui-workflow · design-md · self-improve` (tools) · `scout · verifier ·
|
|
191
|
+
frontend-verifier` (crew) · `protect-paths · format-on-edit · recall-load ·
|
|
192
|
+
session-learner` (guards) · `statusline` · `tech-currency · stack-notes ·
|
|
193
|
+
self-correction` (rules) · project-layer template.
|
|
194
|
+
|
|
195
|
+
**Own-branded replacements (thin layer over proven primitive):**
|
|
196
|
+
- **`lean`** — a model-invoked **tool** (YAGNI ladder, reuse-before-build,
|
|
197
|
+
shortest-diff) **+** a deterministic **`lean-guard`** Stop-hook that nudges on
|
|
198
|
+
oversized diffs. No plugin, no engine.
|
|
199
|
+
- **`atlas`** — a plain-JSON code graph built and read by Forge itself. No external
|
|
200
|
+
graph engine, no language server, no database.
|
|
201
|
+
|
|
202
|
+
**Net-new (justified by a pain):**
|
|
203
|
+
- **`forge sync`** (the cross-tool emitter) · **`forge doctor`** (health check) ·
|
|
204
|
+
**`forge init`** (one-command bootstrap) · **`cost-budget` guard** ·
|
|
205
|
+
**Start-Here catalog** · **`recall`** unified memory subsystem.
|
|
206
|
+
|
|
207
|
+
## `atlas` — the code graph
|
|
208
|
+
|
|
209
|
+
`forge atlas build [path]` walks the tree and writes a **portable JSON artifact**,
|
|
210
|
+
`.forge/atlas.json`. It is plain JSON on purpose: any tool can read it.
|
|
211
|
+
|
|
212
|
+
- `forge atlas query "what calls Z"` reads the artifact directly — a few hundred tokens
|
|
213
|
+
instead of reading five files.
|
|
214
|
+
- `forge atlas has <symbol>` is the hallucinated-symbol check: if the model calls a
|
|
215
|
+
symbol that is not in the graph, the gate flags it.
|
|
216
|
+
- **Cross-tool by design:** Codex / Cursor / Gemini / Aider read `.forge/atlas.json`
|
|
217
|
+
via the CLI or plain `jq` — **no MCP dependency to consume.** The MCP server is
|
|
218
|
+
optional, lazy-started, for Claude convenience only.
|
|
219
|
+
|
|
220
|
+
`atlas.json` is the single source the impact, reuse-revalidation, and hallucination-flag
|
|
221
|
+
stages all read. There is no SQLite database and no `.forge/atlas.db`.
|
|
222
|
+
|
|
223
|
+
## Verified cross-tool emit matrix
|
|
224
|
+
*(All rows confirmed against vendor docs.)* Forge emits config for **nine tools**, plus
|
|
225
|
+
an **MCP server** for Roo Code and VS Code.
|
|
226
|
+
|
|
227
|
+
| Tool | Native target | How Forge emits |
|
|
228
|
+
|------|---------------|-----------------|
|
|
229
|
+
| **Claude Code** | `CLAUDE.md` (+ `.claude/rules/*.md`, `settings.json`); **no** AGENTS.md | Thin `CLAUDE.md` whose first line is `@AGENTS.md`; guards+permissions → `settings.json` |
|
|
230
|
+
| **Codex** | `AGENTS.md` native (32 KiB cap) | Canonical `AGENTS.md` at root **is** the source; keep < 32 KiB or it silently truncates |
|
|
231
|
+
| **Cursor** | `AGENTS.md` + `.cursor/rules/*.mdc` (`.cursorrules` deprecated) | `AGENTS.md` for flat rules; `.mdc` when scoping/precedence needed; never leave a legacy `.cursorrules` |
|
|
232
|
+
| **Gemini** | `GEMINI.md` by default; **AGENTS.md only via `context.fileName` opt-in** | Write `.gemini/settings.json` `context.fileName:["AGENTS.md",…]` (avoids a 2nd copy) |
|
|
233
|
+
| **Aider** | `CONVENTIONS.md` via `read:` in `.aider.conf.yml` | Emit `.aider.conf.yml` with `read: AGENTS.md` |
|
|
234
|
+
| **Copilot** | root `AGENTS.md` + `.github/copilot-instructions.md` | Rely on root `AGENTS.md`; optional generated `.github` pointer |
|
|
235
|
+
| **Windsurf/Devin** | `AGENTS.md` auto-discovered; caps 6k/12k chars | Root `AGENTS.md` under caps; detect `.windsurf` vs `.devin` at init |
|
|
236
|
+
| **Zed** | first match of a precedence list incl. `AGENTS.md` | Emit `AGENTS.md` + doctor flags any earlier-precedence legacy file shadowing it |
|
|
237
|
+
| **Continue** | `.continue/rules/*.md` + `.continue/mcpServers/*.yaml` | Emit a rules file plus the Forge MCP server config |
|
|
238
|
+
|
|
239
|
+
Roo Code and VS Code receive the Forge MCP server via `forge init`
|
|
240
|
+
(`.roo/mcp.json`, `.vscode/mcp.json`) rather than a rules file.
|
|
241
|
+
|
|
242
|
+
## Repo layout — one tree, three front doors
|
|
243
|
+
```
|
|
244
|
+
forgekit/
|
|
245
|
+
package.json # npm CLI: bin `forge` → src/cli.js
|
|
246
|
+
brand.json # single FORGE_BRAND token + layer-name map
|
|
247
|
+
README.md # Start-Here index + one bootstrap command
|
|
248
|
+
src/
|
|
249
|
+
cli.js # init | sync | doctor | substrate | ledger | reuse | … (`forge --help` for all)
|
|
250
|
+
sync.js # emitter (source → per-tool targets); hash + DO-NOT-EDIT
|
|
251
|
+
doctor.js # health checks
|
|
252
|
+
emit/ # one module per tool (claude, codex, cursor, gemini, aider, copilot, windsurf, zed, continue) + mcp
|
|
253
|
+
ledger.js # PCM core: content-addressed claims, oracle taxonomy, decayed Beta val, Eq. 3 retrieval, semilattice merge (ADR-0006)
|
|
254
|
+
ledger_store.js # git-native on-disk ledger (.forge/ledger/): sharded claims, append-only evidence/tombstone logs, normal-form verify
|
|
255
|
+
ledger_bridge.js # legacy-store bridge: cortex/recall/brain shadow-writes + idempotent `ledger import`
|
|
256
|
+
ledger_read.js # merged legacy∪ledger read path: cortex lesson/fact injection, `recall list`, brain's AGENTS.md index all see teammate knowledge from `ledger merge`
|
|
257
|
+
reuse.js # proof-carrying artifact cache: fingerprint (MinHash+LSH), exact→near→adapt→miss ladder, atlas revalidation
|
|
258
|
+
embed.js # optional embeddings tier (ADR-0005): FORGE_EMBED=cmd:<cmd>|http:<url>, swaps MinHash/Jaccard for cosine in `reuse query`/`ledger query`, disk-cached at .forge/embed-cache.jsonl, silent fallback to MinHash
|
|
259
|
+
context.js # budgeted context assembly + completeness gate: R(edit) set cover, compression ladder, computed missing-set
|
|
260
|
+
diagnose.js # doom-loop diagnosis: normalized failure signatures; 3× = diagnosis claim + one-tier escalation
|
|
261
|
+
imagine.js # consequence simulation (Eq. 4): predicted breaks + minimal dry-run suite via greedy set cover
|
|
262
|
+
uifingerprint.js # deterministic design fingerprint + slop-distance / conformance gate (no LLM, no screenshots)
|
|
263
|
+
taste.js # taste-profile system: applies design-taste profiles (brutalist, corporate, editorial, minimalist, playful; JSON in global/taste/) to parameterize `uicheck design` gate thresholds via --taste
|
|
264
|
+
dash.js # localhost-only read-only dashboard over the ledger, metrics, and blast radius (node:http, one HTML page)
|
|
265
|
+
metrics.js # stage-tagged .forge/metrics.jsonl — the measured events every cost figure is computed from
|
|
266
|
+
cost_report.js # per-stage cost factors as pure arithmetic over metrics.jsonl; composes ONLY measured stages
|
|
267
|
+
source/
|
|
268
|
+
rules.json # THE canonical rules source (git · testing · security · style)
|
|
269
|
+
substrate.json # cognitive-substrate defaults (thresholds, routing, llm knobs)
|
|
270
|
+
mcp.json # MCP server definitions emitted into each tool
|
|
271
|
+
global/ # installs into ~/.forge, symlinked into ~/.claude
|
|
272
|
+
tools/ crew/ guards/ rules/ recall/ taste/ statusline.sh settings.template.json
|
|
273
|
+
templates/project-layer/ # per-repo template
|
|
274
|
+
.claude-plugin/ .codex-plugin/ # plugin manifests → point at global/ + skills/ (no dup beyond the codex skill mirror)
|
|
275
|
+
install.sh # hardened: idempotent, symlink, backup, no curl|sh
|
|
276
|
+
bin/ # back-compat shims → src/cli.js
|
|
277
|
+
landing/ # hand-authored public landing page; design tokens shared with `forge dash`
|
|
278
|
+
scripts/
|
|
279
|
+
build-pages.mjs # generates public/index.html, the live status page, from real repo data
|
|
280
|
+
```
|
|
281
|
+
Public site deploy (two independent Pages targets, both built from `landing/` +
|
|
282
|
+
`scripts/build-pages.mjs`): `.github/workflows/static.yml` (GitHub Pages — assembles
|
|
283
|
+
landing + status page into one `_site/`) · `.gitlab-ci.yml` (GitLab Pages — status
|
|
284
|
+
page only).
|
|
285
|
+
|
|
286
|
+
The plugin manifest, `install.sh`, and the npm bin **all reference `global/` +
|
|
287
|
+
`source/`** — no duplication; each channel just runs `forge sync` at the end. A test
|
|
288
|
+
asserts all three resolve to `global/`.
|
|
289
|
+
|
|
290
|
+
## Risks & honest boundaries
|
|
291
|
+
- **Enforcement ceiling** — guards enforce only what is expressible as a hook (paths,
|
|
292
|
+
format, diff-size, budget). Semantic rules ("prefer functional") stay prose and
|
|
293
|
+
*will* sometimes be ignored. Forge **reduces, does not eliminate** rule drift. Say so.
|
|
294
|
+
- **Verification reduces, does not certify** — `crew` verifiers and the `atlas has`
|
|
295
|
+
hallucination flag cut review burden; they do not prove the code correct.
|
|
296
|
+
- **No weight-level learning** — `recall` / `self-improve` are file-and-prompt memory
|
|
297
|
+
only. No RL, no fine-tuning. Consolidation is a Haiku summarizer that can hallucinate
|
|
298
|
+
→ advisory, human-reviewable, secret-free.
|
|
299
|
+
- **Hook fragility is upstream** — Windows / worktree / long-session hook failures
|
|
300
|
+
affect Forge guards too. Mitigated with defensive path resolution + `forge doctor`;
|
|
301
|
+
the ceiling is inherited, not removed.
|
|
302
|
+
- **Char caps** — Codex 32 KiB, Windsurf 6k/12k, marketplace budget truncation →
|
|
303
|
+
`forge sync` enforces a source size budget.
|
|
304
|
+
- **Own atlas + lean = new maintenance surface** previously outsourced. Atlas is scoped
|
|
305
|
+
to the minimum graph that powers reuse + hallucination-flag, not a code-intel product.
|
|
306
|
+
- **Three channels triple drift surface** — mitigated by "one tree" + the resolve test.
|
|
307
|
+
- **Not shipped (exploring)** — deeper language-server / serena-style semantic
|
|
308
|
+
resolution and an embeddings-backed atlas were prototyped but are **not in the
|
|
309
|
+
runtime**. The shipped code graph is plain-JSON, tree-walk based, zero-dependency.
|
|
310
|
+
`FORGE_EMBED` is the only embeddings path, and it is opt-in.
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
See [ROADMAP.md](ROADMAP.md) for direction and [`docs/adr/`](docs/adr/) for the recorded
|
|
314
|
+
architecture decisions (zero runtime deps, the SKILL.md standard, guard-over-prose).
|