Skip to main content

lattice_ai/pi/
mod.rs

1//! `pi` โ€” lattice drives the pi agent's **native TUI** in a terminal buffer
2//! (the v1 pi integration).
3//!
4//! `:pi` spawns the `pi` TUI (via [`Effect::SpawnTerminal`]) and activates
5//! [`PiMode`] โ€” a minor mode over `terminal-mode` that is the seam for future
6//! lattice-native integration (RPC conversation buffer, headerline status).
7//! The full pi UX (readline, `/` commands, model switching, history, session
8//! tree, extension system) comes from pi's real TUI running in the PTY, so
9//! lattice reimplements none of it.
10//!
11//! This is the **terminal topology** (like the MCP / Claude Code peer and
12//! opencode): the agent runs in a terminal buffer and lattice layers
13//! integration via a minor mode. Pi's RPC mode (`pi --mode rpc`) offers a
14//! future path for deeper lattice-native integration, analogous to the ACP
15//! adapter for opencode โ€” that is deferred; see
16//! `docs/dev/architecture/pi.md` ยง6.
17//!
18//! [`Effect::SpawnTerminal`]: lattice_grammar::effect::Effect::SpawnTerminal
19
20pub mod commands;
21pub mod modes;
22
23use lattice_mode::SubsystemBoot;
24
25/// Wire the pi terminal integration into editor boot: the `:pi` ex-command +
26/// the `pi-mode` minor. One line in the crate-root install.
27pub fn install(boot: &mut impl SubsystemBoot) {
28    commands::register_pi_ex_commands(boot.commands_mut());
29    modes::register_pi_modes(boot.modes_mut());
30}
31
32pub use modes::{PiMode, register_pi_modes};