From d52ac2fe1207c756ef8869b14f4e11bc81e3822b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=20=E9=A7=BF=E7=94=AB=20=28Shunsuke=20Hayashi=29?= Date: Fri, 10 Apr 2026 10:10:18 +0900 Subject: [PATCH] feat(cli): auto-enqueue to skill-bus on register After successful task registration, automatically append a queued entry to skill-runs.jsonl. This connects the Polaris gate workflow to the skill-bus tracking system. Use --no-bus to skip auto-enqueue when not needed. Closes #93 Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/miyabi-cli/src/main.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/crates/miyabi-cli/src/main.rs b/crates/miyabi-cli/src/main.rs index bb849dc..521e01d 100644 --- a/crates/miyabi-cli/src/main.rs +++ b/crates/miyabi-cli/src/main.rs @@ -177,6 +177,9 @@ enum GateCommand { /// Completion mode #[arg(long, value_enum, default_value_t = CompletionModeArg::GithubPr)] completion_mode: CompletionModeArg, + /// Skip skill-bus auto-enqueue + #[arg(long)] + no_bus: bool, }, /// Show status for one task or the whole ledger Status { @@ -1269,8 +1272,10 @@ fn handle_gate_command( soft_dependencies, priority, completion_mode, + no_bus, } => { let task_id = task_id.unwrap_or_else(|| derive_task_id(issue, &title)); + let task_title = title.clone(); protocol .register( RegisterTaskRequest { @@ -1295,6 +1300,9 @@ fn handle_gate_command( } else { println!("registered: {} ({})", task.id, task.title); } + if !no_bus { + bus_enqueue(&task.id, &task_title); + } }) } GateCommand::Status { task_id } => { @@ -2418,3 +2426,29 @@ fn truncate_str(s: &str, max_len: usize) -> String { s.to_string() } } + +fn bus_enqueue(task_id: &str, title: &str) { + let skill_runs_path = std::env::current_dir() + .ok() + .map(|cwd| cwd.join("skills/self-improving-skills/skill-runs.jsonl")); + + if let Some(path) = skill_runs_path.filter(|p| p.parent().is_some_and(|d| d.exists())) { + let entry = serde_json::json!({ + "ts": chrono::Utc::now().to_rfc3339(), + "agent": std::env::var("POLARIS_AGENT_ID").unwrap_or_else(|_| "system".into()), + "skill": "polaris-ops", + "task": format!("register: {title} ({task_id})"), + "result": "queued", + "score": 0.0, + "notes": "auto-enqueued on register" + }); + if let Ok(mut file) = std::fs::OpenOptions::new() + .create(true) + .append(true) + .open(&path) + { + use std::io::Write; + let _ = writeln!(file, "{}", serde_json::to_string(&entry).unwrap_or_default()); + } + } +}