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` and the `Steering` seam
18//! - [`prompt`] — the SYSTEM.md template and its default render
19//! - [`environment`] — the startup environment report and the sandbox
20//! notice, the prompt's environment section
21//!
22//! The toolkit itself — the `Approval` seam, `ShellTools`, skills, paste
23//! expansion, dangling-call repair, the renderer — lives in
24//! `rhema-agent-tools` and re-exports here: the TUI and ACP drivers
25//! import these names from this crate, and the claw's forge handler
26//! takes the approval policy the same way.
27//!
28//! # Skills
29//!
30//! A skill is a folder with a `SKILL.md` whose frontmatter carries a
31//! `description` (the trigger). Only name, trigger, and file enter the
32//! system prompt, as the [`prompt`] module's `skills` list; the model
33//! reads a body itself through the bash tool when a trigger applies.
34//! Skills live per-workspace under `.rhema/skills`, globally under the
35//! config directory, and, at the lowest tier, in the cross-agent
36//! `~/.agents/skills`. A name claimed by a higher tier hides the lower
37//! copies, project over global over `.agents`.
38
39#![forbid(unsafe_code)]
40
41pub mod agent;
42pub mod config;
43pub mod environment;
44pub mod prompt;
45
46pub use agent::{
47 CodingAgent, CodingAgentError, clear_environment_stamp, stamped_system,
48 stamped_system_with_sections, stamped_system_with_skills,
49};
50pub use config::{CodingAgentConfig, Steering};
51pub use environment::{host_report, remote_notice};
52pub use prompt::{DEFAULT_SYSTEM_MD, default_system};
53// The toolkit the driver is built on, under this crate's name: every
54// downstream driver (TUI, ACP, the claw) keeps its import paths.
55pub use rhema_agent_tools::{
56 AllowAll, Approval, DenyAll, ExpandPastes, ShellTools, render_system, render_template,
57 repair_dangling_calls, revive_dangling_calls,
58};