Skip to content

fix: rebuild context graph for v3#31

Merged
benslockedin merged 2 commits intomainfrom
fix/context-graph-v3
Apr 10, 2026
Merged

fix: rebuild context graph for v3#31
benslockedin merged 2 commits intomainfrom
fix/context-graph-v3

Conversation

@benslockedin
Copy link
Copy Markdown
Contributor

Summary

  • Index script (generate-index.py) was v2 — looking for _core/ instead of _kernel/, reading now.json as markdown, scanning for _capsules/ instead of bundles. Every user got broken graph output with 0 bundles detected and ghost _kernel nodes.
  • Graph script (generate-graph.py) used circle packing, which is wrong for a network with hierarchy. Replaced with force-directed + domain cluster gravity, based on Obsidian graph view research.

What changed

Index fixes

  • Recognize _kernel/ as walnut parent dir (v3 structure)
  • Read now.json as JSON (was parsing as markdown frontmatter)
  • Detect bundles via context.manifest.yaml (was scanning _capsules/)
  • Infer parent-child from filesystem hierarchy (nested walnuts auto-link)
  • Bidirectional people-walnut links (person walnut links: → walnut people:)
  • Strip [[wikilinks]] on read — handles YAML parse issue at consumer level
  • Enrich with now.json: task counts, bundle summaries, blockers, session data

Graph rebuild

  • Force-directed with domain cluster gravity (Life/Ventures/Experiments/People/Archive)
  • Health indicators (green/amber/red border based on rhythm vs last update)
  • Detail panel on click (goal, next action, tasks, bundles, people, connections)
  • Neighborhood highlighting on hover (dim everything else)
  • Task urgency dots + blocker flags directly on nodes
  • Semantic zoom, search, dark mode, people toggle, archive toggle

Test plan

  • Run python3 .alive/scripts/generate-index.py — verify walnuts detected, bundles > 0
  • Run python3 .alive/scripts/generate-graph.py — verify HTML generated
  • Open graph — verify domain clusters, click nodes for detail panel
  • Test with v2 world (has _core/, _capsules/) — verify backward compat
  • Test [[wikilink]] in linked_bundles: field — verify no YAML parse error
  • Test on Windows with py -3 fallback

🤖 Generated with Claude Code

@patrickSupernormal
Copy link
Copy Markdown
Collaborator

Merge safety review (advisory) — Patrick Brosnan, non-collaborator on alivecontext/alive. Comment weight only, not an approving review.

Verdict: YELLOW — R-1 silent regression, must fix before merge. Blocked on PR #29 landing.

Headline: The visual redesign is a strict improvement — the Obsidian-style force-directed graph with domain gravity wells, neighborhood highlighting, semantic zoom, and the click-to-pin detail panel all read cleanly. Health-ring computation matches plugins/alive/rules/world.md exactly. No bugs in the graph script itself. But the generate-index.py rewrite has one silent behavioural regression and several smaller cleanup items.

R-1 (CRITICAL): top-level recent_sessions: and unsigned_with_stash: removed from _index.yaml and _index.json.

