Skip to content

feat: add synapse lifecycle and modernize context packs - #5

Merged
philngt merged 1 commit into
mainfrom
feat/synapse-lifecycle-graph
Aug 20, 2026
Merged

feat: add synapse lifecycle and modernize context packs#5
philngt merged 1 commit into
mainfrom
feat/synapse-lifecycle-graph

Conversation

@philngt

@philngt philngt commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Implementation

Add lifecycle-aware synapse projections, cache-safe context materialization, versioned pack validation, component-scoped pack knowledge, refreshed guidance, schemas, golden
evaluations, and release checks.

Summary / Context

This PR modernizes contextd's runtime knowledge model and pack system.

It introduces:

  • Lifecycle-aware synapse projections with typed relationships, freshness states, and explicit runtime, context, and long-term memory views.
  • Preservation of stale knowledge as traceable synapse nodes marked outdated instead of silently removing it.
  • Cache-safe context materialization that avoids redundant full-workspace synapse rebuilds while retaining drift detection.
  • Separate referenced, static, and total context-budget reporting.
  • Version-aware pack validation and manifest-v3 support.
  • Component-scoped canonical pack knowledge so runtime retrieval loads Global Principles plus matched components instead of the entire pack corpus.
  • Updated operator-steering guidance for knowledge gaps, decision quality, stopping conditions, escalation, and responsible human participation.
  • Refreshed README, onboarding documentation, pack catalog, schemas, golden evaluations, and release checks.
  • Compatibility support for manifest-v2 packs during incremental migration.

The component-scoped operator-steering pilot reduces the estimated payload from approximately 4,307 to 1,386 tokens, a reduction of about 68%, while preserving essential decision and
escalation guidance.

Problem & Why

The previous runtime and pack model had several related limitations:

  • Synapse relationships did not explicitly represent knowledge lifecycle or memory projection.
  • Outdated knowledge could not remain visible as a first-class graph node with a clear stale state.
  • Context materialization could rebuild and hash the full workspace again to verify drift, causing work to grow linearly with the corpus.
  • Packs were broad and document-oriented, requiring more knowledge to be loaded than a task actually needed.
  • Existing pack guidance focused heavily on agent behavior but provided limited support when users lacked domain knowledge, lost direction, or delegated too much thinking to AI.
  • Pack validation, schemas, documentation, golden evaluations, and release checks did not fully describe or enforce the newer runtime behavior.

This change keeps knowledge traceable across its lifecycle, reduces unnecessary context work, and makes retrieval more targeted. It also positions packs as practical decision support
for both agents and humans, helping users identify knowledge gaps, challenge assumptions, decide what to do next, and recognize when to stop or escalate.

Test Notes

  • python scripts/test_lint_wiki.py
  • python scripts/test_atomic_write.py
  • python scripts/test_detect_repetition.py
  • python scripts/lint-wiki.py --all-workspaces --wiki-root .
  • N/A (reason):

Additional validation:

  • python3 scripts/test_contextd_runtime.py — 46/46 passed
  • python3 scripts/test_artifact_schemas.py
  • contextd pack-validate --all — 15 packs, 0 errors, 0 warnings
  • Golden evaluation — 8/8 passed
  • Pattern-index checks passed
  • Repetition checks — 17/17 passed

Related Issues

N/A — no linked issue.

Docs / Workflow Impact

  • Updated docs because behavior/workflow changed
  • No docs update needed (reason):

Updated areas include:

  • README and onboarding guidance
  • Pack catalog and authoring guidance
  • Runtime and pipeline documentation
  • Synapse lifecycle and memory-projection documentation
  • Pack schemas and manifest-version behavior
  • Golden evaluation fixtures
  • Release validation checks

Manifest-v2 packs remain supported as compatibility inputs. Manifest-v3 packs use knowledge.md and pack.yaml#retrieval as their canonical, component-scoped knowledge layer.

Wiki-specific checks

  • Preserved workspace isolation
  • No cross-workspace knowledge mixing
  • Avoided duplicate docs/patterns

All retrieval and synapse projections remain scoped to the active workspace. Outdated nodes retain provenance and lifecycle state without borrowing replacement knowledge from another
workspace.

Project Spirit Check

  • Change reinforces knowledge-first workflow (contracts/patterns before invention)
  • Contributor experience stays simple and practical (no unnecessary complexity)
  • Project voice and intent remain consistent across docs/workflows
  • If trade-offs were made, rationale is stated clearly in this PR

Trade-offs:

  • Manifest v3 is introduced incrementally instead of forcing an immediate migration of every existing pack.
  • Manifest-v2 compatibility is retained to avoid breaking current users, at the cost of temporarily maintaining two validation paths.
  • Outdated knowledge remains in the synapse graph for provenance and explainability, but is explicitly marked and excluded from fresh-context assumptions.
  • Cached materialization avoids redundant full-workspace rebuilding while preserving drift checks required for correctness.
  • Component-scoped retrieval adds structure to pack authoring, but materially reduces runtime context size and makes loaded guidance easier to explain.

Add lifecycle-aware synapse projections, cache-safe context materialization, versioned pack validation, component-scoped pack knowledge, refreshed guidance, schemas, golden evaluations, and release checks.
@philngt philngt self-assigned this Aug 20, 2026
@philngt
philngt merged commit 677f556 into main Aug 20, 2026
2 checks 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.

1 participant