Skip to content

feat: agent-activated bootstrap + Parzival v2 injection architecture#53

Merged
Hidden-History merged 7 commits intomainfrom
feature/parzival-v2-injection-architecture
Mar 8, 2026
Merged

feat: agent-activated bootstrap + Parzival v2 injection architecture#53
Hidden-History merged 7 commits intomainfrom
feature/parzival-v2-injection-architecture

Conversation

@Hidden-History
Copy link
Owner

Summary

Restructures the session injection architecture so that cross-session memory loads when Parzival is activated — not on every session start.

  • Remove startup trigger from SessionStart hook; matcher simplified to resume|compact for all states
  • Remove non-Parzival ambient bootstrap path from retrieve_bootstrap_context()
  • Add aim-parzival-bootstrap skill for on-demand cross-session memory retrieval from Qdrant
  • Add aim-parzival-constraints skill for behavioral constraint loading and post-compact re-injection
  • Add load_parzival_constraints() shared utility in injection.py with phase parameter sanitization
  • Add update-pov.sh script for existing users to upgrade Parzival V1 to V2
  • Integrate constraint re-injection into session_start.py compact path when parzival_enabled=true

PLAN-011: 12 tasks (TASK-030 through TASK-041), all complete.
Review: 3 adversarial code review rounds, all findings resolved.
Tests: 2116 tests pass.

Files Changed

File Change
.claude/hooks/scripts/session_start.py Startup block removed, compact constraint re-injection added
.claude/skills/aim-parzival-bootstrap/SKILL.md New — cross-session memory retrieval skill
.claude/skills/aim-parzival-constraints/SKILL.md New — constraint loading skill
scripts/update-pov.sh New — V1-to-V2 update script
scripts/update_parzival_settings.py MATCHER constants removed
src/memory/injection.py load_parzival_constraints() added, non-Parzival path removed
tests/hooks/test_session_start.py Matcher test updated for simplified architecture
tests/unit/test_parzival_bootstrap.py Non-Parzival test + TD-174 docstring updated
.gitignore trace_buffer/ excluded

Test Plan

  • Verify resume and compact session restore paths still work
  • Verify /aim-parzival-bootstrap retrieves cross-session memory from Qdrant
  • Verify /aim-parzival-constraints loads global and phase-specific constraints
  • Verify compact path re-injects constraints when parzival_enabled=true
  • Verify update-pov.sh --dry-run reports changes without modifying files
  • Verify no startup trigger exists in session_start.py
  • Run full test suite: pytest (2116 tests)
  • Investigate last merge test failure before merge

Parzival, AI Oversight Agent

WB Solutions and others added 2 commits March 7, 2026 09:40
…(PLAN-011)

Move cross-session memory bootstrap from SessionStart hook (startup
trigger) to on-demand skill invocation. Sessions start clean — Qdrant
context loads only when Parzival is activated by the user.

Changes:
- Remove startup trigger from SessionStart hook matcher (resume|compact only)
- Remove non-Parzival startup bootstrap path from retrieve_bootstrap_context()
- Add aim-parzival-bootstrap skill for cross-session memory retrieval
- Add aim-parzival-constraints skill for behavioral constraint loading
- Add load_parzival_constraints() to injection.py with path traversal guard
- Add constraint re-injection to compact path (prevents drift after compaction)
- Remove MATCHER_PARZIVAL/MATCHER_STANDARD constants from update_parzival_settings.py
- Add update-pov.sh script for V1→V2 Parzival upgrades (--dry-run, config preservation)
- Add trace_buffer/ to .gitignore
- Update tests to match new architecture

PLAN-011 tasks: TASK-030 through TASK-041 (all complete)
3 adversarial review rounds, all findings resolved
2116 tests pass, 0 failures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add missing blank line after inline `import re` in load_parzival_constraints().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Hidden-History Hidden-History force-pushed the feature/parzival-v2-injection-architecture branch from 47edc0d to ebb75f2 Compare March 7, 2026 17:40
WB Solutions and others added 5 commits March 7, 2026 16:18
… V1 removal

Phase 1 — Build _ai-memory/ package:
- Relocate 281 canonical Parzival V2 files to root _ai-memory/
- Move 17 skills + 3 agents into _ai-memory/skills/ and _ai-memory/agents/
- Fix 7 skills' import pattern: Path(__file__).parents[3] → expanduser("~/.ai-memory")
- Fix 9 downstream _project_root NameErrors → os.getcwd() / Path.cwd()
- Create step-01b (Qdrant bootstrap) + step-01c (constraint loading)
- Modify step-01 chain: step-01 → 01b → 01c → step-02
- Modify step-04: invoke /parzival-save-handoff and /parzival-save-insight
- Update parzival.md persona: Technical PM & Quality Gatekeeper
- Fix .gitignore: pov/ → /pov/ (root-anchored, DEC-051)

Phase 2 — Create .claude/ shims:
- 17 skill shims preserving all YAML headers (trigger, context, allowed-tools)
- 3 agent shims preserving model fields
- 1 pov agent shim + 9 pov command shims

Phase 3 — Remove V1 files:
- Delete .claude/agents/parzival/ (4 files)
- Delete .claude/commands/parzival/ (8 files)
- Delete scripts/update-pov.sh

Decisions: DEC-051 (.gitignore), DEC-052 (_project_root fix), DEC-053 (persona)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 7 new deployment functions to install.sh for Parzival V2:
- detect_parzival_version, cleanup_parzival_v1, deploy_parzival_v2
- deploy_parzival_shims, deploy_ai_memory_skills, deploy_ai_memory_agents
- sync_parzival_config_yaml (sed-based, preserves YAML comments)

Rewrite setup_parzival() with V2 flow: version detection, V1 upgrade,
error-wrapped deployment, scoped stale cleanup. Remove old skill/agent
loops from create_project_symlinks(). Delete deploy_parzival_commands().

All cp -r globs use compgen -G guards. PID-suffixed backup paths for
parallel safety. Skills/agents always deployed even without Parzival.

2116 tests pass, 0 failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- BUG-206: session_start.py rewritten — resume outputs nothing (DEC-054),
  non-Parzival compact outputs rich session summary only (DEC-055),
  Parzival compact unchanged (DEC-056)
- FAIL-03: merge_settings.py strips vestigial 'startup' matcher on upgrade
- FAIL-07: install.sh removes 13 stale V1 skill directories on install
- CHANGELOG.md: Full v2.2.0 entry with upgrade instructions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- FAIL-06: GC-13 (best practices research) was in oversight workspace
  but never committed to source repo _ai-memory/ package
- Update test_session_start_dual_collection_logic for v2.2.0 architecture:
  resume early exit (DEC-054), get_recent for session summaries (DEC-055)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Bump version 2.1.0 → 2.2.0 in pyproject.toml and embedding service
- Fix stale generate_settings.py comment (F-03): matcher is resume|compact
  for ALL states in v2.2.0 (DEC-054/055), no longer expanded for Parzival
- Fix 3 stale test comments referencing removed startup|resume|compact
  expansion behavior (update_parzival_settings.py no longer modifies matcher)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Hidden-History Hidden-History merged commit 9c965c6 into main Mar 8, 2026
12 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