Compare commits
2 commits
e6c7b82a0f
...
d3f0b3f3f7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3f0b3f3f7 | ||
|
|
aad0cd669a |
7 changed files with 31 additions and 1383 deletions
34
Cargo.lock
generated
34
Cargo.lock
generated
|
|
@ -538,7 +538,6 @@ dependencies = [
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
"hyper",
|
"hyper",
|
||||||
"hyper-util",
|
"hyper-util",
|
||||||
"jobkit",
|
|
||||||
"json5",
|
"json5",
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
|
|
@ -1569,20 +1568,6 @@ dependencies = [
|
||||||
"syn 2.0.117",
|
"syn 2.0.117",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "jobkit"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "git+https://evilpiepirate.org/git/jobkit.git#4aacaac22c5f59a7fbc6ce3a65708fc370e55754"
|
|
||||||
dependencies = [
|
|
||||||
"chrono",
|
|
||||||
"libc",
|
|
||||||
"log",
|
|
||||||
"profiling",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"tokio",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jobserver"
|
name = "jobserver"
|
||||||
version = "0.1.34"
|
version = "0.1.34"
|
||||||
|
|
@ -2209,25 +2194,6 @@ dependencies = [
|
||||||
"yansi",
|
"yansi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "profiling"
|
|
||||||
version = "1.0.17"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773"
|
|
||||||
dependencies = [
|
|
||||||
"profiling-procmacros",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "profiling-procmacros"
|
|
||||||
version = "1.0.17"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "52717f9a02b6965224f95ca2a81e2e0c5c43baacd28ca057577988930b6c3d5b"
|
|
||||||
dependencies = [
|
|
||||||
"quote",
|
|
||||||
"syn 2.0.117",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ptr_meta"
|
name = "ptr_meta"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ redb = "4"
|
||||||
rkyv = { version = "0.7", features = ["validation", "std"] }
|
rkyv = { version = "0.7", features = ["validation", "std"] }
|
||||||
|
|
||||||
rayon = "1"
|
rayon = "1"
|
||||||
jobkit = { git = "https://evilpiepirate.org/git/jobkit.git", features = ["daemon"] }
|
|
||||||
|
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
tokio-util = { version = "0.7", features = ["compat"] }
|
tokio-util = { version = "0.7", features = ["compat"] }
|
||||||
|
|
|
||||||
26
README.md
26
README.md
|
|
@ -160,33 +160,19 @@ a text input at the bottom and a status bar.
|
||||||
|
|
||||||
```json5
|
```json5
|
||||||
{
|
{
|
||||||
// Backend credentials
|
your_host: {
|
||||||
anthropic: {
|
|
||||||
api_key: "sk-...",
|
|
||||||
},
|
|
||||||
deepinfra: {
|
|
||||||
api_key: "...",
|
api_key: "...",
|
||||||
base_url: "http://localhost:8000/v1", // vLLM endpoint
|
base_url: "http://localhost:8000/v1", // vLLM endpoint
|
||||||
},
|
},
|
||||||
openrouter: {
|
|
||||||
api_key: "sk-or-...",
|
|
||||||
base_url: "https://openrouter.ai/api/v1",
|
|
||||||
},
|
|
||||||
|
|
||||||
// Named models — switch with /model
|
// Named models — switch with /model
|
||||||
models: {
|
models: {
|
||||||
"27b": {
|
"27b": {
|
||||||
backend: "deepinfra",
|
backend: "your_host",
|
||||||
model_id: "Qwen/Qwen3.5-27B",
|
model_id: "Qwen/Qwen3.5-27B",
|
||||||
prompt_file: "POC.md", // system prompt file
|
prompt_file: "POC.md", // system prompt file
|
||||||
context_window: 262144,
|
context_window: 262144,
|
||||||
},
|
},
|
||||||
opus: {
|
|
||||||
backend: "anthropic",
|
|
||||||
model_id: "claude-opus-4-6",
|
|
||||||
prompt_file: "CLAUDE.md",
|
|
||||||
context_window: 200000,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
default_model: "27b",
|
default_model: "27b",
|
||||||
|
|
||||||
|
|
@ -221,14 +207,6 @@ a text input at the bottom and a status bar.
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Backends
|
|
||||||
|
|
||||||
- **deepinfra** — any OpenAI-compatible completions API (vLLM, llama.cpp, etc.)
|
|
||||||
- **anthropic** — Anthropic's API
|
|
||||||
- **openrouter** — OpenRouter
|
|
||||||
|
|
||||||
The `deepinfra` name is historical; it works with any base URL.
|
|
||||||
|
|
||||||
### Context groups
|
### Context groups
|
||||||
|
|
||||||
Context groups define what gets loaded into the context window at session start.
|
Context groups define what gets loaded into the context window at session start.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use crate::store;
|
use crate::store;
|
||||||
|
|
||||||
pub fn cmd_run_agent(agent: &str, count: usize, target: &[String], query: Option<&str>, dry_run: bool, local: bool, state_dir: Option<&str>) -> Result<(), String> {
|
pub fn cmd_run_agent(agent: &str, count: usize, target: &[String], query: Option<&str>, dry_run: bool, _local: bool, state_dir: Option<&str>) -> Result<(), String> {
|
||||||
// Mark as agent so tool calls (e.g. poc-memory render) don't
|
// Mark as agent so tool calls (e.g. poc-memory render) don't
|
||||||
// pollute the user's seen set as a side effect
|
// pollute the user's seen set as a side effect
|
||||||
// SAFETY: single-threaded at this point (CLI startup, before any agent work)
|
// SAFETY: single-threaded at this point (CLI startup, before any agent work)
|
||||||
|
|
@ -18,18 +18,6 @@ pub fn cmd_run_agent(agent: &str, count: usize, target: &[String], query: Option
|
||||||
unsafe { std::env::set_var("POC_MEMORY_DRY_RUN", "1"); }
|
unsafe { std::env::set_var("POC_MEMORY_DRY_RUN", "1"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
let needs_local = local || dry_run;
|
|
||||||
let has_targets = !target.is_empty() || query.is_some();
|
|
||||||
|
|
||||||
// Fast path: no explicit targets, daemon available — just queue via RPC
|
|
||||||
if !needs_local && !has_targets {
|
|
||||||
if crate::agents::daemon::send_rpc_pub("ping").is_some() {
|
|
||||||
return crate::agents::daemon::rpc_run_agent(agent, count);
|
|
||||||
}
|
|
||||||
println!("Daemon not running — falling back to local execution");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Slow path: need the store for local execution or target resolution
|
|
||||||
let mut store = store::Store::load()?;
|
let mut store = store::Store::load()?;
|
||||||
|
|
||||||
// Resolve targets: explicit --target, --query, or agent's default query
|
// Resolve targets: explicit --target, --query, or agent's default query
|
||||||
|
|
@ -50,32 +38,15 @@ pub fn cmd_run_agent(agent: &str, count: usize, target: &[String], query: Option
|
||||||
};
|
};
|
||||||
|
|
||||||
if !resolved_targets.is_empty() {
|
if !resolved_targets.is_empty() {
|
||||||
// --local or daemon unavailable: run directly
|
for (i, key) in resolved_targets.iter().enumerate() {
|
||||||
if needs_local || crate::agents::daemon::send_rpc_pub("ping").is_none() {
|
println!("[{}] [{}/{}] {}", agent, i + 1, resolved_targets.len(), key);
|
||||||
if !needs_local {
|
if i > 0 { store = store::Store::load()?; }
|
||||||
println!("Daemon not running — falling back to local execution");
|
if let Err(e) = crate::agent::oneshot::run_one_agent(
|
||||||
}
|
&mut store, agent, count, Some(&[key.clone()]),
|
||||||
for (i, key) in resolved_targets.iter().enumerate() {
|
) {
|
||||||
println!("[{}] [{}/{}] {}", agent, i + 1, resolved_targets.len(), key);
|
println!("[{}] ERROR on {}: {}", agent, key, e);
|
||||||
if i > 0 { store = store::Store::load()?; }
|
|
||||||
if let Err(e) = crate::agent::oneshot::run_one_agent(
|
|
||||||
&mut store, agent, count, Some(&[key.clone()]),
|
|
||||||
) {
|
|
||||||
println!("[{}] ERROR on {}: {}", agent, key, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Queue to daemon
|
|
||||||
let mut queued = 0;
|
|
||||||
for key in &resolved_targets {
|
|
||||||
let cmd = format!("run-agent {} 1 target:{}", agent, key);
|
|
||||||
if crate::agents::daemon::send_rpc_pub(&cmd).is_some() {
|
|
||||||
queued += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
println!("[{}] queued {} tasks to daemon", agent, queued);
|
|
||||||
} else {
|
} else {
|
||||||
// Local execution (--local, --debug, dry-run, or daemon unavailable)
|
// Local execution (--local, --debug, dry-run, or daemon unavailable)
|
||||||
crate::agent::oneshot::run_one_agent(
|
crate::agent::oneshot::run_one_agent(
|
||||||
|
|
|
||||||
|
|
@ -80,5 +80,5 @@ pub use hippocampus::query::parser as query_parser;
|
||||||
pub use subconscious as agents;
|
pub use subconscious as agents;
|
||||||
pub use subconscious::{
|
pub use subconscious::{
|
||||||
audit, consolidate,
|
audit, consolidate,
|
||||||
digest, daemon,
|
digest,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
63
src/main.rs
63
src/main.rs
|
|
@ -439,45 +439,8 @@ enum GraphCmd {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
|
||||||
enum DaemonCmd {
|
|
||||||
/// Start the daemon (default)
|
|
||||||
Start,
|
|
||||||
/// Show daemon status
|
|
||||||
Status,
|
|
||||||
/// Show daemon log
|
|
||||||
Log {
|
|
||||||
/// Job name to filter by
|
|
||||||
job: Option<String>,
|
|
||||||
/// Tail a task's log file (drill down from daemon log)
|
|
||||||
#[arg(long)]
|
|
||||||
task: Option<String>,
|
|
||||||
/// Number of lines to show
|
|
||||||
#[arg(long, default_value_t = 20)]
|
|
||||||
lines: usize,
|
|
||||||
},
|
|
||||||
/// Trigger consolidation via daemon
|
|
||||||
Consolidate,
|
|
||||||
/// Run an agent via the daemon
|
|
||||||
Run {
|
|
||||||
/// Agent name (e.g. organize, replay, linker)
|
|
||||||
#[arg(default_value = "replay")]
|
|
||||||
agent: String,
|
|
||||||
/// Batch size
|
|
||||||
#[arg(default_value_t = 1)]
|
|
||||||
count: usize,
|
|
||||||
},
|
|
||||||
/// Interactive TUI
|
|
||||||
Tui,
|
|
||||||
/// Reload config file without restarting
|
|
||||||
ReloadConfig,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
enum AgentCmd {
|
enum AgentCmd {
|
||||||
/// Background job daemon
|
|
||||||
#[command(subcommand)]
|
|
||||||
Daemon(DaemonCmd),
|
|
||||||
/// Run knowledge agents to convergence
|
/// Run knowledge agents to convergence
|
||||||
#[command(name = "knowledge-loop")]
|
#[command(name = "knowledge-loop")]
|
||||||
KnowledgeLoop {
|
KnowledgeLoop {
|
||||||
|
|
@ -859,35 +822,9 @@ impl Run for CursorCmd {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Run for DaemonCmd {
|
|
||||||
fn run(self) -> Result<(), String> {
|
|
||||||
match self {
|
|
||||||
Self::Start => daemon::run_daemon(),
|
|
||||||
Self::Status => daemon::show_status(),
|
|
||||||
Self::Log { job, task, lines } => {
|
|
||||||
if let Some(ref task_name) = task {
|
|
||||||
daemon::show_task_log(task_name, lines)
|
|
||||||
} else {
|
|
||||||
daemon::show_log(job.as_deref(), lines)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Self::Consolidate => daemon::rpc_consolidate(),
|
|
||||||
Self::Run { agent, count } => daemon::rpc_run_agent(&agent, count),
|
|
||||||
Self::Tui => Err("TUI moved to consciousness binary (F4/F5)".into()),
|
|
||||||
Self::ReloadConfig => {
|
|
||||||
match daemon::send_rpc_pub("reload-config") {
|
|
||||||
Some(resp) => { eprintln!("{}", resp.trim()); Ok(()) }
|
|
||||||
None => Err("daemon not running".into()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Run for AgentCmd {
|
impl Run for AgentCmd {
|
||||||
fn run(self) -> Result<(), String> {
|
fn run(self) -> Result<(), String> {
|
||||||
match self {
|
match self {
|
||||||
Self::Daemon(sub) => sub.run(),
|
|
||||||
Self::KnowledgeLoop { max_cycles, batch_size, window, max_depth }
|
Self::KnowledgeLoop { max_cycles, batch_size, window, max_depth }
|
||||||
=> cli::agent::cmd_knowledge_loop(max_cycles, batch_size, window, max_depth),
|
=> cli::agent::cmd_knowledge_loop(max_cycles, batch_size, window, max_depth),
|
||||||
Self::ConsolidateBatch { count, auto, agent }
|
Self::ConsolidateBatch { count, auto, agent }
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue