Skip to content

[codex] Add agent review CLI and review API - #286

Open
iheanyi wants to merge 8 commits into
agavra:mainfrom
iheanyi:iheanyi/codex-mcp-app
Open

[codex] Add agent review CLI and review API#286
iheanyi wants to merge 8 commits into
agavra:mainfrom
iheanyi:iheanyi/codex-mcp-app

Conversation

@iheanyi

@iheanyi iheanyi commented May 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Pivots the agentic review integration from a long-lived MCP server to a lightweight tuicr review CLI, following the maintainer suggestion in the latest review discussion.

  • Adds tuicr review open --repo . --diff-source working-tree --json.
  • Adds tuicr review diff --session <id> --path <path> --max-lines <n>.
  • Adds tuicr review comment add --session <id> --path <path> --line <n> --side new --type issue --body "...".
  • Adds tuicr review file reviewed --session <id> --path <path> --set true.
  • Adds tuicr review export --session <id> and tuicr review clear --session <id>.
  • Keeps tuicr::review_api::ReviewService as the public Rust API for external integrations.
  • Removes the MCP protocol/server adapter and drops the rmcp/tokio dependency additions.
  • Persists CLI-opened sessions and reloads them by session id across separate CLI invocations.

Design

The CLI is now the first-party agent integration surface. It uses the same shared review service as the public Rust API, so an external tuicr-mcp or app package can either depend on the crate API or wrap the CLI without adding a protocol server to this repository.

The persisted-session reload path preserves the originally opened file set. For example, opening a narrow review with --path src/review_cli.rs keeps later diff, comment, export, and clear commands scoped to that same loaded review instead of expanding to the full working tree.

Validation

  • cargo fmt
  • cargo check
  • cargo test review_cli
  • cargo test
  • CLI smoke against this branch:
    • target/debug/tuicr review open --repo . --diff-source working-tree --path src/review_cli.rs --json
    • target/debug/tuicr review diff --session <id> --path src/review_cli.rs --max-lines 12
    • target/debug/tuicr review comment add --session <id> --path src/review_cli.rs --line 2 --side new --type note --body "..."
    • target/debug/tuicr review file reviewed --session <id> --path src/review_cli.rs --set true
    • target/debug/tuicr review export --session <id>
    • target/debug/tuicr review clear --session <id>

@iheanyi
iheanyi force-pushed the iheanyi/codex-mcp-app branch from 73f6226 to 9af5884 Compare May 12, 2026 22:57
@iheanyi
iheanyi marked this pull request as draft May 12, 2026 23:00
@agavra

agavra commented May 12, 2026

Copy link
Copy Markdown
Owner

Hey @iheanyi - I'm not especially eager to ship tuicr with a server side component, I'd rather keep it a simple CLI tool. There's been some discussion on this in the past (see #221). There are quite a few diff tools that ship with a frontend that are pretty good if you want to check those out.

@iheanyi

iheanyi commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

@agavra What if we wrote it in Rust to plug into the current CLI? I use Codex's CLI at work and the Codex desktop app at home and I'd like to be able to use Tuicr from the Codex app without breaking flow-state. With an MCP app, I can do the code review in my application and also paste it directly back into the desktop app, could you let me know your concerns about adding MCP App Support per chance?

@agavra

agavra commented May 12, 2026

Copy link
Copy Markdown
Owner

adding node/javascript dependencies is definitely a concern with all of the recent supply chain vulnerabilities. Rust isn't immune from that but it's at least slightly better.

In general this would add a lot of surface area for tuicr, which means more potential "weird" interactions and a higher test burden. For now I've been testing most PRs manually, adding a server (and especially a frontend) adds a component that is quite a bit tougher to verify.

But I admit I don't totally understand your workflow because I don't use the Codex or Claude apps myself, what is the workflow problem you're trying to solve? Is running a terminal window and then copying from that into the Codex app no good?

@iheanyi

iheanyi commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

I hear you on that and that's a fair concern with all of the supply chain risks these days.

That's pretty much it, I don't like context switching in tools I use, personally. When I'm in the terminal, I use tmux and the like. I guess I could do it from a terminal and copy and paste it in there, but having it streamlined would've been nice as well. For MCP apps, it interfaces with Claude and Codex similarly to the CLI review skill itself And can directly send feedback back into the chat interface, so it's the same as my cli flow with tmux.

@agavra

agavra commented May 12, 2026

Copy link
Copy Markdown
Owner

Got it, you are the second person to request MCP support so it might be worth designing something for that. I'm pretty firm on the "no frontend" outside of a TUI line, but I can be open to a minimal rust server that implements the MCP protocol for shipping feeback to an agent.

@iheanyi
iheanyi force-pushed the iheanyi/codex-mcp-app branch from 9af5884 to 143ce8e Compare May 13, 2026 02:31
@iheanyi iheanyi changed the title [codex] Add tuicr MCP app integration [codex] Add headless tuicr MCP server May 13, 2026
@iheanyi

iheanyi commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

Still working on the MCP Server, but I was able to record a video of the MCP App flow for posterity at least, as you can see, it makes it a lot more streamlined and all of that for addressing review comments and loading them back up and in tandem with MCP itself, it could be published right back into the application itself.

CleanShot.2026-05-12.at.22.24.06.mp4

@iheanyi
iheanyi force-pushed the iheanyi/codex-mcp-app branch from b2ed0cd to 1695917 Compare May 13, 2026 17:36
@iheanyi
iheanyi marked this pull request as ready for review May 13, 2026 17:36
@iheanyi
iheanyi force-pushed the iheanyi/codex-mcp-app branch from 53ea5fc to 6716e11 Compare May 13, 2026 19:37
@iheanyi

iheanyi commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

@agavra This is ready for review. As a middleground, I exposed the ReviewService as a public crate. Idea is that we can keep the tuicr-app out of this repository, but I can make a separate repository for tuicr-app that adds the desired MCP UI/App functionality for folks who want it, that way we get the best of both worlds and this one stays CLI-only.

@agavra

agavra commented May 13, 2026

Copy link
Copy Markdown
Owner

thanks @iheanyi - I'm getting excited about this change, I'll need to set aside some time to review and test it so may not get around to it immediately but it's on my radar

@iheanyi
iheanyi force-pushed the iheanyi/codex-mcp-app branch from 6716e11 to 40e0e15 Compare May 14, 2026 02:49
iheanyi added 7 commits May 14, 2026 20:01
Replace the experimental Node MCP App package with a Rust stdio MCP server exposed through tuicr mcp. The server reuses tuicr diff loading, review state, comments, reviewed marks, and Markdown export format while exposing model-readable tools for agentic review.

Remove the MCP Apps frontend/plugin bundle so this stays a lightweight MCP server rather than a UI app.
@iheanyi
iheanyi force-pushed the iheanyi/codex-mcp-app branch from 40e0e15 to 689a61a Compare May 15, 2026 01:05
@agavra

agavra commented May 15, 2026

Copy link
Copy Markdown
Owner

Thanks @iheanyi for the back and forth on this.

I spent some time playing around with this and reviewing it and I'm back to being unconvinced we need this. An alternative if we want a native interaction with agents would be to expose a CLI with the following commands:

  tuicr review open --repo . --diff-source working-tree --json
  tuicr review diff --session <id> --path src/main.rs --max-lines 200
  tuicr review comment add --session <id> --path src/main.rs --line 42 --side new --type issue --body "..."
  tuicr review file reviewed --session <id> --path src/main.rs --set true
  tuicr review export --session <id>
  tuicr review clear --session <id>

That way the agent can use the tuicr CLI to interact with a tuicr JSON storage file. We can have tuicr hot-reload the contents of that file so that it's interactive both ways.

The CLI has various benefits (here's what codex says):


The core workflow seems to be: let an agent inspect the active review, add comments, mark files reviewed, and export the final review. A small CLI that mutates tuicr’s existing session files through the same Rust validation code could support that without introducing a long-lived server/protocol surface.

  • Simpler security model: each operation is an explicit process invocation instead of a persistent MCP capability exposed to agents.
  • Easier to audit and debug: commands, args, stdout/stderr, and exit codes are visible and reproducible.
  • Better alignment with tuicr’s current persistence model: agents can update the same review session files the TUI already uses.
  • The TUI could hot-reload the active session when the file changes, allowing human and agent edits to meet in the same place.
  • Less protocol-specific maintenance: no MCP schemas, session server lifecycle, or client compatibility concerns.
  • Reusable outside MCP-aware clients: any agent or script can call a CLI.
  • Easier testing: command-level integration tests can assert file mutations, validation errors, and export output.

That said, I don't mind the refactor into a library (I actively like it) where you could then write a tuicr-mcp using the published cargo crates as a dependency if the MCP is something you absolutely need. Alternatively, you can build an MCP server around the CLI directly.

I admit I never use MCPs over CLIs, and I'm pretty stuck in the TUIs for Claude/Codex. Maybe I'll start playing around more with the desktop apps eventually and then understand the need.

@iheanyi iheanyi changed the title [codex] Add headless tuicr MCP server [codex] Add agent review CLI and review API May 15, 2026
@iheanyi

iheanyi commented May 15, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the CLI pivot suggested above.

What changed:

  • Removed the MCP server/protocol adapter from this PR.
  • Dropped the added rmcp and tokio dependencies.
  • Kept the public tuicr::review_api::ReviewService surface.
  • Added the proposed tuicr review ... command family over the same review service:
    • open
    • diff
    • comment add
    • file reviewed
    • export
    • clear
  • Added session-id reload support so separate CLI invocations can keep working against the same persisted review.

Validation:

  • cargo fmt
  • cargo check
  • cargo test review_cli
  • cargo test
  • Manual CLI smoke against this branch for open, diff, comment add, file reviewed, export, and clear.

One behavior I tightened while smoke-testing: if a review is opened with a file/path filter, later commands by --session now preserve that originally loaded file set instead of expanding to the whole working tree.

@agavra

agavra commented May 15, 2026

Copy link
Copy Markdown
Owner

@iheanyi I think you told me you have a bot that addresses review comments automatically, so i just want to make sure you (the human) are OK with this new approach.

@iheanyi

iheanyi commented May 15, 2026

Copy link
Copy Markdown
Contributor Author

@agavra Yeah, haha, that's cool with me. I had read it yesterday before bed and forgot to respond, oops.

@iheanyi

iheanyi commented May 15, 2026

Copy link
Copy Markdown
Contributor Author

I do like having it exposed as a CLI in this case at least. And having tuicr-mcp separately also makes sense, can encapsulate both the MCP itself and the MCP App too, good call

@agavra

agavra commented May 15, 2026

Copy link
Copy Markdown
Owner

@iheanyi if you don't mind, now that we've agreed on an approach, I'm going to take this feature on. I think it's a pretty critical core feature to tuicr UX and I'd like to do a proper design exercise and think through how it works.

I spent a little time reviewing codex's approach to it and I'm not super thrilled. I'll try to get it going tonight so it can unblock your agent-driven review workflow.

@agavra

agavra commented May 15, 2026

Copy link
Copy Markdown
Owner

#310

@iheanyi

iheanyi commented May 15, 2026

Copy link
Copy Markdown
Contributor Author

That's perfectly fine @agavra! All I request is that make sure the service is exported/public so I can use it in a crate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants