Skip to content

Port unmerged fixes to new main#25

Merged
benslockedin merged 19 commits intomainfrom
will/port-unmerged-fixes
Mar 27, 2026
Merged

Port unmerged fixes to new main#25
benslockedin merged 19 commits intomainfrom
will/port-unmerged-fixes

Conversation

@willsupernormal
Copy link
Collaborator

Summary

Ports functional fixes from 3 old branches that referenced dead plugins/alive/ paths. Rebasing wasn't viable (86-file monorepo restructure = too many conflicts), so these are fresh commits re-applying the functional changes to plugins/walnut/ paths.

Depends on: PR #23 (rename sweep) — merge that first, then rebase this on top.

Source branches

  • will/skill-routing-improvements — skill description + CLAUDE.md routing fixes
  • will/world-skill-index-and-post-save-hook — world skill reads injected index, post-write hook auto-regenerates index
  • will/statusline-and-stash-fixes — statusline absolute path, stash saves:0 gate, archive enforcer rewrite, context-watch thresholds

What changed (9 commits, 14 files)

Commit 1: Archive Enforcer (CRITICAL)

File: walnut-archive-enforcer.sh

  • Replaced broken macOS BSD sed with python3 shlex for path extraction (\b and \s silently fail on BSD sed)
  • Changed from hard deny to rename-to-"(Marked for Deletion)" + open Finder — lets the user review and manually delete if intended
  • Multi-target support — processes ALL targets in a command, not just the first
  • Handles: quoted paths, spaces in filenames, flags, chained commands (&&, ;, |)

Commit 2: Context Watch (CRITICAL)

File: walnut-context-watch.sh

  • New primary job: context % re-injection at 20/40/60/80% thresholds
    • Reads context % from .walnut/.context_pct (written by statusline on every render)
    • Fires highest unfired threshold, marks all lower ones (prevents double-firing)
    • ≤40%: condensed refresh (core behaviours only)
    • 60%+: full refresh (re-reads .walnut/key.md + .walnut/_index.yaml)
  • Active squirrel stash cross-pollination — shows other sessions' unsaved stash items
    • Filters by: different session, ended: null, saves: 0 (genuinely unsaved)
  • Self-save false alert fix: checks both full UUID and 8-char prefix against now.md squirrel field

Commit 3: Session New — Statusline Injection (HIGH)

File: walnut-session-new.sh

  • Injects statusLine into .claude/settings.json with absolute path
  • Self-heal: corrects stale relative paths on every session start
  • Covers: fresh install (no settings.json), missing statusLine key, wrong path, malformed JSON

Commit 4: Session Resume + Compact — Stash Gate (HIGH)

Files: walnut-session-resume.sh, walnut-session-compact.sh

  • Added saves: 0 gate on stash extraction — entries with saves > 0 have already routed their stash
  • Prevents false "previous session had stash" messages on resume/compact
  • Resume also gets the same statusline self-heal block as session-new

Commit 5: Statusline (HIGH)

File: walnut-statusline.sh

  • Null cost crash guard: d.get('cost') or {} instead of d.get('cost', {}) — handles JSON null
  • Writes context % to .walnut/.context_pct for context-watch threshold injection

Commit 6: Squirrels Rule (HIGH)

File: rules/squirrels.md

  • Instinct rename plugin: contextsystem → alive-context #10: Load on First Walnut Mention — auto-invoke walnut:load when a walnut is mentioned by name (not just explicit "load X")
  • Instinct revert plugin folder to alive/ — name must match folder #11: Trust the Context Window — never suggest ending a session based on context pressure. Compaction is automatic and handled by the threshold injection system.
  • Made model-agnostic — removed "You have up to 1M tokens" claim. The system is portable across models.
  • Save guard: removed "context is compacting" as a save trigger (now handled by threshold injection)
  • Unsigned entry recovery: requires saves: 0 to match the hook implementations

Commit 7: World Skill + Post-Write Hook + Create Skill (HIGH + MEDIUM)

Files: world/SKILL.md, walnut-post-write.sh, create/SKILL.md

  • World skill reads <WORLD_INDEX> from session context first (zero file reads) — fallback chain: injected index → .walnut/_index.yamlgenerate-index.py → manual scan
  • Post-write hook: detects _core/now.md writes (only written by save), regenerates world index in background with 5-minute debounce
  • Create skill: Step 10 — update .walnut/key.md Connections when creating a new walnut

Commit 8: Skill Descriptions + CLAUDE.md (MEDIUM + LOW)

Files: load/SKILL.md, history/SKILL.md, CLAUDE.md, hooks.json

  • Load skill: broadened description to match natural walnut mentions ("what's happening with berties")
  • History skill: added "revive" to description for heavy revive routing
  • CLAUDE.md: added /walnut:capsule to skill list (Twelve → Thirteen Skills), fixed numbering (9 → 8)
  • hooks.json: description count 13 → 14

Commit 9: Review fixes (LOW)

Files: walnut-post-write.sh, world/setup.md

  • Post-write hook: cross-platform stat guard (GNU/BSD sniff) matching context-watch pattern — prevents debounce failure on Linux
  • Setup.md: "No ALIVE folders exist" → "No .walnut/ folder exists" to match runtime behaviour

Review approach

The capsule at 04_Ventures/alive-os/_core/_capsules/branch-port-review/companion.md has full review instructions, but the quick version:

cd ~/Desktop/alive-plugin

# See just the port changes (beyond the rename sweep)
git diff will/rename-sweep-clean...will/port-unmerged-fixes

# Commit log for port branch
git log --oneline will/port-unmerged-fixes --not will/rename-sweep-clean

Verification

  • TypeScript build: exit 0
  • deploy.sh dry-run: exit 0
  • 13/13 hook scripts present
  • 14/14 skills with valid SKILL.md
  • No stale plugins/alive path references
  • No 1M token model-specific claims in rules/skills
  • saves:0 gate consistent across resume, compact, and context-watch
  • Cross-platform stat guard consistent across context-watch and post-write

Known gap (pre-existing, not introduced by this PR)

walnut-session-resume.sh doesn't inject the world key or <WORLD_INDEX> — session-new does. This means the world skill's "read injected index first" strategy falls through to file reads on resumed sessions. Not blocking for this PR but worth addressing separately.

Test plan

  • Deploy to local cache + marketplace via ./deploy.sh
  • Fresh session: verify statusline injection creates/updates settings.json
  • Resume session: verify stash gate — saved sessions don't show stale stash
  • Archive enforcer: try rm on a World file — should rename to "(Marked for Deletion)" and open Finder
  • Context watch: let context grow past 20% — verify threshold injection fires
  • World skill: verify it reads <WORLD_INDEX> from context (no file reads on first call)

🐿️ Generated with Claude Code

willsupernormal and others added 19 commits March 27, 2026 13:15
… index injection

- setup.ts: scaffold .walnut/ not .alive/ for new users
- index.ts: walnut_create puts _capsules/ inside _core/ not walnut root
- index.ts: walnut_capture success message includes _core/ prefix
- session-new.sh: read world index from .walnut/_index.yaml not .alive/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ect cache path

- log-guardian: match both squirrel: and walnut-mcp: signature formats
- rules-guardian: cache path updated from alivecomputer to stackwalnuts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Cache path: stackwalnuts/walnut/1.0.0
- Marketplace path: stackwalnuts/plugins/walnut
- Gracefully skip missing directories instead of erroring

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tackwalnuts

- Issue template: discussions URL → stackwalnuts/walnut
- Feature request: alive:save → walnut:save
- Funding: alivecomputer.com → walnut.world
- PR template: ALIVE session → walnut session

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ted to walnut

- CLAUDE.md: # ALIVE → # Walnut
- setup.md: "installed alive" → "installed Walnut"
- extend skill: contributor@alivecomputer → contributor@stackwalnuts (3 places)
- history skill: alivecomputer.com → walnut.world in demo output
- Hermes skill: "Load ALIVE walnut" → "Load walnut" in description

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…amework name

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…onfig templates

- git mv templates/alive → templates/world
- squirrels.md: template path reference updated
- setup.md: 3 template path references updated
- world/key.md: example repo URL → stackwalnuts/walnut

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- PLUGIN_DIR: plugins/alive → plugins/walnut
- Label: ALIVE → Walnut
- Template dirs: alive → world (matches directory rename)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The cherry-pick captured the reference updates but not the directory rename.
This commit completes the rename: templates/alive/ → templates/world/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…-target

- Replace broken macOS sed with python3 shlex for path extraction
- Rename files to "(Marked for Deletion)" instead of hard deny
- Process ALL targets, not just first match
- Distinct messages for renamed vs not-found targets
- Opens Finder at target directory for manual review

