[codex] Add agent context handoff#19
Conversation
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds an Agent Context Handoff feature: new request command and request fields in the server, new handoff data types and a handoff-preparation implementation that filters project memory, generates warnings, renders JSON/Markdown, writes files under a project's ChangesAgent Context Handoff Feature
Sequence DiagramsequenceDiagram
participant Client
participant Server as Agent Server
participant Handler as Handoff Handler
participant FS as File System
Client->>Server: PrepareAgentContext request {meetings_root, task, project_hint, working_directory}
activate Server
Server->>Server: Validate inputs (meetings_root present, non-empty task)
Server->>Handler: prepare_agent_context_handoff(meetings_root, input)
activate Handler
Handler->>FS: Read project memory JSONL files
FS-->>Handler: Project memory objects
Handler->>Handler: Filter active objects & categorize
Handler->>Handler: Generate warnings & render Markdown/JSON
Handler->>FS: Write handoff.json and handoff.md (atomic)
Handler-->>Server: AgentContextHandoffResult {handoff, paths}
deactivate Handler
Server-->>Client: 200 OK {handoff}
deactivate Server
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces the Agent Context Handoff feature in the agent-server-rust and native-host-rust crates, which aggregates project memory—including decisions, tasks, and constraints—into JSON and Markdown formats for agent consumption. It adds a new PrepareAgentContext command to the agent server, implements logic to filter active memory objects, and includes tests to verify the handoff generation. Feedback focuses on improving error handling by verifying the existence of project directories before file operations to prevent the creation of empty directories and recommends escaping markdown special characters in source-derived text to ensure correct document formatting.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 030cf056ac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
Adds Agent Context Handoff v0 so MirrorNote can turn source-backed project memory into
handoff.jsonandhandoff.mdfor the next agent task.Why
MirrorNote needs a concrete handoff layer before full in-app agent execution. This lets a future Codex, Claude Code, Cursor, or in-app agent session receive concise context from existing project memory without re-explaining prior decisions, constraints, questions, and risks.
Changes
AgentContextHandofftypes andprepare_agent_context_handoff()in the Rust context packet module.projects/<project-id>/handoffs/handoff.jsonandhandoff.mdfrom project memory.prepareAgentContexttoMirrorNoteAgentServerso the daemon can prepare handoffs without implementing a full agent window.Validation:
CARGO_TARGET_DIR=target cargo fmt --checkinnative/native-host-rustCARGO_TARGET_DIR=target cargo fmt --checkinnative/agent-server-rustCARGO_TARGET_DIR=target cargo testinnative/native-host-rustCARGO_TARGET_DIR=target cargo testinnative/agent-server-rustnpm run native:buildgit diff --checkSummary by CodeRabbit
New Features
Behavior
Tests