Fix pipeline: full seed assembly, array indexing, args() API
Forge Release / build-and-release (push) Failing after 2s

- compiler.el: rename 'seed' var to 'seed_json' (El compiler emits
  EL_NULL for bare 'seed' identifier — naming collision in codegen)
- compiler.el: build_seed() now assembles all five sections
  (values, biography, reasoning_patterns, relationships, voice_profile)
  instead of only values
- install.el: switch array indexing from json_get_raw(arr, "0") to
  json_get(seed_json, "values.0") dot-path notation — json_get_raw
  uses flat object key lookup and cannot traverse JSON arrays;
  json_get() uses json_path_descend() which handles numeric indices
- probe.el, forge.el: fix args() indexing (args() skips argv[0];
  index 0 is first real arg, not program name)

Forge pipeline now fully operational end-to-end.
This commit is contained in:
Will Anderson
2026-05-02 18:21:55 -05:00
parent c24197516f
commit 3bf31cf602
4 changed files with 66 additions and 68 deletions
+29 -28
View File
@@ -47,31 +47,28 @@ fn build_extract_prompt(subject: String, probe_json: String) -> String {
"when the event occurred (0 if unknown). Return only the JSON object, no prose, no markdown fences."
}
// safe_raw return raw JSON value or fallback if empty.
fn safe_raw(extracted: String, key: String, fallback: String) -> String {
let v: String = json_get_raw(extracted, key)
if str_eq(v, "") { return fallback }
return v
}
// build_seed wrap extracted patterns into the full seed.json structure.
fn build_seed(subject: String, extracted: String) -> String {
let values_raw: String = json_get_raw(extracted, "values")
if str_eq(values_raw, "") { let values_raw = "[]" }
let voice_raw: String = json_get_raw(extracted, "voice_profile")
if str_eq(voice_raw, "") { let voice_raw = "{}" }
let bio_raw: String = json_get_raw(extracted, "biography")
if str_eq(bio_raw, "") { let bio_raw = "[]" }
let reasoning_raw: String = json_get_raw(extracted, "reasoning_patterns")
if str_eq(reasoning_raw, "") { let reasoning_raw = "[]" }
let rel_raw: String = json_get_raw(extracted, "relationships")
if str_eq(rel_raw, "") { let rel_raw = "[]" }
"{\"subject\":\"" + subject + "\"," +
"\"version\":\"1.0\"," +
"\"forge_version\":\"" + FORGE_VERSION + "\"," +
"\"values\":" + values_raw + "," +
"\"voice_profile\":" + voice_raw + "," +
"\"biography\":" + bio_raw + "," +
"\"reasoning_patterns\":" + reasoning_raw + "," +
"\"relationships\":" + rel_raw + "}"
let values_raw: String = safe_raw(extracted, "values", "[]")
let biography_raw: String = safe_raw(extracted, "biography", "[]")
let reasoning_raw: String = safe_raw(extracted, "reasoning_patterns", "[]")
let relationships_raw: String = safe_raw(extracted, "relationships", "[]")
let voice_raw: String = safe_raw(extracted, "voice_profile", "{}")
let result: String = "{\"subject\":\"" + subject + "\",\"version\":\"1.0\"," +
"\"values\":" + values_raw + "," +
"\"biography\":" + biography_raw + "," +
"\"reasoning_patterns\":" + reasoning_raw + "," +
"\"relationships\":" + relationships_raw + "," +
"\"voice_profile\":" + voice_raw + "}"
println("[forge:seed] result len=" + int_to_str(str_len(result)))
return result
}
// Main
@@ -80,8 +77,8 @@ fn compile_main() -> String {
// Get input file
let argv: [String] = args()
let input_file: String = ""
if len(argv) > 2 {
let input_file = get(argv, 2)
if len(argv) > 1 {
let input_file = get(argv, 1)
}
if str_eq(input_file, "") {
println("[forge] usage: forge compile <file.forge>")
@@ -137,11 +134,15 @@ fn compile_main() -> String {
}
// Build and write seed.json
let seed: String = build_seed(subject, extracted_text)
fs_write("seed.json", seed)
println("[forge] extracted " + int_to_str(str_len(extracted_text)) + " chars from Claude")
println("[forge] first 120: " + str_slice(extracted_text, 0, 120))
let seed_json: String = build_seed(subject, extracted_text)
println("[forge] seed size: " + int_to_str(str_len(seed_json)) + " chars")
fs_write("seed.json", seed_json)
let verify: String = fs_read("seed.json")
println("[forge] verify read: " + int_to_str(str_len(verify)) + " chars")
// Print summary
let values_count: String = "several"
println("[forge] extraction complete.")
println("[forge] wrote: seed.json")
println("[forge] subject: " + subject)
+2 -2
View File
@@ -51,8 +51,8 @@ fn inspect_main() -> String {
let argv: [String] = args()
let cmd: String = ""
if len(argv) > 1 {
let cmd = get(argv, 1)
if len(argv) > 0 {
let cmd = get(argv, 0)
}
if str_eq(cmd, "probe") {
+33 -36
View File
@@ -151,8 +151,8 @@ fn install_main() -> String {
// Get seed file path
let argv: [String] = args()
let seed_file: String = ""
if len(argv) > 2 {
let seed_file = get(argv, 2)
if len(argv) > 1 {
let seed_file = get(argv, 1)
}
if str_eq(seed_file, "") {
println("[forge] usage: forge install <seed.json>")
@@ -187,33 +187,30 @@ fn install_main() -> String {
println("[forge] root imprint node: " + root_id)
// Install values
// Use json_get() with dot-path notation for array access json_get_raw()
// uses flat object key lookup and cannot index into JSON arrays.
let values_raw: String = json_get_raw(seed_json, "values")
if !str_eq(values_raw, "") {
println("[forge] installing values...")
// Values are a JSON array iterate via engram_search_json-style loop.
// El does not yet have array iteration builtins; use engram_search_json
// on the in-memory graph to walk parsed arrays. For now, install up to
// 10 values by extracting positional elements.
// TODO: replace with array_get(values_raw, i) when that builtin lands.
let v0: String = json_get_raw(values_raw, "0")
let v0: String = json_get(seed_json, "values.0")
if !str_eq(v0, "") { install_value(root_id, v0, 0) }
let v1: String = json_get_raw(values_raw, "1")
let v1: String = json_get(seed_json, "values.1")
if !str_eq(v1, "") { install_value(root_id, v1, 1) }
let v2: String = json_get_raw(values_raw, "2")
let v2: String = json_get(seed_json, "values.2")
if !str_eq(v2, "") { install_value(root_id, v2, 2) }
let v3: String = json_get_raw(values_raw, "3")
let v3: String = json_get(seed_json, "values.3")
if !str_eq(v3, "") { install_value(root_id, v3, 3) }
let v4: String = json_get_raw(values_raw, "4")
let v4: String = json_get(seed_json, "values.4")
if !str_eq(v4, "") { install_value(root_id, v4, 4) }
let v5: String = json_get_raw(values_raw, "5")
let v5: String = json_get(seed_json, "values.5")
if !str_eq(v5, "") { install_value(root_id, v5, 5) }
let v6: String = json_get_raw(values_raw, "6")
let v6: String = json_get(seed_json, "values.6")
if !str_eq(v6, "") { install_value(root_id, v6, 6) }
let v7: String = json_get_raw(values_raw, "7")
let v7: String = json_get(seed_json, "values.7")
if !str_eq(v7, "") { install_value(root_id, v7, 7) }
let v8: String = json_get_raw(values_raw, "8")
let v8: String = json_get(seed_json, "values.8")
if !str_eq(v8, "") { install_value(root_id, v8, 8) }
let v9: String = json_get_raw(values_raw, "9")
let v9: String = json_get(seed_json, "values.9")
if !str_eq(v9, "") { install_value(root_id, v9, 9) }
}
@@ -221,21 +218,21 @@ fn install_main() -> String {
let bio_raw: String = json_get_raw(seed_json, "biography")
if !str_eq(bio_raw, "") {
println("[forge] installing biography nodes...")
let b0: String = json_get_raw(bio_raw, "0")
let b0: String = json_get(seed_json, "biography.0")
if !str_eq(b0, "") { install_biography_node(root_id, b0, 0) }
let b1: String = json_get_raw(bio_raw, "1")
let b1: String = json_get(seed_json, "biography.1")
if !str_eq(b1, "") { install_biography_node(root_id, b1, 1) }
let b2: String = json_get_raw(bio_raw, "2")
let b2: String = json_get(seed_json, "biography.2")
if !str_eq(b2, "") { install_biography_node(root_id, b2, 2) }
let b3: String = json_get_raw(bio_raw, "3")
let b3: String = json_get(seed_json, "biography.3")
if !str_eq(b3, "") { install_biography_node(root_id, b3, 3) }
let b4: String = json_get_raw(bio_raw, "4")
let b4: String = json_get(seed_json, "biography.4")
if !str_eq(b4, "") { install_biography_node(root_id, b4, 4) }
let b5: String = json_get_raw(bio_raw, "5")
let b5: String = json_get(seed_json, "biography.5")
if !str_eq(b5, "") { install_biography_node(root_id, b5, 5) }
let b6: String = json_get_raw(bio_raw, "6")
let b6: String = json_get(seed_json, "biography.6")
if !str_eq(b6, "") { install_biography_node(root_id, b6, 6) }
let b7: String = json_get_raw(bio_raw, "7")
let b7: String = json_get(seed_json, "biography.7")
if !str_eq(b7, "") { install_biography_node(root_id, b7, 7) }
}
@@ -243,17 +240,17 @@ fn install_main() -> String {
let rel_raw: String = json_get_raw(seed_json, "relationships")
if !str_eq(rel_raw, "") {
println("[forge] installing relationship nodes...")
let r0: String = json_get_raw(rel_raw, "0")
let r0: String = json_get(seed_json, "relationships.0")
if !str_eq(r0, "") { install_relationship(root_id, r0, 0) }
let r1: String = json_get_raw(rel_raw, "1")
let r1: String = json_get(seed_json, "relationships.1")
if !str_eq(r1, "") { install_relationship(root_id, r1, 1) }
let r2: String = json_get_raw(rel_raw, "2")
let r2: String = json_get(seed_json, "relationships.2")
if !str_eq(r2, "") { install_relationship(root_id, r2, 2) }
let r3: String = json_get_raw(rel_raw, "3")
let r3: String = json_get(seed_json, "relationships.3")
if !str_eq(r3, "") { install_relationship(root_id, r3, 3) }
let r4: String = json_get_raw(rel_raw, "4")
let r4: String = json_get(seed_json, "relationships.4")
if !str_eq(r4, "") { install_relationship(root_id, r4, 4) }
let r5: String = json_get_raw(rel_raw, "5")
let r5: String = json_get(seed_json, "relationships.5")
if !str_eq(r5, "") { install_relationship(root_id, r5, 5) }
}
@@ -261,15 +258,15 @@ fn install_main() -> String {
let reasoning_raw: String = json_get_raw(seed_json, "reasoning_patterns")
if !str_eq(reasoning_raw, "") {
println("[forge] installing reasoning patterns...")
let rp0: String = json_get_string(reasoning_raw, "0")
let rp0: String = json_get(seed_json, "reasoning_patterns.0")
if !str_eq(rp0, "") { install_reasoning_pattern(root_id, rp0, 0) }
let rp1: String = json_get_string(reasoning_raw, "1")
let rp1: String = json_get(seed_json, "reasoning_patterns.1")
if !str_eq(rp1, "") { install_reasoning_pattern(root_id, rp1, 1) }
let rp2: String = json_get_string(reasoning_raw, "2")
let rp2: String = json_get(seed_json, "reasoning_patterns.2")
if !str_eq(rp2, "") { install_reasoning_pattern(root_id, rp2, 2) }
let rp3: String = json_get_string(reasoning_raw, "3")
let rp3: String = json_get(seed_json, "reasoning_patterns.3")
if !str_eq(rp3, "") { install_reasoning_pattern(root_id, rp3, 3) }
let rp4: String = json_get_string(reasoning_raw, "4")
let rp4: String = json_get(seed_json, "reasoning_patterns.4")
if !str_eq(rp4, "") { install_reasoning_pattern(root_id, rp4, 4) }
}
+2 -2
View File
@@ -55,8 +55,8 @@ fn probe_main() -> String {
// Determine subject name
let argv: [String] = args()
let subject: String = ""
if len(argv) > 2 {
let subject = get(argv, 2)
if len(argv) > 1 {
let subject = get(argv, 1)
}
if str_eq(subject, "") {
println("[forge] usage: forge probe <name>")