What the agent sees
How lifecycle hooks provide context before edits, during prompts, and at the end of tasks.
Coding agents run more effectively when given relevant constraints rather than an entire unfiltered repository history. Mios uses lifecycle hooks to provide focused memory at key moments during a session.
Lifecycle hooks overview
When you run the automated installer, it registers specific hooks that run alongside Claude Code or Codex:
Session start --> Prompt submit --> Pre-tool use (Edit) --> Stop (End of task)
(Workspace) (Task dossier) (Decisions check) (Propose choices)
1. At prompt submission (UserPromptSubmit)
When you submit a prompt to your agent, the prompt-context hook runs before the model generates its plan.
The hook inspects the prompt, queries Mios for related architectural decisions, and injects a concise task dossier. The agent receives:
- Core project decisions relevant to the prompt.
- Active technical requirements and constraints.
- Links to relevant source discussions.
This ensures the model avoids suggesting patterns the team has explicitly rejected.
2. Context before edits (PreToolUse)
When an agent attempts to edit or write files using tools like Edit, Write, MultiEdit, or Bash, the pre-edit hook intercepts the action:
- It resolves the target file paths to the appropriate project.
- It checks whether the proposed edit conflicts with adopted project decisions.
- If a conflict is detected, it returns guidance to the agent before the file is modified on disk.
Additionally, the mcp-guard hook verifies project boundaries if the agent changes directories during a session, preventing accidental leaks between separate codebases.
3. End of task proposals (Stop)
When an agent finishes its work and execution stops, the stop hook runs a final analysis:
- It examines the git diff and the actions taken during the session.
- If the agent made new architectural choices or established a new convention, the hook formats them as proposed decisions.
- The proposals are submitted directly to the Mios review queue ("Needs you") at https://app.mios-ai.com.
A human teammate can then review, edit, or adopt these proposals, preserving the memory of the agent's work for future sessions.