kracked-core 1.5.1 → 1.6.2

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
@@ -13,10 +13,20 @@ Kracked Core fixes both.
13
13
  npx kracked-core init
14
14
  ```
15
15
 
16
+ Zero dependencies · plain markdown files · nothing leaves your machine
17
+
16
18
  </div>
17
19
 
18
20
  ---
19
21
 
22
+ ## Contents
23
+
24
+ **Start here** — [The problem](#the-problem) · [What it actually is](#what-it-actually-is) · [Install](#install) · [Your first session](#your-first-session) · [A worked example](#a-worked-example)
25
+
26
+ **Reference** — [How memory works](#how-memory-works) · [The build flow](#the-build-flow) · [What gets written](#what-gets-written-to-disk) · [Commands](#command-reference) · [Editor support](#editor-support) · [FAQ](#faq)
27
+
28
+ ---
29
+
20
30
  ## The problem
21
31
 
22
32
  You've had this conversation:
@@ -30,7 +40,15 @@ Tomorrow it happens again. Your agent has no memory. Every session starts from z
30
40
 
31
41
  The second problem is quieter: you describe a feature in one sentence, the agent builds *something*, and you spend the next hour discovering it wasn't what you meant.
32
42
 
33
- ## What this gives you
43
+ ## What it actually is
44
+
45
+ Kracked Core is a **CLI installer**. You run it once in a project, it asks a few questions, and it writes a set of markdown files to your disk. That's the whole product — there is no app, no server, no extension.
46
+
47
+ Those files do two jobs:
48
+
49
+ **1. They give your agent a memory.** A `~/.kracked/` folder holds who your agent is, how you like to work, and every lesson it has learned. A `.kracked/` folder in each project holds that codebase's stack, conventions, and current state. Your agent reads them at the start of every session.
50
+
51
+ **2. They give your agent a process.** Five skills get installed as slash commands. They cover starting a session, building a feature properly, and writing memory down before you close the laptop.
34
52
 
35
53
  | | Before | After |
36
54
  |---|---|---|
@@ -39,7 +57,13 @@ The second problem is quieter: you describe a feature in one sentence, the agent
39
57
  | **Building** | "Build me X" → surprise | Idea → spec → build → review, with a tracker you can see |
40
58
  | **"Done"** | Agent says done, it isn't | Nothing is `done` without stated evidence |
41
59
 
42
- It's plain markdown files. You can read them, edit them, commit them to git, and delete them. No database, no cloud, no black box.
60
+ It's plain markdown. You can read it, edit it, commit it to git, and delete it. No database, no cloud, no black box. If you don't like what your agent believes, open the file and fix the sentence.
61
+
62
+ ### What it is not
63
+
64
+ - **Not a model or an agent.** It configures the agent you already use.
65
+ - **Not a hosted service.** Nothing is uploaded. There's no account and no telemetry.
66
+ - **Not automatic.** Memory gets written when you run `/kracked-wrap`. Skip that, and nothing is saved.
43
67
 
44
68
  ## Install
45
69
 
@@ -47,33 +71,176 @@ It's plain markdown files. You can read them, edit them, commit them to git, and
47
71
  npx kracked-core init
48
72
  ```
49
73
 
