Skip to content

Conversation

@terraboops
Copy link
Collaborator

This commit introduces a comprehensive skills system that enhances the
existing tools infrastructure with metadata support, validation, and
CLI management commands.

Core Changes:

  1. Enhanced Tools System (src/tools.rs):

    • Added SkillMetadata struct with version, author, dependencies, categories
    • Updated Tool struct to include metadata field
    • Implemented skill validation (validate_skill_schema)
    • Added dependency checking (check_skill_dependencies, validate_dependencies)
    • Added skill query functions (skills_by_category, search_skills)
    • Added skill info formatting (format_skill_info)
    • All changes are backward compatible - existing tools work unchanged
  2. CLI Integration (src/cli.rs):

    • Added SkillsCommand enum with List, Info, Validate, Run subcommands
    • Extended Cli struct with skills_command field
    • Updated parser to handle "chibi skills" subcommands
    • Updated help text with skills management section
  3. Main Command Handler (src/main.rs):

    • Implemented skills list command with optional category filtering
    • Implemented skills info command with detailed output
    • Implemented skills validate command with comprehensive checks
    • Implemented skills run command for manual skill execution
    • Skills commands run early in the command chain (no context needed)
  4. Documentation:

    • Added "Skills System" section to README.md
    • Created comprehensive SKILL_AUTHORING.md guide covering:
      • Skill interface requirements
      • Metadata field descriptions and use cases
      • Environment variables reference
      • Complete examples (bash, python)
      • Hook integration patterns
      • Best practices and security considerations
      • Testing and troubleshooting guides
  5. Example Skills (examples/tools/):

    • hello_skill: Basic greeting skill demonstrating metadata
    • fetch_url_skill: URL fetcher demonstrating categories and dependencies

Features:

  • Skill metadata is optional - existing tools continue to work
  • Dependency validation warns about missing requirements
  • Category-based filtering for skill organization
  • Comprehensive validation before skill installation
  • Manual skill execution for testing
  • Full backward compatibility maintained

Usage Examples:

chibi skills list # List all skills
chibi skills list --category network # Filter by category
chibi skills info read_file # Show detailed info
chibi skills validate ./new_skill.sh # Validate before installing
chibi skills run hello_skill '{"name": "Alice"}' # Manual execution

Technical Notes:

  • No new dependencies added (uses existing serde, std)
  • Follows existing error handling patterns (io::Error)
  • Matches existing code style and conventions
  • Compiles cleanly with cargo check

@terraboops terraboops requested a review from emesal January 20, 2026 04:40
@terraboops terraboops force-pushed the claude/add-agent-skills-jm8ay branch from 60aa0ed to 01551e6 Compare January 21, 2026 06:03
Document the agent-skills plugin which provides:
- Support for agentskills.io standard
- Skill installation from GitHub marketplaces
- Progressive disclosure of specialized knowledge
- Tool restriction enforcement via allowed-tools
- Multi-tool plugin support

The plugin itself lives in ~/.chibi/plugins/agent-skills/ and is
installed locally on each system.
@terraboops terraboops force-pushed the claude/add-agent-skills-jm8ay branch from 01551e6 to 4b04762 Compare January 21, 2026 06:21
Implements the Agent Skills specification as a Python plugin with:
- Main executable using uv for dependency management (pyyaml)
- SKILL.md parser with YAML frontmatter validation
- GitHub marketplace integration with sparse checkout
- Active skill state tracking for tool restrictions
- Multi-tool plugin support (dynamic tool generation)
- Security: path traversal protection, script sandboxing, timeouts

Plugin provides:
- skill_marketplace: install/remove/search/list skills
- read_skill_file: read files from skill directories
- run_skill_script: execute scripts with timeout protection
- skill_[name]: one tool per installed skill

Includes example-skill demonstrating the format.

Users install with:
  cp -r examples/plugins/agent-skills ~/.chibi/plugins/
  chmod +x ~/.chibi/plugins/agent-skills/agent-skills
@terraboops
Copy link
Collaborator Author

Closing this to do inside chibi-plugins, I guess 😅

@terraboops terraboops closed this Jan 21, 2026
@emesal emesal deleted the claude/add-agent-skills-jm8ay branch January 21, 2026 21:30
emesal added a commit that referenced this pull request Jan 25, 2026
1. New Module: src/safe_io.rs

Created a reusable module providing:
- atomic_write_json() - Write JSON atomically (temp file + fsync +
  rename)
- atomic_write() - Write bytes atomically
- FileLock - RAII file locking wrapper using fs2

This establishes the foundation for Issue #15 (unified safe file
operations).

2. Issue #4: Config Validation (partition.rs:132-172)

Added minimum value guards to StorageConfig methods:
- max_entries() → .max(1) - prevents infinite loops
- max_tokens() → .max(1) - prevents infinite loops
- bytes_per_token() → .max(1) - prevents divide-by-zero
- max_age_seconds() → .max(60) - minimum 1 minute prevents excessive
  rotation

3. Issue #3: Atomic Manifest Writes (partition.rs:439-445)

Replaced direct file write in save_manifest() with
safe_io::atomic_write_json(). This prevents
manifest corruption from crashes during write operations.

4. Issue #2: File Locking (partition.rs:362-368, 489-491, 577-578)

Added file locking to partition write operations:
- Added lock_path() helper returning .transcript.lock
- append_entry() now acquires exclusive lock before writing
- rotate() now acquires exclusive lock before rotating

5. Issue #1: Performance Caching (partition.rs, state/mod.rs)

Made ActiveState public with Clone, added caching support:
- PartitionManager::load_with_cached_state() - load with optional cached
  state
- PartitionManager::active_state() - getter for caching
- AppState.active_state_cache: RefCell<HashMap<String, ActiveState>> -
  per-context cache
- Updated append_to_transcript() to use/update cache
- Cache invalidation in clear_context(), clear_context_by_name(),
  finalize_compaction(), and destroy_context()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants