CAPE - Collaborative Agents Prompt Engineering A developer introduced CAPE (Collaborative Agents Prompt Engineering), a multi-agent framework that models a software product team with four specialized roles: Product Owner, Designer, Developer, and Cape Master. The framework enforces role fidelity and uses a structured handoff protocol and KPT-based retrospectives to improve collaboration across sessions. An open-source CLI implementation is available. A Role-Based Multi-Agent Framework with Human Team Dynamics Large language models are increasingly capable of producing high-quality outputs in isolation, yet single-agent systems lack the specialization, accountability, and self-correction that human teams develop naturally over time. CAPE Collaborative Agents Prompt Engineering proposes a structured multi-agent framework that mirrors the dynamics of a real software product team. Four specialized agents — Product Owner, Designer, Developer, and a Cape Master facilitator — collaborate within a defined session protocol, produce structured artifacts, and improve their collaboration across sessions through a KPT-based retrospective system. This paper describes the design of the framework, its measurement model, and the architectural decisions behind its open-source CLI implementation. When a user prompts a general-purpose AI with a complex product task — "add dark mode to the app" — the model must simultaneously reason about business value, user experience, technical feasibility, and implementation specifics. This conflation of concerns degrades output quality in each dimension and leaves no mechanism for specialization, cross-checking, or learning between runs. Human teams solve this through role specialization and structured collaboration: a product owner defines value, a designer specifies experience, a developer implements, and a facilitator keeps the process honest. The question CAPE addresses is: can these dynamics be faithfully modeled in a multi-agent system, and does the structure yield better outcomes than a single capable agent? CAPE introduces four agent roles with strict role fidelity — agents are explicitly prohibited from drifting into each other's domains. A session follows a linear handoff protocol: CM Opening → POA → DA → DevA → CM Retrospective . Each agent receives only the outputs it needs from upstream agents, reducing context noise while enforcing cross-referencing. After each session, the Cape Master facilitates a structured retrospective that produces KPT Keep / Problem / Try items, which are accumulated in a merged history file read at the opening of subsequent sessions. This creates a feedback loop across sessions that progressively informs the team's behavior. CAPE defines four agent roles, each with a strict scope boundary: | Agent | Role | Domain | |---|---|---| CM | Cape Master | Process facilitation, DoR checking, KPT retrospective | POA | Product Owner Agent | Business value, acceptance criteria, prioritization | DA | Designer Agent | UX rationale, component specifications, brand adherence | DevA | Developer Agent | Technical architecture, implementation, file generation | Role fidelity is enforced at the prompt level: each agent's instructions explicitly state what it must not do. POA does not propose technical solutions; DA does not override business requirements; DevA does not reprioritize the backlog; CM does not produce domain outputs of any kind. The Cape Master CM is the Scrum Master analog of the system. It appears twice in each session: Opening — CM reads the objective, checks it against Definition of Ready criteria, identifies session-specific risks, and gives each agent a tailored coaching note. If historical KPT data exists from prior sessions, CM explicitly references recurring Problems and unresolved Tries in its coaching. Retrospective — After all domain agents have produced their outputs, CM facilitates a structured conversation among the full team. Each agent reflects on their contribution, surfaces friction, and proposes improvements. CM derives a KPT from the conversation and computes satisfaction metrics. This dual-appearance structure mirrors how a skilled Scrum Master sets context before a sprint and extracts learning after it. Every agent message conforms to a structured JSON envelope: { "agent": "AgentName", "role": "RoleDescription", "task id": "unique task identifier", "voice": "Casual first-person reflection in session language", "output": "Domain-specific content", "references": "AgentName" , "confidence": 4, "ass": { "score": 4, "positive": "What worked well", "improvement": "What to improve", "context adequate": true } } The voice field is a deliberate design choice: it produces a casual, first-person reflection that is surfaced in the terminal during streaming, making the session feel like a team conversation rather than a pipeline of API calls. The references field enforces explicit acknowledgment of upstream outputs rather than implicit consumption. Each project using CAPE maintains a cape/ directory that serves as the context repository for agents. Files are organized by domain: cape/ ├── 0 team/ Shared protocol, culture, DoR, DoD ├── 1 product/ MVV, personas, milestones, backlog ├── 2 design/ Design principles, brand guidelines ├── 3 development/ Architecture, coding standards, playbook ├── 4 orchestration/ Process definitions, metrics └── 5 sessions/ ├── pair/ Per-session raw artifacts JSON └── retrospective/ Per-session KPT markdown + kpt merged.md Files carry a type frontmatter field: generic files define the CAPE framework itself and should not be modified; input files are project-specific and must be filled in before sessions. The cape init command generates all files interactively by asking the user questions in natural language and calling an LLM to translate answers into structured project context. Each session closes with a KPT structured as: These are persisted as a dated markdown file: cape/5 sessions/retrospective/YYYY-MM-DD HH-MM