lazyagent
AGENTS.md1 starsChanged 8 months agoMITView on GitHub
Lazygit-style TUI for managing live AI coding agent sessions via tmux. Rust + ratatui + crossterm.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 45
All tests use #[test], MockProvider with TestBackend — no external test framework
- Very specific: line 46
Prefer anyhow::Result for app-level errors
- Very specific: line 62
Use /log-search skill to search/filter logs
- Distinctive: line 66
Add async to the event loop without strong reason
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
LazyAgent
Lazygit-style TUI for managing live AI coding agent sessions via tmux. Rust + ratatui + crossterm.
Architecture
src/
main.rs — entry, event loop, attach/spawn dispatch, render_main
app.rs — App state, key handling, session navigation, search, kill confirm
event.rs — crossterm event polling
session.rs — SessionManager: poll/spawn/attach/kill via TmuxController
protocol/
mod.rs — types: AgentSession, AgentStatus, SessionKind, SessionSource, ExecPlan
provider.rs — Provider trait: detect_status, match_process, exec_plan
provider/
mod.rs — provider registry
claude.rs — ClaudeProvider: process matching + pane output status detection
tmux/
mod.rs — TmuxController: discover_sessions, spawn_session, attach/kill
tui/
mod.rs — terminal init/restore
layout.rs — AppLayout: 2-col or 3-col horizontal
sidebar.rs — session list with status icons, source/project grouping
detail.rs — detail panel: KV display of session info
help.rs — help bar with context-aware hints
theme.rs — color/style constants incl status colorsKey Patterns
- Provider protocol: trait-based plugin system —
detect_status()for pane output,match_process()for discovery - Session discovery:
tmux list-panes -a -F→ match process via providers →capture-panefor status - Managed sessions: spawned with
la/<provider>/<dir>naming convention - Discovered sessions: externally-started agent sessions found in any tmux session
- Attach flow: suspend TUI →
tmux attach-session -t <name>→ restore TUI on exit - Auto-refresh: sessions polled every 2s via tick counter
- Kill confirmation:
dsetsconfirm_kill,y/nto confirm/cancel
Code Conventions
- Rust 2021 edition, no async in main loop (sync event polling, 100ms tick)
- Immutable ratatui frame rendering, no stateful widgets
- CJK-aware text truncation
- All tests use
#[test], MockProvider with TestBackend — no external test framework - Prefer
anyhow::Resultfor app-level errors
Build & Test
cargo build
cargo test # 24 tests: e2e, provider, sidebar, tmux, rendering
cargo run # requires tmuxLogging
- tracing-based structured logging, default info level (override via
LAZYAGENT_LOGenv) - Log dir:
~/.local/state/lazyagent/(dirs::state_dir()) - Files:
lazyagent.log.YYYY-MM-DD(all),lazyagent-error.log.YYYY-MM-DD(errors only) - Daily rotation, 7-day retention
- Use
/log-searchskill to search/filter logs
Do Not
- Add async to the event loop without strong reason
- Break Provider trait backward compat without updating all providers
- Hardcode paths — use
dirscrate for home, env vars for config - Swallow errors silently — always surface via
app.error_message - Kill agent sessions on TUI quit — sessions must persist independently
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

