This file provides guidelines for AI agents working with the Cortex CLI plugin documentation.
plugins-docs/
├── README.md # Main index with links
├── AGENTS.md # This file
├── getting-started/
│ ├── overview.md # Plugin system overview
│ ├── quick-start.md # Create first plugin
│ └── plugin-structure.md # Directory layout
├── reference/
│ ├── manifest.md # plugin.toml reference
│ ├── capabilities.md # Capability types
│ ├── permissions.md # Permission types
│ ├── commands.md # Custom commands
│ ├── hooks.md # Hook types
│ ├── events.md # Event types
│ ├── api.md # Plugin API
│ ├── configuration.md # System config
│ └── cli-commands.md # CLI usage
├── guides/
│ ├── development.md # Building plugins
│ ├── best-practices.md # Security, performance
│ └── troubleshooting.md # Common issues
└── examples/
└── README.md # Example plugins
- Plugins are WASM-based for security and portability
- Run in isolated sandboxes
- Must declare capabilities and permissions
- Can add commands, hooks, and event handlers
plugin.toml- Plugin manifest (required)plugin.wasm- Compiled WASM module
~/.cortex/plugins/- Global plugins~/.config/cortex/plugins/- Config directory./.cortex/plugins/- Project-local
- Keep files focused - One topic per file
- Use consistent headers - H1 for title, H2 for sections
- Include examples - Code samples for all features
- Link related docs - Cross-reference other pages
- Update README.md - Add new pages to index
Always provide complete, working examples:
# Good: Complete manifest example
[plugin]
id = "example"
name = "Example"
version = "1.0.0"
capabilities = ["commands"]
[[commands]]
name = "example"
description = "Example command"Use tables for reference material:
| Field | Type | Required | Description |
|---|---|---|---|
id |
string | ✅ | Unique identifier |
name |
string | ✅ | Display name |
- Document in
reference/hooks.md - Add to hook types table
- Include input/output fields
- Provide example
- Document in
reference/permissions.md - Add to permission types section
- Include TOML syntax example
- Note required capabilities
- Document in
reference/events.md - Add JSON example
- List event fields
The plugin system implementation is in:
cortex-plugins/src/- Plugin system cratecortex-plugins/src/manifest.rs- Manifest parsingcortex-plugins/src/hooks.rs- Hook typescortex-plugins/src/events.rs- Event typescortex-plugins/src/api.rs- Plugin APIcortex-cli/src/plugin_cmd.rs- CLI commands
When updating documentation:
- Verify code examples compile/work
- Check all links are valid
- Ensure consistency with implementation
- Test CLI commands mentioned
- Use backticks for
code, commands, and file names - Use bold for important terms on first use
- Use bullet points for lists
- Keep paragraphs short (3-5 sentences max)
- Include "Next Steps" sections
- The plugin documentation is separate from main AGENTS.md
- Plugin source is in
cortex-plugins/crate - CLI plugin commands are in
cortex-cli/src/plugin_cmd.rs - Always check implementation matches documentation
- Update docs when plugin system changes