feat: LoRA Genome Paging + Chat Commands + Threading Architecture#169
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements a comprehensive foundation for multi-persona AI coordination through three major systems: LoRA Genome Paging, Chat Commands, and Threading Architecture. The implementation provides infrastructure for virtual memory-style adapter management, programmatic chat interaction, and establishes threading as the cognitive architecture for multi-agent coordination.
Key Changes:
- LoRA Genome Paging system with memory quota management and LRU eviction
- Chat commands for sending/exporting messages with threading support
- Comprehensive documentation on threading as thoughtstream architecture
- Integration of PersonaState into worker evaluation logic
Reviewed Changes
Copilot reviewed 57 out of 58 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| PersonaUser.ts | Adds PersonaState context (energy, attention, mood) to message evaluation |
| PersonaGenomeState.ts | New class for per-persona genome memory tracking with LRU eviction |
| PersonaGenomeState.test.ts | Comprehensive test suite (543 lines) for genome state management |
| MockLoRAAdapter.ts | Mock adapter for testing genome logic without GPU requirements |
| MockLoRAAdapter.test.ts | Test suite for mock adapter lifecycle and eviction scoring |
| LRUEviction.ts | Pure functions for weighted LRU eviction with thrashing protection |
| LRUEviction.test.ts | Test suite for eviction algorithms |
| AdapterRegistry.ts | Global registry for tracking all LoRA adapters |
| AdapterRegistry.test.ts | Test suite for adapter registration and lookup |
| GenomeDaemon.ts | Singleton daemon for cross-persona adapter coordination |
| GenomeDaemon.test.ts | Test suite for daemon coordination logic |
| test-ollama.ts | Standalone test for Ollama/llama.cpp integration |
| OllamaLoRAAdapter.ts | Enhanced to get model path via ollama show command |
| MULTI-TIER-TRAINING-STRATEGY.md | Documentation on training strategy across providers |
| persona-worker.ts | Enhanced with state-based modifiers for smarter evaluation |
| PersonaWorkerThread.ts | Refactored to pass PersonaState and config to worker |
| THREADING-AS-THOUGHTSTREAM.md | Major architectural documentation (494 lines) |
| PERSONA-SYSTEM-AUDIT.md | System audit and roadmap (581 lines) |
| Various docs | New documentation files establishing vision and design |
Files not reviewed (1)
- src/debug/jtag/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Fallback: construct path manually | ||
| // Ollama stores models in ~/.ollama/models/blobs/ | ||
| const ollamaDir = path.join(os.homedir(), '.ollama', 'models', 'manifests'); | ||
| const manifestPath = path.join(ollamaDir, modelName.replace(':', '/')); |
There was a problem hiding this comment.
Unused variable manifestPath.
joelteply
added a commit
that referenced
this pull request
Nov 30, 2025
* genome architectrure and vine diesel * genomic data architecture * sharing of persona and phenotype via genomic lora layers * lora didnt break anything * ai’s all think * claude says it works * genome work * tested works too well
joelteply
added a commit
that referenced
this pull request
Jun 3, 2026
…stody slice 1 (task #169) Foundation slice of [ENTITY-CHAIN-OF-CUSTODY.md](../../docs/architecture/ENTITY-CHAIN-OF-CUSTODY.md). The prerequisite for everything else in the chain-of-custody arc — signing, Merkle linkage, airc-native entity envelopes, cross- continuum portability all need a per-citizen home dir to live in. ### What landed **`crate::persona::home::PersonaHome`** — typed surface for "where this persona's stuff lives." Resolves: ``` <continuum_root>/personas/<agent_name>/ airc/ ← airc keypair (owned by airc-lib) seed.json ← PersonaIdentityProvider's seed engrams.sqlite ← OrmStore<Engram> + OrmStore<EngramRecallMetadata> ``` `PersonaHome::engrams_db()`, `airc_dir()`, `seed_json()`, `ensure_exists()`. One home = one citizen's complete on-disk surface. **`AdmissionState::for_persona(home, recall_metadata) -> Self`** — the persona-scoped entry point. Opens the per-persona SQLite, wires up OrmStore<Engram> + OrmStore<EngramRecallMetadata>, builds the production `OrmPersistenceSink`, rehydrates the in-memory Vec + DashMap from disk, returns the configured state. One call replaces the half-dozen orchestration steps the production path used to need. ### Why this is the right foundation Per [[entity-chain-of-custody-vision]]: the substrate's identity primitive is the airc Ed25519 keypair, which lives under `<home>/airc/`. The signing key (slice 3) will derive from that keypair. The Merkle chain head (slice 4) caches in the same home. Per-collection databases (future) sit alongside engrams.sqlite. **Every layer of the chain-of-custody design hangs off the same PersonaHome.** Getting this typed seam right means the future slices compose cleanly without re-doing path plumbing. ### 6/6 tests green PersonaHome unit tests (4): - `home_resolves_under_personas_subdir` — root composes correctly - `sub_path_accessors_compose_off_root` — engrams_db, airc_dir, seed_json all share the same root - `ensure_exists_creates_and_is_idempotent` — bootstrap-safe - `different_personas_have_disjoint_homes` — first defense of per-citizen isolation AdmissionState::for_persona integration tests (2): - `for_persona_round_trips_admissions_via_per_persona_sqlite` — admit through Paige's home → drop → fresh AdmissionState from the same home → rehydrates her engrams via real SQLite - `for_persona_isolates_two_personas_at_the_storage_layer` — Paige's engrams stay in Paige's home; Niko's fresh AdmissionState sees zero engrams. The crucial per-citizen isolation invariant. 50/50 admission-family tests green overall. ### Architecture documentation [ENTITY-CHAIN-OF-CUSTODY.md](docs/architecture/ENTITY-CHAIN-OF-CUSTODY.md) captures the full six-slice arc: 1. **This slice** — per-citizen home-dir scoping 2. author_peer_id + content_hash on every entity write 3. Sign on save, verify on load (airc Ed25519 keypair) 4. Chain head cache + Merkle walk audit 5. Airc-native entity envelopes (entities flow over airc) 6. Cross-continuum portability (export chain, verify, import) Plus how this generalizes the forge-alloy proof-contract pattern to all entities, and how OAuth/webauthn later derive FROM the airc identity rather than replace it. ### Doctrines this enforces - [[orm-everything-not-hand-edited-files]] — all persistence through the ORM - [[entity-chain-of-custody-vision]] — the multi-slice arc - [[personas-are-citizens-airc-is-identity-provider]] — the airc keypair is the identity primitive that this home dir centers - [[continuums-are-multi-instance-personas-have-lives]] — the storage layout that "personas have lives" requires Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements three interconnected systems that form the foundation for multi-persona AI coordination:
1. LoRA Genome Paging System ✅
Virtual memory-style system for managing PersonaUser skills via LoRA adapters.
Commands:
./jtag genome/paging-adapter-register- Register new LoRA adapter./jtag genome/paging-register- Register persona genome configuration./jtag genome/paging-activate- Activate adapter (mark as loaded)./jtag genome/paging-deactivate- Deactivate adapter./jtag genome/paging-stats- View genome status and memory usageFeatures:
2. Chat Commands for Programmatic Interaction ✅
Direct database access for sending and exporting chat messages.
Commands:
./jtag chat/send- Send message to room with optional threading (--replyToId)./jtag chat/export- Export chat history to markdown with thread structureUse Cases:
3. Threading as Thoughtstream Architecture 📚
Comprehensive documentation establishing threading as the fundamental cognitive architecture for multi-persona coordination.
New Documentation:
docs/THREADING-AS-THOUGHTSTREAM.md(540 lines)docs/PERSONA-SYSTEM-AUDIT.md(780 lines)Updated
docs/README.mdwith new documentation indexArchitecture Impact
Before: PersonaUsers process flat message streams without conversation context
After:
Testing
Genome Commands:
Chat Commands:
Next Phase: Thread-Aware Tasks (Week 1-4)
Week 1: Thread context infrastructure (
ThreadContextBuilder)Week 2: Thread-aware task system (
TaskEntitywiththreadId)Week 3: Thread-level coordination (parallel thread responses)
Week 4: PersonaUser integration (thread context in RAG)
Files Changed
Genome System (7 command files + entities):
commands/genome/paging-*- Full command implementationssystem/data/entities/GenomeEntity.ts- Genome storage schemasystem/data/entities/LoRAAdapterEntity.ts- Adapter trackingsystem/user/server/modules/PersonaGenome.ts- Genome manager (346 lines)Chat System (6 command files):
commands/chat/send/*- Send command implementationcommands/chat/export/*- Export command implementationDocumentation (3 files):
docs/THREADING-AS-THOUGHTSTREAM.md- New architecture docdocs/PERSONA-SYSTEM-AUDIT.md- New system auditdocs/README.md- Updated indexCLAUDE.md- Added chat commands sectionBreaking Changes
None - all additions are backward compatible.
Dependencies
No new dependencies added.
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com