Skip to content

armgit / agtx

Public Imported from GitHub
0

πŸ„πŸΌβ€β™‚οΈ The blackboard for coding agents - agentic development environment for claude code, codex, cursor, opencode, grok and more.

feat: add skill reference trigger in task creation (#23)

Fynn FlΓΌgge14ad4b8b36a6
diff --git a/CLAUDE.md b/CLAUDE.md
index 913101b..25f334d 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -1,6 +1,6 @@
# AGTX - Terminal Kanban for Coding Agents
-A terminal-native kanban board for managing multiple coding agent sessions (Claude Code, Codex, etc.) with isolated git worktrees.
+A terminal-native kanban board for managing multiple coding agent sessions (Claude Code, Codex, Gemini, Copilot, OpenCode) with isolated git worktrees.
## Quick Start
@@ -21,6 +21,7 @@ cargo build --release
src/
β”œβ”€β”€ main.rs # Entry point, CLI arg parsing, AppMode enum
β”œβ”€β”€ lib.rs # Module exports for integration tests
+β”œβ”€β”€ skills.rs # Skill constants, agent-native paths, plugin command translation
β”œβ”€β”€ tui/
β”‚ β”œβ”€β”€ mod.rs # Re-exports
β”‚ β”œβ”€β”€ app.rs # Main App struct, event loop, rendering (largest file)
@@ -44,13 +45,25 @@ src/
β”‚ β”œβ”€β”€ mod.rs # Agent definitions, detection, spawn args
β”‚ └── operations.rs # AgentOperations/CodingAgent traits (mockable)
└── config/
- └── mod.rs # GlobalConfig, ProjectConfig, ThemeConfig
+ └── mod.rs # GlobalConfig, ProjectConfig, ThemeConfig, WorkflowPlugin
+
+skills/ # Built-in skill files (embedded at compile time)
+β”œβ”€β”€ plan.md # Planning phase instructions
+β”œβ”€β”€ execute.md # Execution phase instructions
+β”œβ”€β”€ review.md # Review phase instructions
+└── research.md # Research phase instructions
+
+plugins/ # Bundled plugin configs (embedded at compile time)
+β”œβ”€β”€ gsd/plugin.toml # Get Shit Done workflow
+β”œβ”€β”€ spec-kit/plugin.toml # GitHub spec-kit workflow
+└── void/plugin.toml # Plain agent session, no prompting
tests/
-β”œβ”€β”€ db_tests.rs # Database and model tests
-β”œβ”€β”€ config_tests.rs # Configuration tests
-β”œβ”€β”€ board_tests.rs # Board navigation tests
-β”œβ”€β”€ git_tests.rs # Git worktree tests
+β”œβ”€β”€ db_tests.rs # Database and model tests
+β”œβ”€β”€ config_tests.rs # Configuration tests
+β”œβ”€β”€ board_tests.rs # Board navigation tests
+β”œβ”€β”€ git_tests.rs # Git worktree tests
+β”œβ”€β”€ agent_tests.rs # Agent detection and spawn args tests
β”œβ”€β”€ mock_infrastructure_tests.rs # Mock infrastructure tests
└── shell_popup_tests.rs # Shell popup logic tests
```
@@ -61,21 +74,51 @@ tests/
```
Backlog β†’ Planning β†’ Running β†’ Review β†’ Done
↓ ↓ ↓ ↓
- worktree Claude optional cleanup
- + Claude working PR (keep
- planning (resume) branch)
+ worktree agent optional cleanup
+ + agent working PR (keep
+ planning (resume) branch)
```
- **Backlog**: Task ideas, not started
-- **Planning**: Creates git worktree at `.agtx/worktrees/{slug}`, copies configured files, runs init script, starts Claude Code in planning mode
-- **Running**: Claude is implementing (sends "proceed with implementation")
+- **Planning**: Creates git worktree at `.agtx/worktrees/{slug}`, copies configured files, runs init script, deploys skills, starts agent in planning mode
+- **Running**: Agent is implementing (sends execute command/prompt)
- **Review**: Optionally create PR. Tmux window stays open. Can resume to address feedback
- **Done**: Cleanup worktree + tmux window (branch kept locally)
+### Workflow Plugins
+Plugins customize the task lifecycle per phase. A plugin is a TOML file (`plugin.toml`) that defines:
+- **commands**: Slash commands sent to the agent at each phase (auto-translated per agent)
+- **prompts**: Task content templates with `{task}` and `{task_id}` placeholders
+- **artifacts**: File paths that signal phase completion (supports `*` wildcards)
+- **prompt_triggers**: Text patterns to wait for in tmux before sending prompts
+- **init_script**: Shell command run in worktree before agent starts (`{agent}` placeholder)
+- **copy_dirs**: Extra directories to copy from project root into worktrees
+- **supported_agents**: Agent whitelist (empty = all supported)
+
+Plugin resolution: project-local `.agtx/plugins/{name}/` β†’ global `~/.config/agtx/plugins/{name}/` β†’ bundled.
+
+Each task stores its plugin name in the database at creation time. Switching the project plugin only affects new tasks.
+
+### Skill System
+Skills are markdown files with YAML frontmatter deployed to agent-native discovery paths in worktrees:
+- Claude: `.claude/commands/agtx/plan.md`
+- Gemini: `.gemini/commands/agtx/plan.toml` (converted to TOML format)
+- Codex: `.codex/skills/agtx-plan/SKILL.md`
+- OpenCode: `.config/opencode/command/agtx-plan.md` (frontmatter stripped)
+- Copilot: `.github/agents/agtx/plan.md`
+
+Canonical copy always at `.agtx/skills/agtx-plan/SKILL.md`.
+
+Commands are written once in canonical format (`/ns:command`) and auto-translated:
+- Claude/Gemini: `/ns:command` (unchanged)
+- OpenCode: `/ns-command` (colon β†’ hyphen)
+- Codex: `$ns-command` (slash β†’ dollar, colon β†’ hyphen)
+- Copilot: no interactive skill invocation (falls back to file-path reference in prompt)
+
### Session Persistence
- Tmux window stays open when moving Running β†’ Review
- Resume from Review simply changes status back to Running (window already exists)
-- No special Claude resume logic needed - the session just stays alive in tmux
+- No special resume logic needed - the session just stays alive in tmux
### Database Storage
All databases stored centrally (not in project directories):
@@ -144,6 +187,7 @@ color_popup_header = "#69fae7" # Popup headers (light cyan)
| `m` | Move task forward (advance workflow) |
| `r` | Resume task (Review β†’ Running) |
| `/` | Search tasks (jumps to and opens task) |
+| `P` | Select workflow plugin |
| `e` | Toggle project sidebar |
| `q` | Quit |
@@ -154,7 +198,7 @@ color_popup_header = "#69fae7" # Popup headers (light cyan)
| `Ctrl+d/u` | Page down/up |
| `Ctrl+g` | Jump to bottom |
| `Ctrl+q` or `Esc` | Close popup |
-| Other keys | Forwarded to tmux/Claude |
+| Other keys | Forwarded to tmux/agent |
### PR Creation Popup
| Key | Action |
@@ -196,9 +240,17 @@ color_popup_header = "#69fae7" # Popup headers (light cyan)
- Uses `mpsc` channels to communicate results back to main thread
- Loading spinners shown during async operations
-### Claude Integration
-- Uses `--dangerously-skip-permissions` flag
-- Polls tmux pane for "Yes, I accept" prompt before sending acceptance
+### Phase Status Polling
+- `refresh_sessions()` runs every 100ms, checks artifact files with 2-second cache TTL
+- Three states: Working (spinner), Ready (checkmark), Exited (no window)
+- Phase artifact paths come from the task's plugin or agtx defaults
+- Plugin instances cached per task in `HashMap<Option<String>, Option<WorkflowPlugin>>` to avoid repeated disk reads
+
+### Agent Integration
+- Agents spawned via `build_interactive_command()` in `src/agent/mod.rs`
+- Each agent has its own flags: Claude (`--dangerously-skip-permissions`), Codex (`--approval-mode full-auto`), Gemini (`--approval-mode yolo`), Copilot (`--allow-all-tools`)
+- Skills deployed to agent-native paths via `write_skills_to_worktree()` in app.rs
+- Commands and prompts resolved per-task via `resolve_skill_command()` and `resolve_prompt()`
## Building & Testing
@@ -219,7 +271,6 @@ Dependencies require:
- tmux (runtime dependency)
- git (runtime dependency)
- gh CLI (for PR operations)
-- claude CLI (Claude Code)
## Common Tasks
@@ -236,8 +287,10 @@ Dependencies require:
### Adding a new agent
1. Add to `known_agents()` in `src/agent/mod.rs`
-2. Add spawn args handling in `build_spawn_args()`
-3. Add resume args if supported in `build_resume_args()`
+2. Add `build_interactive_command()` match arm in `src/agent/mod.rs`
+3. Add agent-native skill dir in `agent_native_skill_dir()` in `src/skills.rs`
+4. Add skill invocation format in `skill_invocation_command()` in `src/skills.rs`
+5. Add plugin command transform in `transform_plugin_command()` in `src/skills.rs`
### Adding a keyboard shortcut
1. Find the appropriate `handle_*_key` function in `src/tui/app.rs`
@@ -252,18 +305,25 @@ Dependencies require:
5. Add key handler function `handle_my_popup_key()`
6. Add check in `handle_key()` to route to handler
+### Adding a new bundled plugin
+1. Create `plugins/<name>/plugin.toml` with commands, prompts, artifacts
+2. Add entry to `BUNDLED_PLUGINS` in `src/skills.rs`
+3. Optionally add `supported_agents` to restrict agent compatibility
+
+### Adding custom skills to a plugin
+1. Create `plugins/<name>/skills/agtx-{phase}/SKILL.md` files
+2. Skills use YAML frontmatter: `name: agtx-{phase}`, `description: ...`
+3. Skills are auto-deployed to agent-native paths during worktree setup
+
## Supported Agents
Detected automatically via `known_agents()` in order of preference:
1. **claude** - Anthropic's Claude Code CLI
-2. **aider** - AI pair programming in your terminal
-3. **codex** - OpenAI's Codex CLI
-4. **gh-copilot** - GitHub Copilot CLI
+2. **codex** - OpenAI's Codex CLI
+3. **copilot** - GitHub Copilot CLI
+4. **gemini** - Google Gemini CLI
5. **opencode** - AI-powered coding assistant
-6. **cline** - AI coding assistant for VS Code
-7. **q** - Amazon Q Developer CLI
## Future Enhancements
-- Auto-detect Claude idle status (show spinner when working)
- Reopen Done tasks (recreate worktree from preserved branch)
-- Notification when Claude finishes work
+- Notification when agent finishes work
diff --git a/README.md b/README.md
index e4dc78a..6a50f96 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,21 @@
+<div align="center">
+
# agtx
-#### A terminal-native kanban board for managing coding agent sessions.
+**Terminal-native kanban board for managing spec-driven coding agent sessions. Plugin any existing spec-driven development framework or specify your own workflow with per-phase skills, prompts, artifact tracking and automatic execution.**
+
+</div>
![Xnapper-2026-02-14-09 36 33 (1)](https://github.com/user-attachments/assets/fce21a9c-2fe1-4b14-8f24-55e058531370)
## Features
-- **Kanban workflow**: Backlog β†’ Planning β†’ Running β†’ Review β†’ Done
+- **Kanban workflow**: Backlog/Research β†’ Planning β†’ Running β†’ Review β†’ Done
- **Git worktree and tmux isolation**: Each task gets its own worktree and tmux window, keeping work separated
-- **Coding Agent integrations**: Automatic session management for Claude Code, Codex, Gemini and Copilot CLI
-- **PR workflow**: Generate descriptions with AI, create PRs directly from the TUI
+- **Coding agent integrations**: Automatic session management for Claude Code, Codex, Gemini, Copilot and OpenCode
+- **Spec-driven workflow plugins**: Plug in and select any spec-driven development framework per task β€” or define individual skills, prompts and artifacts - with automatic execution and tracking at each phase
- **Multi-project dashboard**: Manage tasks across all your projects
-- **Workflow plugins**: Swap between built-in, GSD, spec-kit, or void workflows per project
+- **PR workflow**: Generate descriptions with AI, create PRs directly from the TUI
- **Customizable themes**: Configure colors via config file
## Installation
@@ -33,7 +37,7 @@ cp target/release/agtx ~/.local/bin/
- **tmux** - Agent sessions run in a dedicated tmux server
- **gh** - GitHub CLI for PR operations
-- Supported coding agents: [Claude Code](https://github.com/anthropics/claude-code), [Codex](https://github.com/openai/codex), [Gemini](https://github.com/google-gemini/gemini-cli), [Copilot](https://github.com/github/copilot-cli)
+- Supported coding agents: [Claude Code](https://github.com/anthropics/claude-code), [Codex](https://github.com/openai/codex), [Gemini](https://github.com/google-gemini/gemini-cli), [Copilot](https://github.com/github/copilot-cli), [OpenCode](https://github.com/sst/opencode)
## Quick Start
@@ -58,7 +62,7 @@ agtx -g
| `h/l` or `←/β†’` | Move between columns |
| `j/k` or `↑/↓` | Move between tasks |
| `o` | Create new task |
-| `↩` | Open task (view Claude session) |
+| `↩` | Open task (view agent session) |
| `m` | Move task forward in workflow |
| `r` | Resume task (Review β†’ Running) |
| `d` | Show git diff |
@@ -68,42 +72,33 @@ agtx -g
| `e` | Toggle project sidebar |
| `q` | Quit |
-### Task Workflow
+### Task Description Editor
+
+When writing a task description, you can reference files and agent skills inline:
-1. **Create a task** (`o`): Enter title and description
-2. **Move to Planning** (`m`): Creates worktree, starts Claude in planning mode
-3. **Move to Running** (`m`): Claude implements the plan
-4. **Move to Review** (`m`): Opens PR with AI-generated description
-5. **Move to Done** (`m`): Cleans up worktree and tmux after PR is merged
+| Key | Action |
+|-----|--------|
+| `#` or `@` | Fuzzy search and insert a file path |
+| `!` | Fuzzy search and insert an agent skill/command |
+
+**Skill references** (`!`) discover commands from your active agent's native command directory (e.g., `.claude/commands/` for Claude, `.codex/skills/` for Codex). The dropdown shows all available slash commands with descriptions, and inserts them in the agent's native invocation format:
-### Claude Session Features
+```
+/agtx:research the authentication module, then /agtx:plan a fix for the session timeout bug
+```
+
+This includes agtx built-in skills, plugin commands, and any custom user-defined commands.
+
+### Agent Session Features
- Sessions automatically resume when moving Review β†’ Running
- Full conversation context is preserved across the task lifecycle
-- View live Claude output in the task popup
+- View live agent output in the task popup
## Configuration
Config file location: `~/.config/agtx/config.toml`
-```toml
-# Default agent for new tasks
-default_agent = "claude"
-
-[worktree]
-enabled = true
-auto_cleanup = true
-base_branch = "main"
-
-[theme]
-color_selected = "#FFFF99"
-color_normal = "#00FFFF"
-color_dimmed = "#666666"
-color_text = "#FFFFFF"
-color_accent = "#00FFFF"
-color_description = "#E8909C"
-```
-
### Project Configuration
Per-project settings can be placed in `.agtx/config.toml` at the project root:
@@ -117,23 +112,31 @@ copy_files = ".env, .env.local, web/.env.local"
init_script = "scripts/init_worktree.sh"
```
-Both options run during the Backlog β†’ Planning transition, after `git worktree add`
+Both options run during the Backlog β†’ Research/Planning/Running transition, after worktree creation
and before the agent session starts.
-### Workflow Plugins
+## Spec-driven Development Plugins
-Press `P` to select a workflow plugin for the current project. The active plugin is shown in the header bar.
+agtx ships with a plugin system that lets any spec-driven development framework hook into the task lifecycle. A plugin is a single TOML file that defines what happens at each phase transition β€” the commands sent to the agent, the prompts, the artifact files that signal completion, and optional setup scripts. Write a command once in canonical format and agtx translates it automatically for every supported agent.
+
+Press `P` to select a plugin for the current project. The active plugin is shown in the header bar.
| Plugin | Description |
|--------|-------------|
| **agtx** (default) | Built-in workflow with skills and prompts for each phase |
-| **gsd** | Get Shit Done - structured spec-driven development with interactive planning |
-| **spec-kit** | Spec-Driven Development by GitHub - specifications become executable artifacts |
+| **gsd** | [Get Shit Done](https://github.com/fynnfluegge/get-shit-done-cc) - structured spec-driven development with interactive planning |
+| **spec-kit** | [Spec-Driven Development](https://github.com/github/spec-kit) by GitHub - specifications become executable artifacts |
| **void** | Plain agent session - no prompting or skills, task description prefilled in input |
Each task remembers the plugin it was started with. Switching plugins only affects new tasks β€” existing tasks continue using their original plugin throughout their lifecycle.
-#### Agent Compatibility
+### Agent Compatibility
+
+Commands are written once in canonical format and automatically translated per agent:
+
+| Canonical (plugin.toml) | Claude / Gemini | Codex | OpenCode |
+|--------------------------|-----------------|-------|----------|
+| `/agtx:plan` | `/agtx:plan` | `$agtx-plan` | `/agtx-plan` |
| | Claude | Codex | Gemini | Copilot | OpenCode |
|--|:------:|:-----:|:------:|:-------:|:--------:|
@@ -144,11 +147,9 @@ Each task remembers the plugin it was started with. Switching plugins only affec
βœ… Skills, commands, and prompts fully supported Β· 🟑 Prompt only, no interactive skill support Β· ❌ Not supported
-#### Creating a Plugin
-
-Plugins are TOML files that customize the task workflow β€” the commands sent to the agent, the prompts, and the artifact files that signal phase completion.
+### Creating a Plugin
-**Location:** Place your plugin at `.agtx/plugins/<name>/plugin.toml` in your project root (or `~/.config/agtx/plugins/<name>/plugin.toml` for global use). It will appear in the plugin selector (`P`).
+Place your plugin at `.agtx/plugins/<name>/plugin.toml` in your project root (or `~/.config/agtx/plugins/<name>/plugin.toml` for global use). It will appear in the plugin selector automatically.
**Minimal example** β€” a plugin that uses custom slash commands:
@@ -186,7 +187,7 @@ supported_agents = ["claude", "codex", "gemini", "opencode"]
copy_dirs = [".my-plugin"]
# Artifact files that signal phase completion.
-# When detected, the task shows a βœ“ checkmark instead of the spinner.
+# When detected, the task shows a checkmark instead of the spinner.
# Supports * wildcard for one directory level (e.g. "specs/*/plan.md").
# Omitted phases fall back to agtx defaults (.agtx/plan.md, .agtx/execute.md, .agtx/review.md).
[artifacts]
@@ -199,8 +200,8 @@ review = ".my-plugin/review.md"
# Written in canonical format (Claude/Gemini style): /namespace:command
# Automatically transformed per agent:
# Claude/Gemini: /my-plugin:plan (unchanged)
-# OpenCode: /my-plugin-plan (colon β†’ hyphen)
-# Codex: $my-plugin-plan (slash β†’ dollar, colon β†’ hyphen)
+# OpenCode: /my-plugin-plan (colon -> hyphen)
+# Codex: $my-plugin-plan (slash -> dollar, colon -> hyphen)
# Set to "" to skip sending a command for that phase.
[commands]
research = "/my-plugin:research {task}"
@@ -242,7 +243,7 @@ research = "What do you want to build?"
└── agtx-review/SKILL.md
```
-These override the built-in agtx skills and are deployed to agent-native paths (`.claude/commands/`, `.codex/skills/`, etc.) in each worktree.
+These override the built-in agtx skills and are automatically deployed to each agent's native discovery path (`.claude/commands/`, `.codex/skills/`, `.gemini/commands/`, etc.) in every worktree.
## How It Works
@@ -307,6 +308,7 @@ tmux -L agtx attach
### Data Storage
- **Database**: `~/Library/Application Support/agtx/` (macOS) or `~/.local/share/agtx/` (Linux)
+- Config: `~/.config/agtx/config.toml`
- **Worktrees**: `.agtx/worktrees/` in each project
- **Tmux**: Dedicated server `agtx` with per-project sessions
diff --git a/src/db/models.rs b/src/db/models.rs
index d471074..98239cb 100644
--- a/src/db/models.rs
+++ b/src/db/models.rs
@@ -22,6 +22,16 @@ impl TaskStatus {
}
}
+ pub fn display_name(&self) -> &'static str {
+ match self {
+ TaskStatus::Backlog => "backlog/research",
+ TaskStatus::Planning => "planning",
+ TaskStatus::Running => "running",
+ TaskStatus::Review => "review",
+ TaskStatus::Done => "done",
+ }
+ }
+
pub fn from_str(s: &str) -> Option<Self> {
match s {
"backlog" => Some(TaskStatus::Backlog),
diff --git a/src/skills.rs b/src/skills.rs
index f40cfce..87d2f28 100644
--- a/src/skills.rs
+++ b/src/skills.rs
@@ -212,3 +212,161 @@ pub fn extract_description(content: &str) -> Option<String> {
}
None
}
+
+/// Extract description from a markdown file with YAML frontmatter on disk.
+fn extract_description_from_file(path: &std::path::Path) -> Option<String> {
+ let mut buf = vec![0u8; 512];
+ let mut file = std::fs::File::open(path).ok()?;
+ let n = std::io::Read::read(&mut file, &mut buf).ok()?;
+ let content = std::str::from_utf8(&buf[..n]).ok()?;
+ extract_description(content)
+}
+
+/// Extract description from a Gemini TOML command file on disk.
+fn extract_description_from_toml(path: &std::path::Path) -> Option<String> {
+ let mut buf = vec![0u8; 512];
+ let mut file = std::fs::File::open(path).ok()?;
+ let n = std::io::Read::read(&mut file, &mut buf).ok()?;
+ let content = std::str::from_utf8(&buf[..n]).ok()?;
+ for line in content.lines() {
+ let trimmed = line.trim();
+ if let Some(rest) = trimmed.strip_prefix("description") {
+ let rest = rest.trim_start();
+ if let Some(rest) = rest.strip_prefix('=') {
+ let rest = rest.trim();
+ let rest = rest.trim_start_matches('"').trim_end_matches('"');
+ if !rest.is_empty() {
+ return Some(rest.to_string());
+ }
+ }
+ }
+ }
+ None
+}
+
+/// Scan the active agent's native command directory for available skills.
+/// Returns `(command, description)` tuples in agent-native invocation format.
+pub fn scan_agent_skills(agent_name: &str, project_path: &std::path::Path) -> Vec<(String, String)> {
+ let mut results = Vec::new();
+
+ match agent_name {
+ "claude" | "copilot" => {
+ // Namespaced subdirectories with .md files
+ let (base_dir, _) = match agent_native_skill_dir(agent_name) {
+ Some(v) => v,
+ None => return results,
+ };
+ let base = project_path.join(base_dir);
+ let entries = match std::fs::read_dir(&base) {
+ Ok(e) => e,
+ Err(_) => return results,
+ };
+ for ns_entry in entries.flatten() {
+ if !ns_entry.path().is_dir() {
+ continue;
+ }
+ let namespace = ns_entry.file_name().to_string_lossy().to_string();
+ let files = match std::fs::read_dir(ns_entry.path()) {
+ Ok(e) => e,
+ Err(_) => continue,
+ };
+ for file_entry in files.flatten() {
+ let path = file_entry.path();
+ if path.extension().and_then(|e| e.to_str()) != Some("md") {
+ continue;
+ }
+ let stem = match path.file_stem().and_then(|s| s.to_str()) {
+ Some(s) => s.to_string(),
+ None => continue,
+ };
+ let command = format!("/{}:{}", namespace, stem);
+ let description = extract_description_from_file(&path)
+ .unwrap_or_else(|| stem.replace('-', " "));
+ results.push((command, description));
+ }
+ }
+ }
+ "gemini" => {
+ // Namespaced subdirectories with .toml files
+ let (base_dir, _) = match agent_native_skill_dir(agent_name) {
+ Some(v) => v,
+ None => return results,
+ };
+ let base = project_path.join(base_dir);
+ let entries = match std::fs::read_dir(&base) {
+ Ok(e) => e,
+ Err(_) => return results,
+ };
+ for ns_entry in entries.flatten() {
+ if !ns_entry.path().is_dir() {
+ continue;
+ }
+ let namespace = ns_entry.file_name().to_string_lossy().to_string();
+ let files = match std::fs::read_dir(ns_entry.path()) {
+ Ok(e) => e,
+ Err(_) => continue,
+ };
+ for file_entry in files.flatten() {
+ let path = file_entry.path();
+ if path.extension().and_then(|e| e.to_str()) != Some("toml") {
+ continue;
+ }
+ let stem = match path.file_stem().and_then(|s| s.to_str()) {
+ Some(s) => s.to_string(),
+ None => continue,
+ };
+ let command = format!("/{}:{}", namespace, stem);
+ let description = extract_description_from_toml(&path)
+ .unwrap_or_else(|| stem.replace('-', " "));
+ results.push((command, description));
+ }
+ }
+ }
+ "codex" => {
+ // Skill subdirectories with SKILL.md
+ let base = project_path.join(".codex/skills");
+ let entries = match std::fs::read_dir(&base) {
+ Ok(e) => e,
+ Err(_) => return results,
+ };
+ for dir_entry in entries.flatten() {
+ if !dir_entry.path().is_dir() {
+ continue;
+ }
+ let dirname = dir_entry.file_name().to_string_lossy().to_string();
+ let skill_file = dir_entry.path().join("SKILL.md");
+ if skill_file.exists() {
+ let command = format!("${}", dirname);
+ let description = extract_description_from_file(&skill_file)
+ .unwrap_or_else(|| dirname.replace('-', " "));
+ results.push((command, description));
+ }
+ }
+ }
+ "opencode" => {
+ // Flat directory with .md files
+ let base = project_path.join(".config/opencode/command");
+ let entries = match std::fs::read_dir(&base) {
+ Ok(e) => e,
+ Err(_) => return results,
+ };
+ for file_entry in entries.flatten() {
+ let path = file_entry.path();
+ if path.extension().and_then(|e| e.to_str()) != Some("md") {
+ continue;
+ }
+ let stem = match path.file_stem().and_then(|s| s.to_str()) {
+ Some(s) => s.to_string(),
+ None => continue,
+ };
+ let command = format!("/{}", stem);
+ let description = stem.replace('-', " ");
+ results.push((command, description));
+ }
+ }
+ _ => {} // Copilot has no interactive invocation, unknown agents skipped
+ }
+
+ results.sort_by(|a, b| a.0.cmp(&b.0));
+ results
+}
diff --git a/src/tui/app.rs b/src/tui/app.rs
index eb97b93..ea30389 100644
--- a/src/tui/app.rs
+++ b/src/tui/app.rs
@@ -46,7 +46,7 @@ fn build_footer_text(input_mode: InputMode, sidebar_focused: bool, selected_colu
}
}
InputMode::InputTitle => " Enter task title... [Esc] cancel [Enter] next ".to_string(),
- InputMode::InputDescription => " Enter prompt for agent... [#] file search [Esc] cancel [\\+Enter] newline [Enter] save ".to_string(),
+ InputMode::InputDescription => " Enter prompt for agent... [#] file search [!] skills [Esc] cancel [\\+Enter] newline [Enter] save ".to_string(),
}
}
@@ -94,8 +94,10 @@ struct AppState {
shell_popup: Option<ShellPopup>,
// File search dropdown
file_search: Option<FileSearchState>,
- // File paths inserted via file search (for highlighting)
- highlighted_file_paths: HashSet<String>,
+ // Skill search dropdown
+ skill_search: Option<SkillSearchState>,
+ // References inserted via file search or skill search (for highlighting)
+ highlighted_references: HashSet<String>,
// Task search popup
task_search: Option<TaskSearchState>,
// PR creation confirmation popup
@@ -201,6 +203,23 @@ struct FileSearchState {
trigger_char: char, // The character that triggered the search (# or @)
}
+/// A discovered skill command from an agent's native directory
+#[derive(Debug, Clone)]
+struct SkillEntry {
+ command: String, // agent-native: "/agtx:plan" or "$agtx-plan"
+ description: String, // from frontmatter or file stem
+}
+
+/// State for skill search dropdown (triggered by `!`)
+#[derive(Debug, Clone)]
+struct SkillSearchState {
+ pattern: String,
+ matches: Vec<SkillEntry>,
+ all_skills: Vec<SkillEntry>, // cached full list for re-filtering
+ selected: usize,
+ start_pos: usize, // cursor position where `!` was typed
+}
+
/// State for delete confirmation popup
#[derive(Debug, Clone)]
struct DeleteConfirmPopup {
@@ -321,7 +340,8 @@ impl App {
show_project_list: false,
shell_popup: None,
file_search: None,
- highlighted_file_paths: HashSet::new(),
+ skill_search: None,
+ highlighted_references: HashSet::new(),
task_search: None,
pr_confirm_popup: None,
review_to_running_task_id: None,
@@ -508,7 +528,7 @@ impl App {
let is_selected_column = state.board.selected_column == i;
- let title = format!(" {} ({}) ", status.as_str(), tasks.len());
+ let title = format!(" {} ({}) ", status.display_name(), tasks.len());
let (border_style, title_style) = if is_selected_column {
(
Style::default().fg(hex_to_color(&state.config.theme.color_selected)),
@@ -661,8 +681,8 @@ impl App {
format!("{}{}β–ˆ{}", label, before_cursor, after_cursor)
};
- let styled_text = if state.input_mode == InputMode::InputDescription && !state.highlighted_file_paths.is_empty() {
- build_highlighted_text(&full_text, &state.highlighted_file_paths, text_color, highlight_color)
+ let styled_text = if state.input_mode == InputMode::InputDescription && !state.highlighted_references.is_empty() {
+ build_highlighted_text(&full_text, &state.highlighted_references, text_color, highlight_color)
} else {
Text::raw(full_text)
};
@@ -725,6 +745,71 @@ impl App {
frame.render_widget(list, dropdown_area);
}
}
+
+ // Skill search dropdown
+ if let Some(ref search) = state.skill_search {
+ if !search.matches.is_empty() {
+ let dropdown_height = (search.matches.len() as u16 + 2).min(12);
+ let dropdown_area = Rect {
+ x: input_area.x + 2,
+ y: input_area.y + input_area.height,
+ width: input_area.width.saturating_sub(4),
+ height: dropdown_height,
+ };
+
+ let dropdown_area = if dropdown_area.y + dropdown_area.height > area.height {
+ Rect {
+ y: input_area.y.saturating_sub(dropdown_height),
+ ..dropdown_area
+ }
+ } else {
+ dropdown_area
+ };
+
+ frame.render_widget(Clear, dropdown_area);
+
+ let skill_selected_color = hex_to_color(&state.config.theme.color_selected);
+ let accent_color = hex_to_color(&state.config.theme.color_accent);
+ let dimmed_color = hex_to_color(&state.config.theme.color_dimmed);
+ let items: Vec<ListItem> = search.matches
+ .iter()
+ .enumerate()
+ .map(|(i, entry)| {
+ let style = if i == search.selected {
+ Style::default().bg(skill_selected_color).fg(Color::Black)
+ } else {
+ Style::default()
+ };
+ let cmd_style = if i == search.selected {
+ Style::default().bg(skill_selected_color).fg(Color::Black)
+ } else {
+ Style::default().fg(accent_color)
+ };
+ let desc_style = if i == search.selected {
+ Style::default().bg(skill_selected_color).fg(Color::Black)
+ } else {
+ Style::default().fg(dimmed_color)
+ };
+ // Pad command to align descriptions
+ let cmd_padded = format!(" {:<24}", entry.command);
+ let line = Line::from(vec![
+ Span::styled(cmd_padded, cmd_style),
+ Span::styled(&entry.description, desc_style),
+ ]);
+ ListItem::new(line).style(style)
+ })
+ .collect();
+
+ let list = List::new(items)
+ .block(
+ Block::default()
+ .title(" Skills [↑↓] select [Tab/Enter] insert [Esc] cancel ")
+ .borders(Borders::ALL)
+ .border_style(Style::default().fg(Color::Cyan)),
+ );
+ frame.render_widget(list, dropdown_area);
+ }
+ }
}
// Shell popup overlay
@@ -2219,6 +2304,12 @@ impl App {
KeyCode::Char('f') if has_alt => {
self.state.input_cursor = word_boundary_right(&self.state.input_buffer, self.state.input_cursor);
}
+ // Alt+Backspace: delete word backward (macOS Option+Delete)
+ KeyCode::Backspace if has_alt => {
+ let new_pos = word_boundary_left(&self.state.input_buffer, self.state.input_cursor);
+ self.state.input_buffer.drain(new_pos..self.state.input_cursor);
+ self.state.input_cursor = new_pos;
+ }
KeyCode::Left => {
if self.state.input_cursor > 0 {
self.state.input_cursor -= 1;
@@ -2256,6 +2347,75 @@ impl App {
}
fn handle_description_input(&mut self, key: crossterm::event::KeyEvent) -> Result<()> {
+ // Handle skill search mode if active
+ if let Some(ref mut search) = self.state.skill_search {
+ match key.code {
+ KeyCode::Esc => {
+ // Cancel skill search, remove `!` + pattern from buffer
+ let remove_end = search.start_pos + 1 + search.pattern.len();
+ let suffix = self.state.input_buffer[remove_end..].to_string();
+ self.state.input_buffer.truncate(search.start_pos);
+ self.state.input_buffer.push_str(&suffix);
+ self.state.input_cursor = search.start_pos;
+ self.state.skill_search = None;
+ }
+ KeyCode::Enter | KeyCode::Tab => {
+ if let Some(entry) = search.matches.get(search.selected).cloned() {
+ // Replace `!` + pattern with the full command
+ let pattern_end = search.start_pos + 1 + search.pattern.len();
+ let suffix = self.state.input_buffer[pattern_end..].to_string();
+ self.state.input_buffer.truncate(search.start_pos);
+ self.state.input_buffer.push_str(&entry.command);
+ self.state.input_cursor = self.state.input_buffer.len();
+ self.state.input_buffer.push_str(&suffix);
+ self.state.highlighted_references.insert(entry.command);
+ }
+ self.state.skill_search = None;
+ }
+ KeyCode::Up => {
+ if search.selected > 0 {
+ search.selected -= 1;
+ }
+ }
+ KeyCode::Down => {
+ if search.selected < search.matches.len().saturating_sub(1) {
+ search.selected += 1;
+ }
+ }
+ KeyCode::Char('k') | KeyCode::Char('p') if key.modifiers.contains(crossterm::event::KeyModifiers::CONTROL) => {
+ if search.selected > 0 {
+ search.selected -= 1;
+ }
+ }
+ KeyCode::Char('j') | KeyCode::Char('n') if key.modifiers.contains(crossterm::event::KeyModifiers::CONTROL) => {
+ if search.selected < search.matches.len().saturating_sub(1) {
+ search.selected += 1;
+ }
+ }
+ KeyCode::Backspace => {
+ if search.pattern.is_empty() {
+ // Cancel search if pattern is empty
+ self.state.input_buffer.remove(search.start_pos); // Remove the `!`
+ self.state.input_cursor = search.start_pos;
+ self.state.skill_search = None;
+ } else {
+ search.pattern.pop();
+ self.state.input_cursor = self.state.input_cursor.saturating_sub(1);
+ self.state.input_buffer.remove(self.state.input_cursor);
+ self.update_skill_search_matches();
+ }
+ }
+ KeyCode::Char(c) => {
+ search.pattern.push(c);
+ self.state.input_buffer.insert(self.state.input_cursor, c);
+ self.state.input_cursor += 1;
+ self.update_skill_search_matches();
+ }
+ _ => {}
+ }
+ return Ok(());
+ }
+
// Handle file search mode if active
if let Some(ref mut search) = self.state.file_search {
match key.code {
@@ -2273,7 +2433,7 @@ impl App {
self.state.input_buffer.push_str(&selected_file);
self.state.input_cursor = self.state.input_buffer.len();
self.state.input_buffer.push_str(&suffix);
- self.state.highlighted_file_paths.insert(selected_file);
+ self.state.highlighted_references.insert(selected_file);
}
self.state.file_search = None;
}
@@ -2328,7 +2488,8 @@ impl App {
self.state.input_cursor = 0;
self.state.pending_task_title.clear();
self.state.editing_task_id = None;
- self.state.highlighted_file_paths.clear();
+ self.state.highlighted_references.clear();
+ self.state.skill_search = None;
}
KeyCode::Enter => {
// Check if line ends with backslash for line continuation
@@ -2345,7 +2506,8 @@ impl App {
self.state.input_cursor = 0;
self.state.pending_task_title.clear();
self.state.editing_task_id = None;
- self.state.highlighted_file_paths.clear();
+ self.state.highlighted_references.clear();
+ self.state.skill_search = None;
}
}
KeyCode::Left if key.modifiers.contains(crossterm::event::KeyModifiers::ALT) => {
@@ -2361,6 +2523,12 @@ impl App {
KeyCode::Char('f') if key.modifiers.contains(crossterm::event::KeyModifiers::ALT) => {
self.state.input_cursor = word_boundary_right(&self.state.input_buffer, self.state.input_cursor);
}
+ // Alt+Backspace: delete word backward (macOS Option+Delete)
+ KeyCode::Backspace if key.modifiers.contains(crossterm::event::KeyModifiers::ALT) => {
+ let new_pos = word_boundary_left(&self.state.input_buffer, self.state.input_cursor);
+ self.state.input_buffer.drain(new_pos..self.state.input_cursor);
+ self.state.input_cursor = new_pos;
+ }
KeyCode::Left => {
if self.state.input_cursor > 0 {
self.state.input_cursor -= 1;
@@ -2403,6 +2571,29 @@ impl App {
});
self.update_file_search_matches();
}
+ KeyCode::Char('!') => {
+ // Start skill search at cursor position
+ let start_pos = self.state.input_cursor;
+ self.state.input_buffer.insert(self.state.input_cursor, '!');
+ self.state.input_cursor += 1;
+
+ let all_skills = if let Some(ref project_path) = self.state.project_path {
+ skills::scan_agent_skills(&self.state.config.default_agent, project_path)
+ .into_iter()
+ .map(|(command, description)| SkillEntry { command, description })
+ .collect()
+ } else {
+ vec![]
+ };
+
+ self.state.skill_search = Some(SkillSearchState {
+ pattern: String::new(),
+ matches: all_skills.clone(),
+ all_skills,
+ selected: 0,
+ start_pos,
+ });
+ }
KeyCode::Char(c) => {
self.state.input_buffer.insert(self.state.input_cursor, c);
self.state.input_cursor += 1;
@@ -2420,6 +2611,27 @@ impl App {
}
}
+ fn update_skill_search_matches(&mut self) {
+ if let Some(ref mut search) = self.state.skill_search {
+ let pattern = search.pattern.to_lowercase();
+ if pattern.is_empty() {
+ search.matches = search.all_skills.clone();
+ } else {
+ let mut scored: Vec<_> = search.all_skills.iter()
+ .filter_map(|entry| {
+ let cmd_score = fuzzy_score(&entry.command.to_lowercase(), &pattern);
+ let desc_score = fuzzy_score(&entry.description.to_lowercase(), &pattern);
+ let score = std::cmp::max(cmd_score, desc_score);
+ if score > 0 { Some((entry.clone(), score)) } else { None }
+ })
+ .collect();
+ scored.sort_by(|a, b| b.1.cmp(&a.1));
+ search.matches = scored.into_iter().take(10).map(|(e, _)| e).collect();
+ }
+ search.selected = 0;
+ }
+ }
+
fn save_task(&mut self) -> Result<()> {
if let Some(db) = &self.state.db {
if let Some(task_id) = &self.state.editing_task_id {
diff --git a/src/tui/app_tests.rs b/src/tui/app_tests.rs
index af4fc65..882f9c9 100644
--- a/src/tui/app_tests.rs
+++ b/src/tui/app_tests.rs
@@ -2256,3 +2256,104 @@ fn test_resolve_prompt_trigger_empty_string_filtered() {
// Empty strings should be filtered out
assert_eq!(resolve_prompt_trigger(&plugin, "research"), None);
}
+
+#[test]
+fn test_scan_agent_skills_claude() {
+ let dir = tempfile::tempdir().unwrap();
+ let base = dir.path();
+ // Create .claude/commands/agtx/plan.md with frontmatter
+ let cmd_dir = base.join(".claude/commands/agtx");
+ std::fs::create_dir_all(&cmd_dir).unwrap();
+ std::fs::write(
+ cmd_dir.join("plan.md"),
+ "---\nname: agtx-plan\ndescription: Plan a task implementation\n---\nBody here\n",
+ ).unwrap();
+ std::fs::write(
+ cmd_dir.join("execute.md"),
+ "---\nname: agtx-execute\ndescription: Execute the plan\n---\nBody\n",
+ ).unwrap();
+
+ let results = crate::skills::scan_agent_skills("claude", base);
+ assert_eq!(results.len(), 2);
+ assert_eq!(results[0].0, "/agtx:execute");
+ assert_eq!(results[0].1, "Execute the plan");
+ assert_eq!(results[1].0, "/agtx:plan");
+ assert_eq!(results[1].1, "Plan a task implementation");
+}
+
+#[test]
+fn test_scan_agent_skills_codex() {
+ let dir = tempfile::tempdir().unwrap();
+ let base = dir.path();
+ // Create .codex/skills/agtx-plan/SKILL.md
+ let skill_dir = base.join(".codex/skills/agtx-plan");
+ std::fs::create_dir_all(&skill_dir).unwrap();
+ std::fs::write(
+ skill_dir.join("SKILL.md"),
+ "---\nname: agtx-plan\ndescription: Plan implementation\n---\nContent\n",
+ ).unwrap();
+
+ let results = crate::skills::scan_agent_skills("codex", base);
+ assert_eq!(results.len(), 1);
+ assert_eq!(results[0].0, "$agtx-plan");
+ assert_eq!(results[0].1, "Plan implementation");
+}
+
+#[test]
+fn test_scan_agent_skills_gemini() {
+ let dir = tempfile::tempdir().unwrap();
+ let base = dir.path();
+ let cmd_dir = base.join(".gemini/commands/agtx");
+ std::fs::create_dir_all(&cmd_dir).unwrap();
+ std::fs::write(
+ cmd_dir.join("plan.toml"),
+ "description = \"Plan a task\"\n\nprompt = \"\"\"Do the planning\"\"\"\n",
+ ).unwrap();
+
+ let results = crate::skills::scan_agent_skills("gemini", base);
+ assert_eq!(results.len(), 1);
+ assert_eq!(results[0].0, "/agtx:plan");
+ assert_eq!(results[0].1, "Plan a task");
+}
+
+#[test]
+fn test_scan_agent_skills_opencode() {
+ let dir = tempfile::tempdir().unwrap();
+ let base = dir.path();
+ let cmd_dir = base.join(".config/opencode/command");
+ std::fs::create_dir_all(&cmd_dir).unwrap();
+ std::fs::write(cmd_dir.join("agtx-plan.md"), "Plan content\n").unwrap();
+
+ let results = crate::skills::scan_agent_skills("opencode", base);
+ assert_eq!(results.len(), 1);
+ assert_eq!(results[0].0, "/agtx-plan");
+ assert_eq!(results[0].1, "agtx plan"); // humanized stem
+}
+
+#[test]
+fn test_scan_agent_skills_empty() {
+ let dir = tempfile::tempdir().unwrap();
+ // No command directories exist
+ let results = crate::skills::scan_agent_skills("claude", dir.path());
+ assert!(results.is_empty());
+}
+
+#[test]
+fn test_scan_agent_skills_unknown_agent() {
+ let dir = tempfile::tempdir().unwrap();
+ let results = crate::skills::scan_agent_skills("unknown-agent", dir.path());
+ assert!(results.is_empty());
+}
+
+#[test]
+fn test_skill_fuzzy_matching() {
+ // Test that fuzzy_score works for skill matching
+ let score_plan = fuzzy_score("/agtx:plan", "plan");
+ let score_exec = fuzzy_score("/agtx:execute", "plan");
+ assert!(score_plan > 0);
+ assert!(score_plan > score_exec);
+
+ // Matching on description
+ let score_desc = fuzzy_score("plan a task implementation", "plan");
+ assert!(score_desc > 0);
+}