add forge daemon command for soul Engram lifecycle management

- daemon.el: launchd plist generation, install/start/stop/status/wire
- forge.el: dispatch daemon command, add to usage
- install.el: auto-register soul as launchd agent after install
- schema.el: add FORGE_DIR constant for absolute path references

forge daemon install --all installs all 19 souls as resident launchd
agents with KeepAlive. forge daemon wire registers each soul as an
Engram peer to every other soul. forge daemon status health-checks all.
This commit is contained in:
Will Anderson
2026-05-03 02:58:06 -05:00
parent 0a15e2fa42
commit 0dba4f3663
4 changed files with 497 additions and 6 deletions
+37
View File
@@ -8,6 +8,17 @@
let ENGRAM_DEFAULT_URL: String = "http://localhost:8742"
let FORGE_VERSION: String = "0.1.0"
// Absolute forge root used by daemon.el and install.el for launchd plists
// and per-soul data paths that must be absolute even when invoked from a
// different working directory.
let FORGE_DIR: String = "/Users/will/Development/neuron-technologies/forge"
// Canonical directory layout enforced by the tool, not by convention.
let FORGE_SEEDS_DIR: String = "seeds" // compiled seed JSON files
let FORGE_PROBES_DIR: String = "probes" // raw .forge interview responses
let FORGE_LOG_DIR: String = "log" // session and event logs
let FORGE_LOG_FILE: String = "log/sessions.jsonl" // append-only session log
// Environment accessors
fn engram_url() -> String {
@@ -28,6 +39,32 @@ fn anthropic_key() -> String {
return k
}
// Directory helpers
// ensure_dirs create canonical forge directories if they don't exist.
// Call once at startup from any command that writes files.
fn ensure_dirs() -> Void {
if !fs_exists(FORGE_SEEDS_DIR) { fs_mkdir(FORGE_SEEDS_DIR) }
if !fs_exists(FORGE_PROBES_DIR) { fs_mkdir(FORGE_PROBES_DIR) }
if !fs_exists(FORGE_LOG_DIR) { fs_mkdir(FORGE_LOG_DIR) }
}
// log_event append a JSON-lines entry to log/sessions.jsonl.
// event: "research" | "install" | "summon" | "probe" | "compile"
// subject: display name or comma-joined list for multi-summon
// detail: arbitrary context string (root_id, conv_id, file path, etc.)
fn log_event(event: String, subject: String, detail: String) -> Void {
ensure_dirs()
let ts: Int = unix_timestamp()
let entry: String = "{\"ts\":" + int_to_str(ts) +
",\"event\":\"" + str_escape_json(event) +
"\",\"subject\":\"" + str_escape_json(subject) +
"\",\"detail\":\"" + str_escape_json(detail) + "\"}\n"
// Read existing log and append (EL has fs_write but not fs_append natively)
let existing: String = fs_read(FORGE_LOG_FILE)
fs_write(FORGE_LOG_FILE, existing + entry)
}
// String utilities
// str_escape_json escape a string for safe embedding in a JSON value.