The OLD code computed a world-level recent_sessions list by walking .alive/_squirrels/*.yaml (mtime-sorted, top 10) plus an unsigned_with_stash counter. The NEW code deletes both and replaces them with a PER-WALNUT session_count and last_session derived from that walnut's own now.json.recent_sessions — useful enrichment, but it lives on individual walnut entries, not at the top level.

Verified downstream breakage via GitHub code search on alivecontext/alive@main: plugins/alive/skills/world/SKILL.md (SHA e6e14b9) lines 21, 67, 198 explicitly document "Unsigned squirrels with stash: already in the index as unsigned_with_stash:" and "recent sessions are in the index under recent_sessions: and unsigned stash count is in unsigned_with_stash:. DO NOT read .alive/_squirrels/.yaml files"*. After #31 merges, those two fields will be absent. The /alive:world dashboard — the most-invoked skill in the system — either silently renders without the session pulse / attention section, or crashes on a missing-field read.

Fix path: Restore both computations verbatim in generate-index.py before the YAML/JSON write (the old code in the diff is the correct implementation — removal looks accidental, the PR body doesn't mention it). Keep the new per-walnut enrichment. Both can coexist — they answer different questions.

Also worth fixing:

  • R-2: Graph loses the "world root" centrepiece node and the "inputs" buffer node. Either restore as pinned-centre "special: true" nodes, OR update docs/skills to no longer reference them.
  • R-3 to R-7: Stats header drops inputs/sessions; display label "bundles" vs underlying key capsules mismatch; dead 3-nested-loop code in bidirectional-links; exception handler in now.json reader breaks out of the candidate loop on JSONDecodeError (stopping fall-through to v2 path); module docstring downgraded from "v3" back to "v2" (looks like a merge accident).

Merge order: Position 5 of 5 (last), immediately after #29. Base SHA de8d602 verified identical to PR #29 HEAD SHA — #31 has fully absorbed #29's tip, zero textual conflict on either file, but GitHub won't let #31 merge to main before #29 because baseRefName: v3-projection-redesign only exists on the #29 side. Cannot merge before #29.

Before merging, run python3 .alive/scripts/generate-index.py locally and grep -c 'recent_sessions\|unsigned_with_stash' .alive/_index.yaml — if the count is zero, R-1 is unfixed.

Full cross-PR synthesis (conflict matrix, recommended merge order for all 7 open PRs, per-PR verdicts, blocker list): see the cover comment on #29#29 (comment)

Generated via flow-next epic fn-8-vly (stackwalnuts walnut). 🐿️

@benslockedin benslockedin force-pushed the v3-projection-redesign branch from de8d602 to a76b6d5 Compare April 10, 2026 14:21
@benslockedin benslockedin changed the base branch from v3-projection-redesign to main April 10, 2026 14:58
supernormalsystems and others added 2 commits April 11, 2026 01:00
The index and graph scripts were still v2, causing broken output for
every user running /alive:my-context-graph. This fixes the data pipeline
and replaces the visualization.

Index (generate-index.py):
- Recognize _kernel/ as walnut parent dir (was only _core/)
- Read now.json as JSON, not markdown frontmatter
- Detect bundles via context.manifest.yaml (was scanning _capsules/)
- Infer parent-child from filesystem hierarchy
- Bidirectional people-walnut links (person→walnut + walnut→person)
- Strip [[wikilinks]] on read — no file fixes needed
- Enrich with now.json data: task counts, bundle summaries, blockers,
  session recency, children

Graph (generate-graph.py):
- Replace circle packing with force-directed + domain cluster gravity
- Domain region labels (Life, Ventures, Experiments, etc.)
- Health indicators: green (active), amber (quiet), red (stale)
- Node sizing by degree + recency + bundles (wider range)
- Opacity by recency (bright = active, faded = stale)
- Neighborhood highlighting on hover (Obsidian-style)
- Detail panel on click: goal, next, tasks, bundles, people, connections
- Clickable connections in panel to navigate the graph
- Task urgency indicators (red dot) and blocker flags (amber triangle)
- Bundle count displayed on nodes
- Search that highlights without hiding (/ hotkey)
- Semantic zoom (labels appear/disappear by zoom level)
- People bridge nodes (toggle)
- Archive toggle (off by default)
- Dark mode toggle
- Drag to reposition, scroll to zoom

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
These fields were accidentally dropped in the graph rebuild rewrite.
The /alive:world skill depends on both fields being present in
_index.yaml and _index.json. Restores the squirrel-walking code
that computes world-level session data from .alive/_squirrels/*.yaml.
@benslockedin benslockedin force-pushed the fix/context-graph-v3 branch from ce78348 to 7b04df8 Compare April 10, 2026 15:05
@benslockedin benslockedin merged commit ccdbfad into main Apr 10, 2026
1 check passed
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