<feed xmlns='http://www.w3.org/2005/Atom'>
<title>newos4/modules/test/test-memory-graph-recovery.js, branch main</title>
<subtitle>newOS4 - the browser terminal that runs WebX11 user spaces</subtitle>
<id>https://newos.webx11.duckdns.org/newos4/atom?h=main</id>
<link rel='self' href='https://newos.webx11.duckdns.org/newos4/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/'/>
<updated>2026-10-27T13:59:06+00:00</updated>
<entry>
<title>fix(newos4): bound one turn's tool context, honest skill-create, quarantine a corrupt memory graph</title>
<updated>2026-10-27T13:59:06+00:00</updated>
<author>
<name>Agando</name>
<email>roduccomm@gmail.com</email>
</author>
<published>2026-10-27T13:59:06+00:00</published>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/commit/?id=7c0b308358d1721ad687b37dd0348c072d1d2ada'/>
<id>urn:sha1:7c0b308358d1721ad687b37dd0348c072d1d2ada</id>
<content type='text'>
The three items the last review and probes left open, each with a test that is red on HEAD.

- MAINT-023 (module-aiassist.js): one agentic turn grew without limit — every role:'tool' body
  was pushed verbatim and only this.context was trimmed BETWEEN turns (measured 6 -&gt; 112 705
  tokens across 8 model calls against maxContextTokens 12 000). Observations are now clipped to
  maxToolResultChars (6 000) with a note saying how much was withheld and to re-read with
  offset/limit, and _boundToolContext() elides the oldest tool bodies once the running total
  passes toolContextBudgetChars (24 000), always keeping the newest 4 verbatim. The ceiling is
  turn-independent: the same ~26 k chars at 8 turns and at 20.
- MAINT-024 (modules/ext/skill-pack-core.js): the command printed "✅ Skill created" with
  fs.writeFile()'s boolean discarded (probe: fresh VFS, success printed, no file), stripped
  invalid characters instead of rejecting the name (My-Skill -&gt; y-kill, DevOps_Thing -&gt;
  evpshing), and treated an unreadable /path argument as the skill body. Now: kebab-case is
  validated (uppercase normalises and the final name is reported; anything else is refused),
  /skills is created on first use, the write and index results are checked, and an unreadable
  body path is an error.
- MAINT-003 (module-memory-graph.js): a corrupt store looked exactly like a fresh install —
  fsReadJSON returns null on a parse failure, so 85 nodes could vanish with no warning and no
  copy. The probe confirmed the loss: seed 6 nodes, truncate nodes.json and export.json, reload
  -&gt; 1 node, no message, nothing in .trash. _quarantineCorrupt() now keeps the unreadable file
  as &lt;name&gt;.corrupt, warns, and then loads from whatever remains.

Tests: test-tool-context-bound.js (11), test-skill-create.js (16), test-memory-graph-recovery.js
(8). RED on HEAD: tool-context crashes on _clipToolResult (exit 1), skill-create 16 assertions
fail on the missing file/index, memory-graph B1/B2/C1 fail (no warning, no .corrupt copy).
Suite now 13/13 files green; maintain --fix reports "node tests 13/13 pass".
Live on v4.6.107: skill-create My-Skill -&gt; ✅ "my-skill"; DevOps_Thing -&gt; Invalid skill name;
/does/not/exist.md -&gt; Cannot read skill body; only my-skill in the index.
</content>
</entry>
</feed>