Ported from will/statusline-and-stash-fixes (commits 2211200, 6df7bc8, e65a7e9)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…, self-save fix

- Add context % re-injection at 20/40/60/80% thresholds
  - 40% and below: condensed refresh (core behaviours only)
  - 60%+: full refresh with world key and index
- Add active squirrel stash cross-pollination (saves:0 gate)
- Fix self-save false alert: check both full UUID and 8-char prefix
- Highest-first threshold firing (80→60→40→20) with mark-all-below

Ported from will/statusline-and-stash-fixes (commits 2211200, d3cf116)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… path

- Creates settings.json with statusLine if missing
- Self-heals existing settings.json: checks if statusLine.command
  matches expected absolute path, corrects if not
- Covers: fresh install, missing statusLine key, stale relative path

Ported from will/statusline-and-stash-fixes (commits 2211200, 6df7bc8, b9c27d8)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ne self-heal

- Resume: add statusline settings.json self-heal (absolute path, same as session-new)
- Resume + Compact: gate stash extraction on saves: 0 — entries with saves > 0
  have already routed their stash, so those items are historical records, not
  unfinished work. Prevents false "previous session had stash" messages.

Ported from will/statusline-and-stash-fixes (commits 6df7bc8, b9c27d8)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Guard against cost: null from Claude Code (was crashing on None.get())
- Write context % to .walnut/.context_pct for context-watch threshold injection

Ported from will/statusline-and-stash-fixes (commits 2211200, d3cf116)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s:0 recovery

- Instinct #10: Load on First Walnut Mention — auto-load when walnut
  mentioned by name, cross-reference if already loaded
- Instinct #11: Trust the Context Window — never suggest ending session
  based on token anxiety, compaction is not a crisis
  (made model-agnostic: removed "1M tokens" claim from original)
- Save guard: removed "context is compacting" as a save trigger
- Unsigned entry recovery: requires saves: 0 — entries with saves > 0
  have already routed their stash

Ported from will/skill-routing-improvements (164402c) and
will/statusline-and-stash-fixes (d75f88c, b9c27d8)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…reate updates key.md

- World skill: read <WORLD_INDEX> from session context first (zero file reads),
  fall back to .walnut/_index.yaml, then generate-index.py, then manual scan
- World skill: lightweight fresh checks via single Bash commands
- World skill: index freshness simplified — auto-regeneration by post-write hook
- Post-write hook: detect _core/now.md writes, regenerate index in background
  with 5-min debounce
- Create skill: Step 10 — update .walnut/key.md Connections when scaffolding

Ported from will/world-skill-index-and-post-save-hook (9aaf2dc, 5b2397c)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- load skill: broaden description to match natural walnut mentions
- history skill: add "revive" to description for heavy revive routing
- CLAUDE.md: add /walnut:capsule to skill list (Thirteen Skills)
- CLAUDE.md: fix read sequence numbering (7→9 → 7→8)
- hooks.json: description count 13→14

Ported from will/skill-routing-improvements (164402c) and 6df7bc8

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Post-write hook: use GNU/BSD stat sniff (matching context-watch pattern)
  instead of macOS-only stat -f%m. Prevents debounce failure on Linux.
- Setup.md: "No ALIVE folders" → "No .walnut/ folder" to match runtime.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@benslockedin benslockedin merged commit 848c710 into main Mar 27, 2026
1 check passed
benslockedin pushed a commit that referenced this pull request Mar 27, 2026
Brand: alive → Walnut. Org: alivecomputer → stackwalnuts.
Plugin name: walnut. Namespace: walnut:*. System folder: .alive/ → .walnut/

Skill renames (descriptive names):
- load → load-context, capture → capture-context
- find → search-world, create → create-walnut
- tidy → system-cleanup, tune → settings
- history → session-history, mine → mine-for-context
- map → my-context-graph, capsule → capsule-manager
- extend → build-extensions

New skills:
- session-context-rebuild — agent swarm to rebuild context from multiple sessions
- migrate-alive-to-v1 — auto-migration from alive to walnut

All skills carry full lineage in descriptions (prev. names).
Auto-migration in session-new hook: .alive/ → .walnut/ on first run.
Merged Will's port-unmerged-fixes (PR #25).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants