fabro/crates/agent/src/lib.rs
Bryan Helmkamp 3d39e06c29 Add skills system for reusable prompt templates
Skills are markdown files with YAML frontmatter that define reusable
prompt templates (e.g., /commit, /review-pr). When a user references
/skill-name in their input, the skill template expands in place with
{{user_input}} receiving the remaining text.

- Add skills.rs with parse, expand, discover, and formatting functions
- Discover skills from ~/.attractor/skills/, <git-root>/.attractor/skills/,
  and <git-root>/skills/ (overridable with --skills-dir CLI flag)
- Inject available skills into system prompt between project docs and
  user instructions
- Expand skill references in session input before recording user turn

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 2a8ed77f26c5
2026-02-25 11:32:07 -05:00

49 lines
1.6 KiB
Rust

#[cfg(feature = "docker")]
pub mod docker_env;
pub mod cli;
pub mod config;
pub mod error;
pub mod event;
pub mod execution_env;
pub mod history;
pub mod local_env;
pub mod loop_detection;
pub mod profiles;
pub mod project_docs;
pub mod read_before_write_env;
pub mod skills;
pub mod provider_profile;
pub mod session;
pub mod subagent;
pub mod tool_registry;
pub mod tools;
pub mod truncation;
pub mod types;
pub use config::{SessionConfig, ToolApprovalFn};
pub use error::AgentError;
pub use event::EventEmitter;
pub use execution_env::{format_lines_numbered, DirEntry, ExecResult, ExecutionEnvironment, GrepOptions};
pub use history::History;
#[cfg(feature = "docker")]
pub use docker_env::{DockerConfig, DockerExecutionEnvironment};
pub use local_env::LocalExecutionEnvironment;
pub use loop_detection::detect_loop;
pub use read_before_write_env::ReadBeforeWriteEnvironment;
pub use project_docs::discover_project_docs;
pub use skills::Skill;
pub use profiles::{AnthropicProfile, EnvContext, GeminiProfile, OpenAiProfile};
pub use provider_profile::{ProfileCapabilities, ProviderProfile};
pub use session::Session;
pub use subagent::{SubAgent, SubAgentManager, SubAgentResult};
pub use tool_registry::ToolRegistry;
pub use tools::{
make_edit_file_tool, make_glob_tool, make_grep_tool, make_read_file_tool, make_shell_tool,
make_shell_tool_with_config, make_write_file_tool,
};
pub use truncation::{truncate_lines, truncate_output, truncate_tool_output, TruncationMode};
pub use types::{AgentEvent, SessionEvent, SessionState, Turn};
#[cfg(test)]
pub(crate) mod test_support;