Date: March 31, 2026 Author: Piper Alpha (PA) Purpose: Map Piper Morgan’s current context injection against Klatch’s five-layer prompt assembly model, for RFC-001 review response to Dispatch Status: Analysis complete; response memo pending
Dispatch (DinP) requested a layer mapping assessment: what does Piper Morgan inject today for each of the five layers, and where are the gaps? This analysis covers both the agent team (how 14 agent roles receive context) and the product (how Piper Morgan software injects context for end users).
The five-layer model originates from Klatch’s PROMPT-ASSEMBLY.md and is implemented in buildSystemPrompt() in packages/server/src/claude/client.ts.
What exists:
.claude/hooks/session-start.sh — Automatic hook at session initialization providing:
BRIEFING-CURRENT-STATE.md is >7 days old)Fidelity: HIGH — Hook runs every session. Filesystem-based checks are reliable.
Gap: No equivalent of Klatch’s “you’re in a different environment now” orientation. Agents don’t get told “you lost tool access” or “your context window changed” — they discover it through failure.
What exists:
CLAUDE.md (root, 418 lines) — The primary contract:
/api/v1/ prefix requirement)knowledge/CLAUDE.md (165 lines) — Supplementary briefing:
BRIEFING-ESSENTIAL-* to read)Fidelity: PERFECT — Static markdown committed to git. Survives everything.
Gap: Role assignment is hardcoded to Lead Developer in root CLAUDE.md. Other roles (PA, CXO, PPM, etc.) override this by being told their role in the conversation, but the file itself doesn’t adapt. PA’s briefing document (BRIEFING-piper-alpha.md) functions as an override.
What exists:
docs/briefing/BRIEFING-CURRENT-STATE.md — Sprint position tracker (last updated Mar 29):
docs/briefing/BRIEFING-ESSENTIAL-*.md — 10 role-specific briefings (~2.5K tokens each):
config/PIPER.user.md — The autobiography/personality profile (design fiction, July 2025)Fidelity: HIGH for static facts. MEDIUM for dynamic state — requires manual refresh. No auto-invalidation when reality changes.
Gap: Agent 360 finding: all 9 agents cited briefing staleness as #1 friction. Session-start overhead is 5-15 minutes per role as agents reconstruct “what happened since I was last here.” The BRIEFING-CURRENT-STATE file is the best mechanism but goes stale within days during active sprints.
What exists:
mailboxes/[role]/inbox/, read/, sent/):
session-start.sh surfaces unread count at session startdev/YYYY/MM/DD/ and dev/active/):
dev/active/):
docs/omnibus-logs/):
Fidelity: HIGH for async communication (mailbox and session logs persist in filesystem/git). No real-time peer visibility (“what are other agents doing right now”).
Gap: No “delta since last session” mechanism. Each agent must manually read omnibus logs and mailbox to reconstruct recent context. This is the primary source of the 5-15 minute session-start overhead identified by Agent 360. A structured “what changed since your last session” injection would address this.
What exists:
docs/briefing/BRIEFING-ESSENTIAL-*.md):
docs/briefing/BRIEFING-piper-alpha.md):
Fidelity: MEDIUM — Role briefings and task prompts survive in files. But no “learned personality” — each session, agents rebuild behavioral calibration from briefings. No mechanism to capture “this agent works best when given X context first” or “this agent tends to Y under pressure.”
Gap: Layer 5 is the open frontier (confirmed by Klatch’s import fidelity research: 0% transfer for behavioral calibration). Calliope’s externalization pilot in Klatch is the most promising approach. PM has no equivalent — role briefings describe what to do, not how you’ve learned to work with xian.
What exists:
config/PIPER.md — System identity loaded at startup via piper_config_loader.get_system_prompt()app.state (FastAPI application state)Fidelity: PERFECT but rigid — loaded once at startup, requires restart to change.
What exists:
services/intent_service/conversational_floor.py lines 33-65:
FLOOR_SYSTEM_PROMPT_ADDENDUM — Voice directives, interaction rules, prohibitionsFidelity: PERFECT — Embedded in code.
What exists:
services/intent_service/context_assembler.py — Gathers per-intent context:
Fidelity: HIGH for database-backed data. LOW for conversation history (in-memory only — see Layer 4).
Gap: Context assembler only fires for floor-native categories (GUIDANCE, DISCOVERY, TRUST, MEMORY, CONVERSATION, UNKNOWN). Handler-routed categories (STATUS, PRIORITY, TEMPORAL) bypass context assembly entirely — they get raw message without rich context.
What exists:
services/intent_service/conversation_context.py:
_conversation_contexts: dict[str, ConversationContext] = {} (line 432)(user_id, session_id)Fidelity: CRITICAL GAP — This is a plain Python dict. It dies on:
Impact: User refreshes page mid-conversation → loses “what we were discussing.” Multi-turn refinement breaks. Lens stack (topic digression/restoration) resets. Last offer state lost.
What exists:
services/personality/personality_profile.py:
PersonalityProfile dataclass: warmth_level, confidence_style, action_orientation, technical_depthadjust_for_context() adapts based on intent confidence and response typeget_response_style_guidance() generates tone directivesusers.preferences JSONB):
UserContextServiceFidelity: PERFECT for database-backed preferences. NO learning — system doesn’t update preferences based on observed behavior. Formality baseline loaded but never updated in real-time.
| Layer | Agent Team | Product | Key Gap |
|---|---|---|---|
| L1: Kit Briefing | Hook-based, reliable | Config-based, rigid | Agent: no environment-change awareness. Product: no hot-reload. |
| L2: Project Instructions | Static files, perfect | Hardcoded in code, perfect | Agent: role hardcoded to Lead Dev. Product: none. |
| L3: Project Memory | Briefing files + Serena | Database + context assembler | Agent: no auto-invalidation. Product: context assembler skips handler-routed intents. |
| L4: Channel Addendum | Mailbox + session logs, good | In-memory dict, dies on restart | Agent: no delta-since-last-session. Product: critical persistence gap. |
| L5: Entity Prompt | Role briefings, medium | DB preferences + personality, good | Agent: no learned calibration. Product: no behavioral learning. |
Agent Team Context Files:
| File | Layer | Purpose |
|——|——-|———|
| .claude/hooks/session-start.sh | L1 | Session initialization hook |
| CLAUDE.md | L2 | Root project instructions |
| knowledge/CLAUDE.md | L2 | Supplementary agent briefing |
| docs/briefing/BRIEFING-CURRENT-STATE.md | L3 | Sprint position and metrics |
| docs/briefing/BRIEFING-ESSENTIAL-*.md (10 files) | L3/L5 | Role-specific memory + persona |
| docs/briefing/BRIEFING-piper-alpha.md | L5 | PA-specific behavioral calibration |
| config/PIPER.user.md | L5 | Personality profile (autobiography) |
| mailboxes/[role]/inbox/ | L4 | Async peer-to-peer messaging |
| dev/YYYY/MM/DD/*-log.md | L4 | Session continuity logs |
| docs/omnibus-logs/ | L4 | Daily synthesized records |
Product Context Files:
| File | Layer | Purpose |
|——|——-|———|
| config/PIPER.md | L1 | System identity |
| services/intent_service/conversational_floor.py | L2/L5 | Voice directives + warmth calibration |
| services/intent_service/context_assembler.py | L3 | Per-intent context gathering |
| services/intent_service/conversation_context.py | L4 | Session context (IN-MEMORY) |
| services/personality/personality_profile.py | L5 | Persona adaptation |
| services/user_context_service.py | L3/L5 | User preference loading |
| web/api/routes/intent.py | L4 | HTTP boundary, RequestContext creation |