50
- The wizard asks a few questions — name your agent, is this a new or existing project, which editor you use — and writes the files. Hold Enter through it and you'll get a sane setup.
74
+ The wizard asks six questions. Pressing Enter through all of them gives you a working setup.
75
+
76
+ | # | Question | Default | What it affects |
77
+ |---|---|---|---|
78
+ | 1 | What should we call your agent? | `KC` | Your agent's name, used everywhere in its memory |
79
+ | 2 | Your name? | your system username | How it addresses you |
80
+ | 3 | Set up this project? | Yes | Whether project memory is written here |
81
+ | 4 | Project directory? | `.` (here) | Where project memory goes |
82
+ | 5 | New project or existing codebase? | auto-detected | Scan vs. ask |
83
+ | 6 | Which editor(s) do you use? | Antigravity + Claude Code | Which skill folders get written |
84
+
85
+ **Existing codebase?** It scans your repo — package name, stack, git status, npm scripts — shows you what it found, and asks if that's right before writing anything.
86
+
87
+ **Starting fresh?** It asks two optional questions instead (what you're building, what stack), so your agent knows something on day one rather than nothing.
88
+
89
+ **Already installed here?** It notices, and offers to refresh package files, reinstall, or cancel — rather than asking you about 27 files one at a time.
90
+
91
+ Node 18 or newer. No other dependencies — the package installs nothing.
51
92
 
52
- **Full support** (memory + all five commands):
53
- **Antigravity** · **Claude Code** · **Kilo Code** (VS Code) · **Roo Code** (VS Code)
93
+ ## Your first session
54
94
 
55
- **Memory only:** Cursor, Windsurf, and anything else that reads `AGENTS.md` — your agent loads its
56
- memory, but the `/kracked-*` commands aren't installed, because those editors use a different
57
- skill format. You can still run the flow by asking in plain language.
95
+ After `init` finishes, it tells you exactly this:
96
+
97
+ ```
98
+ Next step:
99
+ Open this project in your editor and run /kracked-boot to load Nova's memory.
100
+ ```
58
101
 
59
- ## Use
102
+ **Restart your editor first.** Editors load skills at startup, so the `/kracked-*` commands won't appear until you do.
60
103
 
61
- Five commands. Three of them are the whole daily loop.
104
+ Then the daily loop is three commands:
62
105
 
63
106
  ```
64
107
  /kracked-boot Start of session — agent loads its memory and tells you where you left off
65
108
  /kracked-sdd Build something — idea → spec → docs → build → review
66
109
  /kracked-wrap End of session — agent writes down what it learned
110
+ ```
111
+
112
+ Boot gives you back a single line, not a wall of text:
113
+
114
+ > I'm Nova. Last session: shipped email login (story 1.1). Next: password reset (1.2). Caution: this project's tests don't cover the auth callback.
115
+
116
+ Two more commands you'll use occasionally:
67
117
 
118
+ ```
68
119
  /kracked-identity Change your agent's name, tone, or how you like to work
69
120
  /kracked-explain "What is all this?" — walks you through what got installed
70
121
  ```
71
122
 
72
- > **`/kracked-wrap` is not optional.** Boot without wrap is a memory system that just forgets more slowly. The wrap is where memory actually gets written.
123
+ > **`/kracked-wrap` is not optional.** Boot without wrap is a memory system that just forgets more slowly. The wrap is where memory actually gets written — lessons, session state, decisions. Close the laptop without it and the session is gone.
124
+
125
+ ## A worked example
73
126
 
74
- ## How it works
127
+ Here's a real first day, start to finish.
75
128
 
76
- Two layers of memory, and the split between them is the whole idea.
129
+ ### 1. Install
130
+
131
+ ```bash
132
+ cd ~/code/demo-app
133
+ npx kracked-core init
134
+ ```
135
+
136
+ You name the agent `Nova`, accept the defaults, and it scans the repo:
137
+
138
+ ```
139
+ Scanned project:
140
+ Name: demo-app
141
+ Stack: Node.js (react, next)
142
+ Git: yes
143
+ Scripts: dev, build, test
144
+
145
+ ✔ Does this look right? Yes
146
+ ✔ Which editor(s) do you use? Antigravity, Claude Code
147
+ ```
148
+
149
+ It writes the files and stops. Nothing else happens yet.
150
+
151
+ ### 2. What it wrote about your project
152
+
153
+ `.kracked/project.md` — drafted from the scan, not invented:
154
+
155
+ ```markdown
156
+ # Project — demo-app
157
+
158
+ ## Overview
159
+ - **Name:** demo-app
160
+ - **Stack:** Node.js (react, next)
161
+ - **Created:** 2026-07-26
162
+
163
+ ## Conventions
164
+ - _(not set yet)_
165
+
166
+ ## How to run it
167
+ - `dev` — `npm run dev`
168
+ - `build` — `npm run build`
169
+ - `test` — `npm run test`
170
+ ```
171
+
172
+ The `_(not set yet)_` lines are honest placeholders — it detected your scripts but it does **not** guess your conventions. Fill those in yourself, or let the agent learn them and write them during a wrap.
173
+
174
+ ### 3. Boot
175
+
176
+ Restart your editor, then:
177
+
178
+ ```
179
+ /kracked-boot
180
+ ```
181
+
182
+ > I'm Nova. No previous session recorded for demo-app — this is a fresh install. Next: nothing tracked yet. Global memory has no lessons yet.
183
+
184
+ Honest, because there genuinely is nothing yet. It doesn't fabricate a history.
185
+
186
+ ### 4. Build something
187
+
188
+ ```
189
+ /kracked-sdd add email login
190
+ ```
191
+
192
+ The agent sizes the job first and says so out loud. For this one it writes a short spec (`what` / `why` / acceptance criteria / **out of scope** / edge cases), confirms it with you, then splits it into stories and puts them in the tracker:
193
+
194
+ ```markdown
195
+ | ID | Story | Status | Evidence |
196
+ |-----|------------------------------|-------------|----------|
197
+ | 1.1 | User can log in with email | in-progress | — |
198
+ | 1.2 | Password reset | backlog | — |
199
+ ```
200
+
201
+ Then it builds `1.1`, moving the row to `review` the moment the code is written — not at the end of the session.
202
+
203
+ ### 5. The evidence gate
204
+
205
+ The agent wants to mark `1.1` done. It can't, until it writes what it actually checked:
206
+
207
+ ```markdown
208
+ | 1.1 | User can log in with email | done | Logged in as test@demo.dev in browser, session cookie set. NOT verified: expired-token path, rate limiting. |
209
+ ```
210
+
211
+ That "NOT verified" half is the point. Green tests aren't evidence, and the gaps are where tomorrow's bug lives.
212
+
213
+ ### 6. Wrap
214
+
215
+ ```
216
+ /kracked-wrap
217
+ ```
218
+
219
+ Say during the session you corrected the agent — it used `fetch` when this repo standardises on a typed API client. That correction becomes permanent:
220
+
221
+ **`~/.kracked/lessons.md`** (the index, read every boot) gets exactly one line:
222
+
223
+ ```markdown
224
+ - Use the typed apiClient, never raw fetch — see archive 2026-07-26 apiClient
225
+ ```
226
+
227
+ **`~/.kracked/lessons-archive.md`** (opened only when relevant) gets the full story: what happened, why it matters, how to avoid it.
228
+
229
+ And `.kracked/session.md` records where you stopped and what's next.
230
+
231
+ ### 7. Tomorrow
232
+
233
+ ```
234
+ /kracked-boot
235
+ ```
236
+
237
+ > I'm Nova. Last session: shipped email login (1.1), evidence recorded. Next: password reset (1.2). Caution: use the typed apiClient, never raw fetch.
238
+
239
+ You didn't re-explain anything. That's the entire pitch.
240
+
241
+ ## How memory works
242
+
243
+ Two layers, and the split between them is the whole idea.
77
244
 
78
245
  ```
79
246
  ~/.kracked/ GLOBAL — survives every project
@@ -110,21 +277,31 @@ Getting this wrong is the #1 failure mode. Put "we use Tailwind in this repo" in
110
277
 
111
278
  `lessons.md` is read on **every single boot**. If it grew forever, boot would get slower forever — and Antigravity caps rules files at 12,000 characters, so eventually it would simply break.
112
279
 
113
- So: the full lesson goes into `lessons-archive.md`, and **one line** goes into `lessons.md`. The index stays small. The archive grows without cost, and gets opened only when a specific lesson is actually relevant.
280
+ So: the full lesson goes into `lessons-archive.md`, and **one line** goes into `lessons.md`. The index stays small. The archive grows without cost, and gets opened only when a specific lesson is actually relevant to what you're doing right now.
114
281
 
115
282
  Your boot payload stays flat no matter how much your agent learns. That's the trick.
116
283
 
284
+ ### What boot actually does
285
+
286
+ `/kracked-boot` reads files in a fixed order — identity, then preferences, then the lessons index, then the project's stack, session, and decisions. Each file individually, never skimmed as a batch.
287
+
288
+ It works with only one layer present. Global memory but no project here? It boots and says so. Neither installed? It tells you to run `init` rather than pretending. **It never invents identity, preferences, or history it hasn't read** — missing is reported as missing.
289
+
117
290
  ## The build flow
118
291
 
119
- `/kracked-sdd` doesn't force ceremony on everything. It sizes the job first:
292
+ `/kracked-sdd` doesn't force ceremony on everything. It sizes the job first and states the call out loud:
120
293
 
121
294
  | Job | What happens |
122
295
  |---|---|
123
- | Fix a typo | Skips straight to the fix. No spec. |
124
- | Small, clear feature | Light spec → build → review |
125
- | Big or risky | Full flow: ideaspec → stories → build → review |
296
+ | **Trivial** typo, one-liner, config tweak | Straight to the fix. No spec, no tracker row. |
297
+ | **Small** — one clear feature | Light spec → build → review |
298
+ | **Large or risky** — multiple areas, unclear scope, data/auth/payments | Full flow: specarchitecture + ADRs → stories → build → review |
299
+
300
+ Over-ceremony on a small task is a failure mode, not thoroughness. It will not write a spec file for a typo.
126
301
 
127
- Then it tracks the work:
302
+ Then it tracks the work. Four statuses, no others:
303
+
304
+ `backlog` → `in-progress` → `review` → `done`
128
305
 
129
306
  | ID | Story | Status | Evidence |
130
307
  |---|---|---|---|
@@ -132,9 +309,51 @@ Then it tracks the work:
132
309
  | 1.2 | Password reset | in-progress | — |
133
310
  | 1.3 | Remember me | backlog | — |
134
311
 
135
- **A story cannot move to `done` without evidence.** Not "the tests pass" what did you actually verify, and what did you *not*? Green tests are not a working feature. This one rule catches more bugs than any other part of the system.
312
+ The tracker updates **the moment** a status changes never batched to the end of a session, because a stale ledger is worse than none.
313
+
314
+ ### The evidence gate
315
+
316
+ **A story cannot move to `done` without a note stating what was verified and what was not.**
317
+
318
+ Not "the tests pass" — what did you actually run, what did you see, and what did you skip? Green tests are not a working feature; a test can pass while testing the wrong thing.
319
+
320
+ A story marked `done` with no evidence is worse than one left at `review`, because it hides risk instead of surfacing it. This one rule catches more bugs than any other part of the system.
321
+
322
+ ## What gets written to disk
323
+
324
+ A real install into a Next.js project, choosing Antigravity + Claude Code:
325
+
326
+ ```
327
+ demo-app/
328
+ ├── AGENTS.md ← canonical instructions
329
+ ├── CLAUDE.md ← one-line shim: @AGENTS.md
330
+ ├── .kracked/ ← your project memory
331
+ │ ├── project.md
332
+ │ ├── session.md
333
+ │ ├── decisions.md
334
+ │ ├── .version
335
+ │ └── sdd/
336
+ │ ├── tracker.md
337
+ │ ├── README.md
338
+ │ ├── specs/_TEMPLATE.md
339
+ │ ├── epics/_TEMPLATE.md
340
+ │ ├── stories/_TEMPLATE.md
341
+ │ └── architecture/_TEMPLATE.md
342
+ │ └── decisions/_TEMPLATE.md
343
+ ├── .agents/ ← Antigravity / Kilo / Roo
344
+ │ ├── rules/kracked.md
345
+ │ └── skills/kracked-{boot,sdd,wrap,identity,explain}/SKILL.md
346
+ └── .claude/ ← Claude Code
347
+ └── skills/kracked-{boot,sdd,wrap,identity,explain}/SKILL.md
348
+ ```
136
349
 
137
- ## Terminal commands
350
+ Plus global memory at `~/.kracked/` (identity, preferences, lessons, archive, projects).
351
+
352
+ **`AGENTS.md` is canonical; `CLAUDE.md` is a one-line shim that imports it.** Most editors read `AGENTS.md` natively — Claude Code is the exception, it only reads `CLAUDE.md`. Writing the instructions once and shimming means the two can't drift apart, which is the exact bug this package exists to prevent.
353
+
354
+ Install is **non-destructive**. Existing files are never silently overwritten — you get skip / overwrite / write-alongside per file, and it refuses to touch a `CLAUDE.md` or `AGENTS.md` another tool wrote.
355
+
356
+ ## Command reference
138
357
 
139
358
  ```bash
140
359
  npx kracked-core init # set up memory in this project
@@ -143,18 +362,18 @@ npx kracked-core update # refresh skills + loaders, keep your memory
143
362
  npx kracked-core uninstall # remove it (asks before deleting anything)
144
363
  ```
145
364
 
146
- ## Am I on the latest version?
365
+ ### Am I on the latest version?
147
366
 
148
367
  ```bash
149
368
  npx kracked-core@latest status
150
369
  ```
151
370
 
152
- Shows the version that installed your files, the latest on npm, and tells you plainly whether
153
- you need to update:
154
-
155
371
  ```
156
- This project ~/code/my-app
157
- installed version: 1.4.0
372
+ kracked-core status
373
+
374
+ This project ~/code/demo-app
375
+ installed version: 1.6.1
376
+ .claude/skills: 5/5 skills
158
377
  .agents/skills: 5/5 skills
159
378
 
160
379
  Global memory ~/.kracked
@@ -162,52 +381,72 @@ Global memory ~/.kracked
162
381
  lessons learned: 12
163
382
 
164
383
  Version
165
- running now: 1.5.0
166
- latest on npm: 1.5.0
384
+ running now: 1.6.1
385
+ latest on npm: 1.6.1
167
386
 
168
387
  Up to date.
169
388
  ```
170
389
 
171
390
  > The `@latest` matters — plain `npx kracked-core` can serve a cached older copy.
172
391
 
173
- ## Updating
174
-
175
- When a new version ships:
392
+ ### Updating
176
393
 
177
394
  ```bash
178
395
  npx kracked-core@latest update
179
396
  ```
180
397
 
181
- Refreshes the skills and loaders. **Your memory is never touched** — identity, preferences,
182
- lessons, and everything under `.kracked/` stay exactly as they are. It keeps your agent's name too.
398
+ Refreshes the skills and loaders. **Your memory is never touched** — identity, preferences, lessons, and everything under `.kracked/` stay exactly as they are. It keeps your agent's name too.
183
399
 
184
400
  Restart your editor afterwards so it picks up the new skills.
185
401
 
186
- ## Uninstalling
402
+ ### Uninstalling
187
403
 
188
404
  ```bash
189
405
  npx kracked-core uninstall
190
406
  ```
191
407
 
192
- Shows what it will remove and asks before deleting — project files and global memory are separate
193
- questions. It never touches a `CLAUDE.md` or `AGENTS.md` another tool wrote.
408
+ Shows what it will remove and asks before deleting — project files and global memory are separate questions. It never touches a `CLAUDE.md` or `AGENTS.md` another tool wrote.
194
409
 
195
410
  Full guide, including manual removal and how to keep your docs: [docs/UNINSTALL.md](https://github.com/Krackeddevs-Org/kracked-core/blob/main/docs/UNINSTALL.md)
196
411
 
412
+ ## Editor support
413
+
414
+ | Editor | Memory | `/kracked-*` commands | Files written |
415
+ |---|:---:|:---:|---|
416
+ | **Antigravity** | ✅ | ✅ | `AGENTS.md`, `.agents/rules/`, `.agents/skills/` |
417
+ | **Claude Code** | ✅ | ✅ | `CLAUDE.md` shim, `.claude/skills/` |
418
+ | **Kilo Code** (VS Code) | ✅ | ✅ | `AGENTS.md`, `.agents/`, `kilo.jsonc` entry |
419
+ | **Roo Code** (VS Code) | ✅ | ✅ | `AGENTS.md`, `.agents/`, `.roo/rules/` |
420
+ | Cursor, Windsurf, others | ✅ | — | `AGENTS.md` |
421
+
422
+ **Memory only** means your agent still loads everything on boot — but the slash commands aren't installed, because those editors use a different skill format. You can run the same flow by asking in plain language ("load your memory and tell me where we left off").
423
+
197
424
  ## FAQ
198
425
 
199
426
  **Does this send my code anywhere?**
200
- No. Everything is local markdown files. There's no service, no telemetry, no account.
427
+ No. Everything is local markdown files. There's no service, no telemetry, no account, and the package has zero dependencies.
428
+
429
+ **Do I have to use the slash commands?**
430
+ Boot and wrap are what make it work. The SDD flow is optional — plenty of people use this purely for memory.
201
431
 
202
432
  **Should I commit `.kracked/` to git?**
203
433
  Yes, mostly. Project memory is useful to your teammates. Add `.kracked/session.md` to `.gitignore` if you don't want your working state shared.
204
434
 
435
+ **What about `~/.kracked/`?**
436
+ That's yours alone — it lives in your home folder and never gets committed anywhere.
437
+
205
438
  **My editor isn't listed. Will it work?**
206
439
  If it reads `AGENTS.md`, yes. That's most of them now. Claude Code is the exception — it reads `CLAUDE.md`, so we write a one-line shim that imports `AGENTS.md`.
207
440
 
208
441
  **Can I edit the memory files by hand?**
209
442
  Please do. They're yours. Correcting your agent's memory directly is faster than arguing with it.
210
443
 
444
+ **Will it overwrite my existing `AGENTS.md`?**
445
+ No. It detects another agent system and asks before touching anything, per file.
446
+
447
+ **I ran init but the commands don't appear.**
448
+ Restart your editor. Skills load at startup.
449
+
211
450
  **How is this different from just writing a good prompt?**
212
451
  A prompt lasts one session. This lasts across all of them, and it compounds — every mistake you correct is a mistake you never see again.
213
452
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kracked-core",
3
- "version": "1.5.1",
3
+ "version": "1.6.2",
4
4
  "description": "Zero-dependency memory & workflow installer for AI coding agents — global identity, project memory, and skills that survive session restarts.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/scaffold.mjs CHANGED
@@ -80,6 +80,85 @@ async function writeFileWithConflictCheck(destPath, content, ask, report) {
80
80
  * 'skip' | 'overwrite' | 'alongside'.
81
81
  * `report(entry)` is called once per file, for the wizard's final summary.
82
82
  */
83
+ /**
84
+ * Drop the illustrative example entries from a freshly-written memory file.
85
+ * They exist to show the format, but left in place they sit alongside the
86
+ * user's real lessons forever and make the index untrustworthy.
87
+ *
88
+ * Two things this has to get right, both learned the hard way:
89
+ *
90
+ * 1. Fenced blocks are FORMAT DOCUMENTATION, not examples. The placeholder
91
+ * line inside a ``` fence (`- [YYYY-MM-DD] <project> — ...`) teaches the
92
+ * shape and must survive; stripping it left an empty fence behind.
93
+ * 2. An example is not always a list row. The archive's entries are `##`
94
+ * headings followed by prose, so a line-shaped filter never saw them and
95
+ * a fictional todo-app lesson shipped into real memory.
96
+ */
97
+ function stripExamples(content) {
98
+ const lines = content.split('\n');
99
+ const out = [];
100
+ let inFence = false;
101
+ let skippingEntry = false;
102
+
103
+ // Match the SHIPPED examples by their exact date+project pair, never by
104
+ // project name alone. A user whose repo is genuinely called todo-app or
105
+ // my-blog must keep every real lesson they write about it — a name-shaped
106
+ // filter would silently delete their memory.
107
+ const SHIPPED = [
108
+ /^\[?2026-01-15\]?\s*todo-app\s*—/,
109
+ /^\[?2026-02-03\]?\s*my-blog\s*—/,
110
+ ];
111
+ const isShipped = (text) => SHIPPED.some((re) => re.test(text.trim()));
112
+
113
+ const isExampleLine = (line) => {
114
+ const m = line.match(/^[-*]\s*(.+)$/);
115
+ if (m) return isShipped(m[1]);
116
+ const cell = line.match(/^\|\s*(todo-app|my-blog)\s*\|/);
117
+ return Boolean(cell);
118
+ };
119
+
120
+ // An archive entry is a `## [date] project — title` heading; it owns every
121
+ // line until the next heading.
122
+ const isExampleHeading = (line) => {
123
+ const m = line.match(/^#{2,3}\s+(.+)$/);
124
+ return Boolean(m) && isShipped(m[1]);
125
+ };
126
+
127
+ for (const line of lines) {
128
+ if (/^```/.test(line)) {
129
+ inFence = !inFence;
130
+ skippingEntry = false;
131
+ out.push(line);
132
+ continue;
133
+ }
134
+
135
+ // Inside a fence everything is documentation — never strip.
136
+ if (inFence) {
137
+ out.push(line);
138
+ continue;
139
+ }
140
+
141
+ if (isExampleHeading(line)) {
142
+ skippingEntry = true;
143
+ continue;
144
+ }
145
+
146
+ // A new heading ends the example entry we were dropping.
147
+ if (skippingEntry) {
148
+ if (/^#{1,6}\s/.test(line)) skippingEntry = false;
149
+ else continue;
150
+ }
151
+
152
+ if (isExampleLine(line)) continue;
153
+
154
+ out.push(line);
155
+ }
156
+
157
+ // Collapse the run of blank lines a removed block leaves behind, and keep
158
+ // exactly one trailing newline.
159
+ return `${out.join('\n').replace(/\n{3,}/g, '\n\n').replace(/\s+$/, '')}\n`;
160
+ }
161
+
83
162
  export async function writeGlobalMemory({ tokens, ask, report }) {
84
163
  const globalDir = path.join(os.homedir(), '.kracked');
85
164
  // projects.md is excluded here — it's a running registry appended to by
@@ -88,7 +167,7 @@ export async function writeGlobalMemory({ tokens, ask, report }) {
88
167
 
89
168
  for (const file of files) {
90
169
  const destPath = path.join(globalDir, file);
91
- const content = applyTokens(readTemplate(`global/${file}`), tokens);
170
+ const content = stripExamples(applyTokens(readTemplate(`global/${file}`), tokens));
92
171
  await writeFileWithConflictCheck(destPath, content, ask, report);
93
172
  }
94
173
  }
@@ -124,10 +203,13 @@ export function registerProject({ tokens }) {
124
203
  const lines = content.split('\n');
125
204
  const isDivider = (l) => /^\|[\s|:-]+\|?\s*$/.test(l);
126
205
 
127
- // Find the table's divider row (|---|---|), then insert after the last data
128
- // row that follows it. Anchoring on the divider matters: without it, a table
129
- // whose only row is the header inserts ABOVE the divider and breaks the table.
130
- const dividerIdx = lines.findIndex(isDivider);
206
+ // Anchor on the Registry heading first a table-looking line elsewhere in the
207
+ // doc (an example, a fenced snippet) would otherwise capture the insert and
208
+ // produce a second, malformed table.
209
+ const registryIdx = lines.findIndex((l) => /^##\s+Registry\s*$/i.test(l));
210
+ const searchFrom = registryIdx >= 0 ? registryIdx : 0;
211
+ const rel = lines.slice(searchFrom).findIndex(isDivider);
212
+ const dividerIdx = rel >= 0 ? searchFrom + rel : -1;
131
213
 
132
214
  if (dividerIdx >= 0) {
133
215
  let insertAt = dividerIdx;
package/src/wizard.mjs CHANGED
@@ -196,6 +196,7 @@ async function wizardFlow() {
196
196
  let projectMode = null; // 'new' | 'existing'
197
197
  let stackLine = 'unknown — not auto-detected';
198
198
  let projectSummary = null;
199
+ let projectPitch = '';
199
200
 
200
201
  if (setUpProject) {
201
202
  const pathAnswer = await input('Project directory?', '.');
@@ -250,6 +251,24 @@ async function wizardFlow() {
250
251
  classification === 'existing' ? 0 : 1
251
252
  );
252
253
 
254
+ if (projectMode === 'new') {
255
+ // Nothing to scan, so ask instead — otherwise the agent boots knowing
256
+ // nothing about what's being built, which is the problem this package
257
+ // exists to solve. Both skippable with Enter.
258
+ stdout.write('\n Two quick questions so your agent knows what it\'s working on.\n');
259
+ stdout.write(` ${c_dim('Press Enter to skip either one.')}\n\n`);
260
+
261
+ projectPitch = sanitizeScanned(
262
+ await input('What are you building? (one line)', ''),
263
+ 200
264
+ );
265
+ const statedStack = sanitizeScanned(
266
+ await input('What stack? (e.g. Next.js + Supabase)', ''),
267
+ 80
268
+ );
269
+ if (statedStack) stackLine = statedStack;
270
+ }
271
+
253
272
  if (projectMode === 'existing') {
254
273
  if (!fs.existsSync(projectDir)) {
255
274
  stdout.write(`\n ${projectDir} doesn't exist yet — nothing to scan. Treating as new.\n`);
@@ -333,6 +352,9 @@ async function wizardFlow() {
333
352
  DATE: isoDate(),
334
353
  STACK: stackLine,
335
354
  RUN_COMMANDS: runCommandsBlock(projectSummary),
355
+ PITCH: projectPitch
356
+ ? projectPitch
357
+ : '_(Add a sentence or two here on what this project actually does.)_',
336
358
  };
337
359
 
338
360
  stdout.write('\nWriting files...\n');
@@ -4,13 +4,7 @@ Registry of every project {{USER_NAME}} is working on. Each row points to the pr
4
4
  `.kracked/` folder, where the real detail (stack, conventions, session state) lives. This file
5
5
  only tracks what exists and where — never project-specific truth.
6
6
 
7
- ## Format
8
-
9
- ```
10
- | Project | Path | Stack | Status |
11
- ```
12
-
13
- - **Status** is one of: `active`, `paused`, `done`.
7
+ **Status** is one of: `active`, `paused`, `done`.
14
8
 
15
9
  ## Registry
16
10
 
@@ -11,7 +11,7 @@ here.
11
11
  - **Stack:** {{STACK}}
12
12
  - **Created:** {{DATE}}
13
13
 
14
- _(Add a sentence or two here on what this project actually does, once there's something to say.)_
14
+ {{PITCH}}
15
15
 
16
16
  ## Conventions
17
17