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.

refactor: extract agtx built-in defaults into plugin.toml (#27)

Fynn FlΓΌgged93b1c11602e
diff --git a/plugins/agtx/plugin.toml b/plugins/agtx/plugin.toml
new file mode 100644
index 0000000..9969afe
--- /dev/null
+++ b/plugins/agtx/plugin.toml
@@ -0,0 +1,16 @@
+name = "agtx"
+description = "Built-in workflow with skills and prompts"
+
+[artifacts]
+research = ".agtx/research.md"
+planning = ".agtx/plan.md"
+running = ".agtx/execute.md"
+review = ".agtx/review.md"
+
+[commands]
+# Unset β€” uses agent-native skill invocation (/agtx:plan, $agtx-plan, etc.)
+
+[prompts]
+research = "Task: {task}"
+planning = "Task: {task}"
+running_direct = "Task: {task}"
diff --git a/skills/execute.md b/plugins/agtx/skills/execute.md
similarity index 67%
rename from skills/execute.md
rename to plugins/agtx/skills/execute.md
index a00d420..f088697 100644
--- a/skills/execute.md
+++ b/plugins/agtx/skills/execute.md
@@ -5,12 +5,14 @@ description: Execute an approved implementation plan. Implement the changes, the
# Execution Phase
-You are in the **execution phase** of an agtx-managed task. Your plan has been approved.
+You are in the **execution phase** of an agtx-managed task.
## Instructions
-1. Read your plan from `.agtx/plan.md`
-2. Implement the changes described in the plan
+1. Check if `.agtx/plan.md` exists:
+ - **If it exists**: read it β€” it contains the approved implementation plan. Proceed to step 2.
+ - **If it does not exist**: **wait for the next message** β€” it contains the task description. Do not proceed until you receive it.
+2. Implement the changes
3. Run relevant tests to verify your changes
4. Fix any issues found during testing
diff --git a/skills/plan.md b/plugins/agtx/skills/plan.md
similarity index 78%
rename from skills/plan.md
rename to plugins/agtx/skills/plan.md
index 437ad96..d035461 100644
--- a/skills/plan.md
+++ b/plugins/agtx/skills/plan.md
@@ -9,8 +9,9 @@ You are in the **planning phase** of an agtx-managed task.
## Instructions
-1. **Wait for the next message** β€” it contains the task title, description, and context. Do not start working until you receive it.
-2. Read and understand the task description
+1. Check if `.agtx/research.md` exists:
+ - **If it exists**: read it first β€” it contains the task description and prior analysis. Proceed to step 2.
+ - **If it does not exist**: **wait for the next message** β€” it contains the task description. Do not proceed until you receive it.
3. Explore the codebase to understand relevant files, patterns, and architecture
4. Identify all files that need to be created or modified
5. Create a detailed implementation plan
diff --git a/skills/research.md b/plugins/agtx/skills/research.md
similarity index 100%
rename from skills/research.md
rename to plugins/agtx/skills/research.md
diff --git a/skills/review.md b/plugins/agtx/skills/review.md
similarity index 100%
rename from skills/review.md
rename to plugins/agtx/skills/review.md
diff --git a/plugins/gsd/plugin.toml b/plugins/gsd/plugin.toml
index b39aafe..65181f3 100644
--- a/plugins/gsd/plugin.toml
+++ b/plugins/gsd/plugin.toml
@@ -19,9 +19,6 @@ review = "/gsd:verify-work 1"
[prompts]
research = "Task: {task}"
-planning = ""
-running = ""
-review = ""
[prompt_triggers]
research = "What do you want to build?"
diff --git a/plugins/spec-kit/plugin.toml b/plugins/spec-kit/plugin.toml
index 683ac69..8ce7290 100644
--- a/plugins/spec-kit/plugin.toml
+++ b/plugins/spec-kit/plugin.toml
@@ -18,7 +18,3 @@ running = "/speckit.implement"
review = "/speckit.analyze"
[prompts]
-research = ""
-planning = ""
-running = ""
-review = ""
diff --git a/src/config/mod.rs b/src/config/mod.rs
index d71052d..887f5b3 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -430,7 +430,10 @@ pub struct PluginCommands {
pub struct PluginPrompts {
pub research: Option<String>,
pub planning: Option<String>,
+ pub planning_with_research: Option<String>,
pub running: Option<String>,
+ /// Prompt for Backlog β†’ Running (skipping Planning). Includes {task} since there's no plan.
+ pub running_direct: Option<String>,
pub review: Option<String>,
}
diff --git a/src/skills.rs b/src/skills.rs
index 85c440b..b55f98c 100644
--- a/src/skills.rs
+++ b/src/skills.rs
@@ -2,10 +2,10 @@
/// Skills follow the Agent Skills spec (SKILL.md with YAML frontmatter + markdown).
/// Content is loaded from .md files at compile time via include_str!().
-pub const RESEARCH_SKILL: &str = include_str!("../skills/research.md");
-pub const PLAN_SKILL: &str = include_str!("../skills/plan.md");
-pub const EXECUTE_SKILL: &str = include_str!("../skills/execute.md");
-pub const REVIEW_SKILL: &str = include_str!("../skills/review.md");
+pub const RESEARCH_SKILL: &str = include_str!("../plugins/agtx/skills/research.md");
+pub const PLAN_SKILL: &str = include_str!("../plugins/agtx/skills/plan.md");
+pub const EXECUTE_SKILL: &str = include_str!("../plugins/agtx/skills/execute.md");
+pub const REVIEW_SKILL: &str = include_str!("../plugins/agtx/skills/review.md");
/// Default built-in skills: (directory_name, SKILL.md content)
/// Used for worktree phases (Research, Planning, Running, Review)
@@ -16,19 +16,13 @@ pub const DEFAULT_SKILLS: &[(&str, &str)] = &[
("agtx-review", REVIEW_SKILL),
];
-/// Default task prompts per phase transition.
-/// These are sent as the task content message AFTER the skill command.
-/// For agents with native skill invocation, the skill is invoked separately via send_keys.
-pub const DEFAULT_PROMPT_RESEARCH: &str =
- "Task: {task}\n\nWrite your findings to .agtx/research/{task_id}.md";
-pub const DEFAULT_PROMPT_PLANNING: &str =
- "Task: {task}";
-pub const DEFAULT_PROMPT_PLANNING_WITH_RESEARCH: &str =
- "Task: {task}\n\nIf research was done, findings are available in .agtx/research/{task_id}.md β€” use them as context if present.";
-pub const DEFAULT_PROMPT_RUNNING: &str =
- "Plan approved. Implement the changes described in .agtx/plan.md";
-pub const DEFAULT_PROMPT_REVIEW: &str =
- "Implementation complete. Review the changes.";
+/// Load a bundled plugin by name from compile-time embedded TOML.
+pub fn load_bundled_plugin(name: &str) -> Option<crate::config::WorkflowPlugin> {
+ BUNDLED_PLUGINS
+ .iter()
+ .find(|(n, _, _)| *n == name)
+ .and_then(|(_, _, content)| toml::from_str(content).ok())
+}
/// Agent-native command/skill directory paths.
/// Returns (base_dir_relative_to_worktree, namespace_subdir) or None if agent has no native discovery.
@@ -181,6 +175,11 @@ pub fn skill_to_gemini_toml(description: &str, skill_content: &str) -> String {
/// Bundled plugin configurations: (name, description, plugin.toml content)
/// These are embedded at compile time so the TUI can install them without external files.
pub const BUNDLED_PLUGINS: &[(&str, &str, &str)] = &[
+ (
+ "agtx",
+ "Built-in workflow with skills and prompts",
+ include_str!("../plugins/agtx/plugin.toml"),
+ ),
(
"gsd",
"Get Shit Done - structured spec-driven development",
diff --git a/src/tui/app.rs b/src/tui/app.rs
index 9e02fb9..a2733a5 100644
--- a/src/tui/app.rs
+++ b/src/tui/app.rs
@@ -1740,6 +1740,7 @@ impl App {
active: current.is_empty(),
}];
for (name, desc, _content) in skills::BUNDLED_PLUGINS {
+ if *name == "agtx" { continue; }
options.push(PluginOption {
name: name.to_string(),
label: name.to_string(),
@@ -3055,8 +3056,12 @@ impl App {
} else {
task.title.clone()
};
+ let has_plan = task.worktree_path.as_ref().map_or(false, |wt| {
+ phase_artifact_exists(wt, TaskStatus::Planning, &plugin)
+ });
+ let run_phase = if has_plan { "running" } else { "running_direct" };
let skill_cmd = resolve_skill_command(&plugin, "running", &running_agent, &task_content);
- let prompt = resolve_prompt(&plugin, "running", &task_content, &task.id, &running_agent);
+ let prompt = resolve_prompt(&plugin, run_phase, &task_content, &task.id, &running_agent);
let prompt_trigger = resolve_prompt_trigger(&plugin, "running");
let session_clone = session_name.clone();
let tmux_ops = Arc::clone(&self.state.tmux_ops);
@@ -3357,10 +3362,6 @@ impl App {
} else {
task.title.clone()
};
- let prompt = format!(
- "Task: {}\n\nPlease implement this task directly. No need to plan first - go ahead and make the changes.",
- task_content
- );
// Stamp plugin on task
task.plugin = self.state.config.workflow_plugin.clone();
@@ -3368,6 +3369,7 @@ impl App {
let plugin = self.load_task_plugin(&task);
let running_agent = self.state.config.agent_for_phase("running").to_string();
let all_agents = collect_phase_agents(&self.state.config);
+ let prompt = resolve_prompt(&plugin, "running_direct", &task_content, &task.id, &running_agent);
let skill_cmd = resolve_skill_command(&plugin, "running", &running_agent, &task_content);
let prompt_trigger = resolve_prompt_trigger(&plugin, "running");
let project_name = self.state.project_name.clone();
@@ -3539,11 +3541,11 @@ impl App {
}
/// Load the plugin that a specific task was created with.
- /// Returns None for tasks created with agtx defaults (task.plugin is None).
+ /// Falls back to bundled agtx plugin for tasks with no explicit plugin.
fn load_task_plugin(&self, task: &Task) -> Option<WorkflowPlugin> {
let plugin = match &task.plugin {
Some(name) => WorkflowPlugin::load(name, self.state.project_path.as_deref()).ok(),
- None => None,
+ None => skills::load_bundled_plugin("agtx"),
};
if let Some(ref p) = plugin {
if !p.supports_agent(&self.state.config.default_agent) {
@@ -3614,20 +3616,22 @@ impl App {
}
let phase_status = if status == TaskStatus::Backlog {
- // Research artifact: check worktree first, then project root
+ // Research artifact: check worktree only (research runs in worktree)
+ let plugin = plugin_cache.entry(task_plugin.clone()).or_insert_with(|| {
+ match &task_plugin {
+ Some(name) => WorkflowPlugin::load(name, self.state.project_path.as_deref()).ok(),
+ None => skills::load_bundled_plugin("agtx"),
+ }
+ });
let found = worktree_path.as_ref().map_or(false, |wt| {
- Path::new(wt).join(".agtx").join("research")
- .join(format!("{}.md", task_id)).exists()
- }) || project_path.as_ref().map_or(false, |pp| {
- pp.join(".agtx").join("research")
- .join(format!("{}.md", task_id)).exists()
+ research_artifact_exists(wt, &task_id, plugin)
});
if found { PhaseStatus::Ready } else { PhaseStatus::Working }
} else if let Some(ref wt) = worktree_path {
let plugin = plugin_cache.entry(task_plugin.clone()).or_insert_with(|| {
match &task_plugin {
Some(name) => WorkflowPlugin::load(name, self.state.project_path.as_deref()).ok(),
- None => None,
+ None => skills::load_bundled_plugin("agtx"),
}
});
if phase_artifact_exists(wt, status, plugin) {
@@ -3854,15 +3858,6 @@ fn setup_task_worktree(
let agent_refs: Vec<&str> = all_phase_agents.iter().map(|s| s.as_str()).collect();
write_skills_to_worktree(&worktree_path_str, project_path, plugin, &agent_refs);
- // Copy research artifact into worktree if it exists
- let research_path = project_path.join(".agtx").join("research")
- .join(format!("{}.md", task.id));
- if research_path.exists() {
- let dst_dir = Path::new(&worktree_path_str).join(".agtx");
- let _ = std::fs::create_dir_all(&dst_dir);
- let _ = std::fs::copy(&research_path, dst_dir.join("research.md"));
- }
-
// Run plugin init_script (in addition to project init_script)
// Supports {agent} placeholder for agent-specific initialization
if let Some(ref p) = plugin {
@@ -4489,31 +4484,35 @@ fn resolve_prompt(plugin: &Option<WorkflowPlugin>, phase: &str, task_content: &s
let template = match phase {
"research" => plugin.as_ref()
.and_then(|p| p.prompts.research.as_deref())
- .unwrap_or(skills::DEFAULT_PROMPT_RESEARCH),
+ .unwrap_or(""),
"planning" => plugin.as_ref()
.and_then(|p| p.prompts.planning.as_deref())
- .unwrap_or(skills::DEFAULT_PROMPT_PLANNING),
+ .unwrap_or(""),
"planning_with_research" => plugin.as_ref()
- .and_then(|p| p.prompts.planning.as_deref())
- .unwrap_or(skills::DEFAULT_PROMPT_PLANNING_WITH_RESEARCH),
+ .and_then(|p| p.prompts.planning_with_research.as_deref())
+ .unwrap_or(""),
"running" => plugin.as_ref()
.and_then(|p| p.prompts.running.as_deref())
- .unwrap_or(skills::DEFAULT_PROMPT_RUNNING),
+ .unwrap_or(""),
+ "running_direct" => plugin.as_ref()
+ .and_then(|p| p.prompts.running_direct.as_deref()
+ .or(p.prompts.running.as_deref()))
+ .unwrap_or(""),
"review" => plugin.as_ref()
.and_then(|p| p.prompts.review.as_deref())
- .unwrap_or(skills::DEFAULT_PROMPT_REVIEW),
+ .unwrap_or(""),
_ => return task_content.to_string(),
};
- // Explicit empty prompt means "send nothing" (e.g., void plugin)
- if template.is_empty() {
- return String::new();
- }
-
// For agents without interactive skill invocation, append a file-path reference
let skill_dir_name = skills::phase_to_skill_dir(phase);
let skill_ref = skills::skill_reference(agent_name, skill_dir_name);
+ if template.is_empty() {
+ // No prompt text β€” return just the skill reference (if any)
+ return skill_ref;
+ }
+
let result = template
.replace("{task}", task_content)
.replace("{task_id}", task_id);
@@ -4721,24 +4720,15 @@ fn wait_for_prompt_trigger(tmux_ops: &Arc<dyn TmuxOperations>, target: &str, tri
/// Check if the phase artifact exists for a task in its worktree
fn phase_artifact_exists(worktree_path: &str, status: TaskStatus, plugin: &Option<WorkflowPlugin>) -> bool {
- let rel_path = if let Some(ref p) = plugin {
- match status {
- TaskStatus::Planning => p.artifacts.planning.as_deref(),
- TaskStatus::Running => p.artifacts.running.as_deref(),
- TaskStatus::Review => p.artifacts.review.as_deref(),
- _ => None,
- }
- } else {
- None
- };
-
- let rel_path = rel_path.unwrap_or(match status {
- TaskStatus::Planning => ".agtx/plan.md",
- TaskStatus::Running => ".agtx/execute.md",
- TaskStatus::Review => ".agtx/review.md",
- _ => return false,
+ let rel_path = plugin.as_ref().and_then(|p| match status {
+ TaskStatus::Planning => p.artifacts.planning.as_deref(),
+ TaskStatus::Running => p.artifacts.running.as_deref(),
+ TaskStatus::Review => p.artifacts.review.as_deref(),
+ _ => None,
});
+ let Some(rel_path) = rel_path else { return false; };
+
let full_path = Path::new(worktree_path).join(rel_path);
// Support simple wildcard: "specs/*/plan.md" matches any single directory level
@@ -4750,12 +4740,11 @@ fn phase_artifact_exists(worktree_path: &str, status: TaskStatus, plugin: &Optio
}
/// Check if the research artifact exists for a task.
-/// Uses plugin-configured artifact path or defaults to `.agtx/research/{task_id}.md`.
fn research_artifact_exists(worktree_path: &str, task_id: &str, plugin: &Option<WorkflowPlugin>) -> bool {
- let rel_path = plugin.as_ref()
- .and_then(|p| p.artifacts.research.as_deref())
- .unwrap_or(".agtx/research/{task_id}.md")
- .replace("{task_id}", task_id);
+ let Some(template) = plugin.as_ref().and_then(|p| p.artifacts.research.as_deref()) else {
+ return false;
+ };
+ let rel_path = template.replace("{task_id}", task_id);
let full_path = Path::new(worktree_path).join(&rel_path);
@@ -5038,6 +5027,7 @@ fn wait_for_agent_ready(tmux_ops: &Arc<dyn TmuxOperations>, target: &str) -> Opt
fn load_plugin_if_configured(config: &MergedConfig, project_path: Option<&Path>) -> Option<WorkflowPlugin> {
config.workflow_plugin.as_ref()
.and_then(|name| WorkflowPlugin::load(name, project_path).ok())
+ .or_else(|| skills::load_bundled_plugin("agtx"))
}
/// Write skill files to a worktree's .agtx/skills/ directory and agent-native discovery paths.
diff --git a/src/tui/app_tests.rs b/src/tui/app_tests.rs
index cb035aa..32acddb 100644
--- a/src/tui/app_tests.rs
+++ b/src/tui/app_tests.rs
@@ -1775,7 +1775,8 @@ fn test_transform_skill_frontmatter_no_agtx() {
#[test]
fn test_resolve_prompt_claude_no_skill_ref() {
// Claude has skill invocation support β€” prompt should NOT contain skill reference
- let prompt = resolve_prompt(&None, "planning", "my task", "task-123", "claude");
+ let plugin = skills::load_bundled_plugin("agtx");
+ let prompt = resolve_prompt(&plugin, "planning", "my task", "task-123", "claude");
assert!(prompt.contains("my task"));
assert!(!prompt.contains("/agtx:plan"));
assert!(!prompt.contains("SKILL.md"));
@@ -1784,33 +1785,71 @@ fn test_resolve_prompt_claude_no_skill_ref() {
#[test]
fn test_resolve_prompt_copilot_has_file_path() {
// Copilot has no skill invocation β€” prompt should contain file-path reference
- let prompt = resolve_prompt(&None, "planning", "my task", "task-123", "copilot");
+ let plugin = skills::load_bundled_plugin("agtx");
+ let prompt = resolve_prompt(&plugin, "planning", "my task", "task-123", "copilot");
assert!(prompt.contains("my task"));
assert!(prompt.contains(".agtx/skills/agtx-plan/SKILL.md"));
}
#[test]
-fn test_resolve_prompt_research_has_task_id() {
- let prompt = resolve_prompt(&None, "research", "my task", "abc-123", "claude");
- assert!(prompt.contains("abc-123"));
+fn test_resolve_prompt_research_has_task() {
+ let plugin = skills::load_bundled_plugin("agtx");
+ let prompt = resolve_prompt(&plugin, "research", "my task", "abc-123", "claude");
+ assert!(prompt.contains("my task"));
// Claude should NOT have skill ref in prompt (sent via send_keys)
assert!(!prompt.contains("/agtx:research"));
}
#[test]
fn test_resolve_prompt_running_phase() {
- let prompt = resolve_prompt(&None, "running", "my task", "task-123", "claude");
- assert!(prompt.contains("Plan approved"));
- assert!(!prompt.contains("SKILL.md"));
+ let plugin = skills::load_bundled_plugin("agtx");
+ let prompt = resolve_prompt(&plugin, "running", "my task", "task-123", "claude");
+ // No running prompt β€” execute skill handles instructions
+ assert!(prompt.is_empty());
}
#[test]
fn test_resolve_prompt_review_phase() {
- let prompt = resolve_prompt(&None, "review", "my task", "task-123", "copilot");
- assert!(prompt.contains("Implementation complete"));
+ let plugin = skills::load_bundled_plugin("agtx");
+ let prompt = resolve_prompt(&plugin, "review", "my task", "task-123", "copilot");
+ // No review prompt β€” review skill handles instructions.
+ // Copilot gets skill file reference since it has no interactive invocation.
assert!(prompt.contains(".agtx/skills/agtx-review/SKILL.md"));
}
+#[test]
+fn test_resolve_prompt_planning_with_research() {
+ let plugin = skills::load_bundled_plugin("agtx");
+ let prompt = resolve_prompt(&plugin, "planning_with_research", "my task", "task-123", "claude");
+ // Empty β€” agent already has task from research session, skill handles research file discovery
+ assert!(prompt.is_empty());
+}
+
+#[test]
+fn test_resolve_prompt_no_plugin_returns_empty() {
+ // Without a plugin, all prompts return empty
+ let prompt = resolve_prompt(&None, "planning", "my task", "task-123", "claude");
+ assert!(prompt.is_empty());
+}
+
+#[test]
+fn test_agtx_plugin_artifacts() {
+ let plugin = skills::load_bundled_plugin("agtx").expect("agtx plugin should load");
+ assert_eq!(plugin.artifacts.research.as_deref(), Some(".agtx/research.md"));
+ assert_eq!(plugin.artifacts.planning.as_deref(), Some(".agtx/plan.md"));
+ assert_eq!(plugin.artifacts.running.as_deref(), Some(".agtx/execute.md"));
+ assert_eq!(plugin.artifacts.review.as_deref(), Some(".agtx/review.md"));
+}
+
+#[test]
+fn test_agtx_plugin_has_no_commands() {
+ let plugin = skills::load_bundled_plugin("agtx").expect("agtx plugin should load");
+ assert!(plugin.commands.research.is_none());
+ assert!(plugin.commands.planning.is_none());
+ assert!(plugin.commands.running.is_none());
+ assert!(plugin.commands.review.is_none());
+}
+
#[test]
fn test_resolve_skill_command_no_plugin() {
// No plugin: falls back to agent-native skill invocation
@@ -1986,25 +2025,26 @@ fn test_bundled_plugins_are_valid_toml() {
#[test]
fn test_bundled_plugins_list() {
- // We ship gsd, spec-kit, and void
let names: Vec<&str> = skills::BUNDLED_PLUGINS.iter().map(|(n, _, _)| *n).collect();
+ assert!(names.contains(&"agtx"));
assert!(names.contains(&"gsd"));
assert!(names.contains(&"spec-kit"));
assert!(names.contains(&"void"));
- assert_eq!(names.len(), 3);
+ assert_eq!(names.len(), 4);
}
#[test]
fn test_plugin_select_popup_construction_no_active() {
- // When no plugin is active, (none) should be selected
+ // When no plugin is active, agtx should be selected
let current = "";
let mut options = vec![PluginOption {
name: String::new(),
- label: "(none)".to_string(),
- description: "Use agtx built-in defaults".to_string(),
+ label: "agtx".to_string(),
+ description: "Built-in workflow with skills and prompts".to_string(),
active: current.is_empty(),
}];
for (name, desc, _) in skills::BUNDLED_PLUGINS {
+ if *name == "agtx" { continue; }
options.push(PluginOption {
name: name.to_string(),
label: name.to_string(),
@@ -2024,11 +2064,12 @@ fn test_plugin_select_popup_construction_gsd_active() {
let current = "gsd";
let mut options = vec![PluginOption {
name: String::new(),
- label: "(none)".to_string(),
- description: "Use agtx built-in defaults".to_string(),
+ label: "agtx".to_string(),
+ description: "Built-in workflow with skills and prompts".to_string(),
active: current.is_empty(),
}];
for (name, desc, _) in skills::BUNDLED_PLUGINS {
+ if *name == "agtx" { continue; }
options.push(PluginOption {
name: name.to_string(),
label: name.to_string(),