cubicore 0.0.0-stage → 1.0.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/README.md CHANGED
@@ -1,3 +1,272 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # Cubicore
4
+
5
+ </div>
6
+
7
+ Cubicore is a Dynamic Multi-Agentic Factory of Sub-agents tasked to make a project, utilizing the Decrease-and-Conquer Technique.
8
+
9
+ ---
10
+
11
+ What if you wished to make a "company" right at home, where you are the founder of the project, and your fellow sub-agents do the work for you? Cubicore does that for you. It is an MCP having commands required to finish your project, quicker.
12
+
13
+ ## Introduction
14
+
15
+ Cubicore is originated as "Cores in a Cubicle", and informally, "A Fleet of Engineers in a Company". The "Cubicle" in this idea is Dynamic, which increases its size dynamically, depending on the plan on the **size of the project**.
16
+
17
+ The Core philosphy it presents is simple: Suppose a user gives a prompt to the "Cubicle". The "Cubicle" changes its size according to what the user said about. The size stops increasing when the planning is done, and all is left is to wait for the user to "execute" the plan.
18
+
19
+ This upon execution will summon sub-agents, where 1 task is recieved by 1 agent. This eventually fills up the "Cubicle" where all tasks are done simultaneously. The execution is done where all sub-agents have completed their tasks provided in the planning file.
20
+
21
+ Cubicore can debug any broken layout, buttons, syntax errors, loose code, etc. and fix them automatically until issues disappear. Cubicore also allows the user to "preview" its project to see how it runs. Finally, if the user satisfies with the project, it then commands the "Cubicle" to deploy the application, making things ready while also giving instructions on how to deploy.
22
+
23
+ ---
24
+
25
+ ## Supported AI Agents
26
+
27
+ Currently, we only support Opencode for now.
28
+
29
+ | AI Agent | Status | Progress |
30
+ |-----------------|--------|------------------------------------------------------------------------|
31
+ | Opencode | ✅ | Done Further token reduction and Optimize productivity of sub-tasks. |
32
+ | Claude Code | ⏰ | Will be implementing Inline Sub-tasks. Not Started. |
33
+ | Codex | ⏰ | Has Inline-Sub tasks; Needs Further token reduction. Not Started. |
34
+ | Cursor | ⏰ | Uses Sessions; Tedious to implement as first Session-only integration. |
35
+ | Windsurf | ⏰ | May use Inline Sub-tasks or Sessions. Not Started. |
36
+
37
+ More agents are coming soon!
38
+
39
+ ---
40
+
41
+ ## 🧪 Lazy Prompt Examples
42
+
43
+ You don't need to write a spec. Just say what you want in plain words — Cubicore
44
+ passes your exact request to the planner, researches your repo, asks clarifying
45
+ questions, scopes down to an MVP, and writes a plan you review before anything
46
+ is built. Cubicore builds what you ask for — a todo app stays a todo app, not
47
+ an expense tracker.
48
+
49
+ ### Solo — Demo (`/cubicore:plan-demo`)
50
+
51
+ > "Make me a simple todo app that works in the browser."
52
+
53
+ Cubicore will **not** just build a todo app. It follows this order:
54
+
55
+ 1. **Prepare** — initialises git and records a baseline (or leaves an existing repo alone)
56
+ 2. **Research** — reports the tree, modules, and their exports; no shell exploring afterwards
57
+ 3. **Decide scope** — demo/MVP, conventional boring stack, one contract per file or feature, fewer larger contracts over many small ones
58
+ 4. **Write plan** — `CUBICORE_PLAN.md` (for you), `CUBICORE_PLAN.json` (dispatchable), `CUBICORE_CONTEXT.md` (for presenting in person)
59
+
60
+ The plan includes a `summary` (one or two sentences at the top of `CUBICORE_PLAN.md`), a `context` field (problem, users, use cases, benefits, demo flow, future work — never affects what gets built), disjoint `writes` per contract, at least one failing check per contract, and a `graphBudget` sized to the contracts.
61
+
62
+ **Dispatch nothing** — you review the plan first.
63
+
64
+ Then run `/cubicore:execute` to build it, `/cubicore:preview` to leave it running, and
65
+ `/cubicore:debug` to review/test/fix it.
66
+
67
+ ### Solo — Full (`/cubicore:plan-full`)
68
+
69
+ > "Build me a personal finance tracker with categories, monthly summaries, and CSV export."
70
+
71
+ Same four steps, but scoped as a full product with 6–12 contracts (API, frontend,
72
+ storage, checks). Review the plan before dispatching.
73
+
74
+ Then run `/cubicore:execute` → `/cubicore:debug` → `/cubicore:preview` → `/cubicore:deploy`.
75
+
76
+ ### Team of 3 — Demo (`/cubicore:plan-demo` then split)
77
+
78
+ > "Make a hackathon project board where our team can drop ideas and vote on them."
79
+
80
+ After the plan is written, split it across the team:
81
+
82
+ ```
83
+ /cubicore:execute planNumber 1 # Member A: frontend board UI
84
+ /cubicore:execute planNumber 2 # Member B: voting logic + API
85
+ /cubicore:execute planNumber 3 # Member C: idea storage + export
86
+ ```
87
+
88
+ Each member works in their own worktree with disjoint write scopes — no merge
89
+ conflicts. Use `/cubicore:status` to check a run, `/cubicore:continue`
90
+ with `planNumber` to resume after interruptions.
91
+
92
+ ### Team of 3 — Full (`/cubicore:plan-full` then split)
93
+
94
+ > "Build a client portal for our small design agency: client login, project uploads, invoice PDFs, and a dashboard."
95
+
96
+ After the plan is written:
97
+
98
+ ```
99
+ /cubicore:execute planNumber 1 # Member A: auth + client portal UI
100
+ /cubicore:execute planNumber 2 # Member B: uploads + invoice generation
101
+ /cubicore:execute planNumber 3 # Member C: dashboard + reporting
102
+ ```
103
+
104
+ Each member works in their own worktree with disjoint write scopes — no merge
105
+ conflicts. Use `/cubicore:status` to check each run, `/cubicore:continue`
106
+ with `planNumber` to resume after interruptions.
107
+
108
+ ---
109
+
110
+ ## Commands
111
+
112
+ | Command | What it does |
113
+ |---|---|
114
+ | `/cubicore:plan-demo` | Demo mode. Research the repository, ask the founder what the repo cannot answer, then write `CUBICORE_PLAN.md` and `CUBICORE_PLAN.json`. Dispatches nothing. **Use for a fresh start; `refine` to change an existing plan.** |
115
+ | `/cubicore:plan-full` | Full product mode of the command above. **Use for a fresh start; `refine` to change an existing plan.** |
116
+ | `/cubicore:execute` | Dispatch the plan — one brief per associate, summoned in parallel, each result gated. Pass `plan` (inline JSON) or `planNumber` (reads `CUBICORE_PLAN_N.json` from disk). `planNumber` is optional: omit it to run the inline plan, or pass a number to dispatch a member plan file. Enforces the cycle budget and cross-plan validation when reading from disk. |
117
+ | `/cubicore:continue` | Resume the last run from where it stopped — skips contracts already done, dispatches only what remains. Exempt from the cycle budget. Reads `CUBICORE_PLAN.json` by default, falls back to `CUBICORE_PLAN_1.json`, or `CUBICORE_PLAN_N.json` when a plan number is given. |
118
+ | `/cubicore:debug` | Review, test, and fix the delivered work until the issues disappear. Runs the mechanical matrix, records findings, and attempts narrowly-scoped fixes. Errors and warnings block; judgement calls are reported and never block. Writes `CUBICORE_DEBUG.md`. |
119
+ | `/cubicore:refine` | Change the current plan before running it, or add a feature to a project that has already been built. Contracts that already passed and were left alone are not re-run, so the second cycle costs the change and not the project. |
120
+ | `/cubicore:estimate` | What the plan will cost before anything is spent: how many associates, the token and wall ceilings, and who owns what. It is the plan's own budget, not a forecast. |
121
+ | `/cubicore:undo` | Undo the last execution — discard its changes and return the tree to the baseline commit Cubicore recorded. Destroys work, so it says what it will destroy first. |
122
+ | `/cubicore:deploy` | Plan the deployment. Asks about the tier, offers stacks with a recommendation, writes the deploy files, and explains the manual steps. Deploys nothing. |
123
+ | `/cubicore:preview` | Run the delivered thing the way the founder would use it — web app on localhost, CLI verified by its output, TUI/GUI verified by its interface. A contract can be correct and still not run. Uses the plan's own `preview` block. |
124
+ | `/cubicore:status` | Report what the run in flight is doing, and wait for it if it is not finished. |
125
+
126
+ **Quick command guide:** `plan-demo`/`plan-full` = fresh plan (always writes from scratch; note warns if plan exists); `refine` = edit existing plan (adds/changes without destroying); `execute` = dispatch; `preview` = keep it running; `debug` = review/test/fix; `undo` = discard; `continue` = resume; `estimate` = budget; `deploy` = deploy plan; `refine` = add/change features. Use the right one — `refine` is the mandatory iterative-editing command; it does jobs no other command can do.
127
+
128
+ ### The flow guides itself
129
+
130
+ After every step the agent ends its reply with what to type next, and the alternatives — the recommended one first. It is derived from the state on disk, so it survives a restart and a new session days later.
131
+
132
+ ```
133
+ no plan /cubicore:plan
134
+ after plan /cubicore:execute · estimate · refine
135
+ run in flight /cubicore:status
136
+ after the run /cubicore:preview · debug · refine · undo · continue
137
+ issues found /cubicore:debug · refine · undo · continue
138
+ everything passes /cubicore:deploy · refine · undo
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Installation
144
+
145
+ ```bash
146
+ npx cubicore@latest setup
147
+ ```
148
+
149
+ Works anywhere npm/npx works — Windows, macOS, Linux, NixOS. Installs Cubicore **globally for your user account** (never into a project):
150
+
151
+ 1. Prints a banner and asks which OpenCode you run — **Native (CLI / Desktop)** (default) or **Flatpak** (Linux only).
152
+ 2. Copies the MCP runtime into a user-global directory.
153
+ 3. Registers `mcp.cubicore` in the chosen variant's global config and installs the associate agents (primary agent bounded to 120 steps).
154
+
155
+ If the chosen OpenCode's config directory is missing, nothing is written and the script says so. Re-run the same command to update. **Restart OpenCode afterwards.**
156
+
157
+ Then in any project directory, type:
158
+
159
+ ```
160
+ /cubicore:plan-demo
161
+ ```
162
+
163
+ See [OpenCode Installation](opencode/opencode.md) for full installation instructions,
164
+ troubleshooting, FAQs, and AI agent installation.
165
+
166
+ ### How the associates are kept apart
167
+
168
+ Three layers, and only the first was ever airtight.
169
+
170
+ **At plan time**, the validator rejects overlapping write scopes before a token is spent. It is a conservative over-approximation — `src/routes/` and `src/routes/users.ts` collide, `src/a.ts` and `src/b.ts` do not — because over-reporting costs one re-plan while under-reporting costs a merge conflict.
171
+
172
+ **During the work**, each associate gets its own git worktree, so two workers cannot be in one file at the same moment. The session is created and prompted there, and the contract's declared writes are copied back only after its checks pass. Because the scopes are disjoint, that copy cannot conflict. Where git is unavailable the isolate degrades to the shared tree and says so.
173
+
174
+ **After the work**, the scope gate checks what actually changed against what was declared. A worker that strayed is caught, and a check that could not run at all is reported as unverified rather than as a failure — no evidence either way, and not retryable, because a revision cannot install a missing dependency.
175
+
176
+ opencode 1.18.x cannot restrict an agent to a path — its permissions are per-action, not per-resource — so the filesystem is the only boundary available.
177
+
178
+ ---
179
+
180
+ ## What Cubicore is for
181
+
182
+ The honest claim, in three parts.
183
+
184
+ **Splitting work without coordination is not free parallelism.** Measured
185
+ against one agent doing the same job, twelve uncoordinated workers cost
186
+ **10.9× the tokens and were 2.6× slower**. Every worker loaded the whole
187
+ repository into its own context and nothing stopped them colliding.
188
+
189
+ **Cubicore fixes the cost side.** Against the same twelve-worker fan-out,
190
+ Cubicore was **3.5× cheaper** — narrower write scopes, so each worker reads
191
+ only what its contract needs instead of the whole repository. The naive arm
192
+ spent 96.0M tokens on cache reads; Cubicore spent 25.0M, for the same twelve
193
+ workers. That difference is the contract layer and nothing else.
194
+
195
+ The wall-clock comparison is *not* clean, and Cubicore does not claim it: the
196
+ naive arm was capped at three concurrent workers and Cubicore dispatched all
197
+ twelve, so most of the 2.9× gap is that cap rather than the contract layer.
198
+ Cubicore has no concurrency cap of its own yet, so the fair comparison could
199
+ not be run as written.
200
+
201
+ **But Cubicore does not beat one agent.** On twelve small files it was level
202
+ on wall clock and cost 3.1× the tokens. The work was too small to need parallel
203
+ workers, and the model was the bottleneck, not the split.
204
+
205
+ So the value is conditional, and the condition is about the work rather than
206
+ about Cubicore:
207
+
208
+ | Situation | Cubicore is |
209
+ |---|---|
210
+ | Several hours of genuinely independent work | worth it — 3.5× cheaper than naive fan-out |
211
+ | A couple of hours, or one sitting | overhead — 3.1× the tokens for parity |
212
+ | Coupled work, a shared core, an integration step | refuses it — the topology check catches it before a token is spent |
213
+ | One agent, done in one pass | overhead, and the plan says so |
214
+
215
+ The "9 hours becomes 4" shape is real against the right control, but it is not
216
+ "because of splitting". Splitting is what makes the naive version slow. Cubicore
217
+ is what makes splitting pay. And the ceiling is below 9→4 for most projects,
218
+ because Amdahl's serial fraction does not parallelise and the gates cost
219
+ something too.
220
+
221
+ **And the real value is not speed.** It is that four agents can work on the same
222
+ repository without colliding, and that "done" means the checks passed rather
223
+ than that a model said so. The speedup is a side effect.
224
+
225
+ Full numbers and the caveats: [bench/RESULTS.md](bench/RESULTS.md).
226
+
227
+ ---
228
+
229
+ ## What exists
230
+
231
+ - **Contracts, not prompts.** Disjoint write scopes, a check matrix computed at
232
+ validation time, budget caps, and a topology check that refuses work which is
233
+ not divide-and-conquer.
234
+ - **Narrative context.** `CUBICORE_CONTEXT.md` — problem, users, use cases,
235
+ benefits, demo flow, future work, market opportunity, business model,
236
+ competitive advantage, go-to-market, risks, current status, and the ask.
237
+ Written for humans who present the project in person; never parsed by
238
+ Execute or dispatch.
239
+ - **Two dispatch paths.** Inline sub-tasks where the host supports them, sessions
240
+ where it does not. Both gate the same way.
241
+ - **One worktree per associate.** opencode 1.18.x cannot restrict an agent to
242
+ a path, so the filesystem is the boundary: two workers cannot be in one file
243
+ at the same moment. A worker's files are copied back only after its checks
244
+ pass, so an unapproved change never reaches the shared tree.
245
+ - **Fourteen commands, and the flow guides itself.** Every reply ends with the
246
+ next step and the alternatives, derived from the state on disk rather than
247
+ remembered.
248
+ - **A bounded loop.** `plan → execute → debug → execute`, capped at three
249
+ cycles. Not "until the debug file is empty" — that is an unbounded loop whose
250
+ terminal case is an agent that never stops finding things to fix.
251
+ - **Judgement never blocks.** Errors and warnings block. "Is this useful" and
252
+ "is this production ready" are recorded as advisory and left to the founder.
253
+
254
+ ---
255
+
256
+ ## Known limits
257
+
258
+ - **v1 catches mechanical failures only.** No `judgment` checks are admitted;
259
+ the validator rejects them. Whether a feature is *useful* is not something
260
+ the matrix can decide.
261
+ - **X and Y are measured, but not in one controlled run.** The three arms have
262
+ each run against the same fixture, and the ratios are large enough to
263
+ survive that — but the digits do not come from one clock.
264
+ - **Y**, total tokens against naive fan-out: **0.29**
265
+ - **X**, per-worker cost against naive fan-out: **0.29**
266
+ - Wall clock against naive fan-out: **2.9× faster** — ⚠ confounded, the
267
+ naive arm ran three-wide and Cubicore ran twelve-wide. Do not quote it.
268
+ - Against a *single* agent: parity on wall clock and **3.1× more tokens**
269
+ - **The inline path's shell is still unrestricted.** opencode 1.18.x cannot
270
+ restrict an agent to a path, so a worker with a shell can run anything. The
271
+ worktree contains the damage — a stray file stays in the worker's own
272
+ checkout and is not copied back — but the command still ran.