Skip to main content

rhema_coding_agent/
lib.rs

1//! rhema-coding-agent — the coding-agent driver, the first consumer of
2//! rhema-core's step engine.
3//!
4//! Wires a [`ModelProvider`](rhema_core::ModelProvider) into a
5//! [`CodingAgent`] whose turns drive `rhema_core::run_turn` over the
6//! shared toolkit (`rhema-agent-tools`): the approval-gated shell, its
7//! spec and discovered skills presented in the system prompt, the model
8//! loading skill bodies via the shell. Tool errors surface in-band to
9//! the model (SPEC.md §4); approval arrives per turn through the
10//! [`Approval`] hook; the session is plain data the driver can persist
11//! and resume, with a commit hook so an intent is durable before its
12//! first side effect, revive-on-resume for calls a crash left
13//! unanswered, and cancel-path repair for those a user stopped.
14//!
15//! Layout:
16//! - [`agent`] — `CodingAgent`, `CodingAgentError`, `stamped_system`
17//! - [`config`] — `CodingAgentConfig`
18//! - [`prompt`] — the SYSTEM.md template and its default render
19//!
20//! The toolkit itself — the `Approval` seam, `ShellTools`, skills, paste
21//! expansion, dangling-call repair, the renderer — lives in
22//! `rhema-agent-tools` and re-exports here: the TUI and ACP drivers
23//! import these names from this crate, and the claw's forge handler
24//! takes the approval policy the same way.
25//!
26//! # Skills
27//!
28//! A skill is a folder with a `SKILL.md` whose frontmatter carries a
29//! `description` (the trigger). Only name, trigger, and file enter the
30//! system prompt, as the [`prompt`] module's `skills` list; the model
31//! reads a body itself through the bash tool when a trigger applies.
32//! Skills live globally under the config directory and
33//! per-workspace under `.rhema/skills`, project shadowing global.
34
35#![forbid(unsafe_code)]
36#![deny(missing_docs)]
37
38pub mod agent;
39pub mod config;
40pub mod prompt;
41
42pub use agent::{CodingAgent, CodingAgentError, stamped_system};
43pub use config::CodingAgentConfig;
44pub use prompt::{DEFAULT_SYSTEM_MD, default_system};
45// The toolkit the driver is built on, under this crate's name: every
46// downstream driver (TUI, ACP, the claw) keeps its import paths.
47pub use rhema_agent_tools::{
48    AllowAll, Approval, DenyAll, ExpandPastes, ShellTools, render_system, render_template,
49    repair_dangling_calls, revive_dangling_calls,
50};