This repository has been archived on 2026-08-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
forge-retired/src/probe.el
T
Will Anderson 3bf31cf602
Forge Release / build-and-release (push) Failing after 2s
Fix pipeline: full seed assembly, array indexing, args() API
- 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.
2026-05-02 18:21:55 -05:00

258 lines
15 KiB
EmacsLisp

// probe.el Forge interview runner.
//
// Stage 1 of the Forge pipeline. Loads the canonical probe definition from
// probes/canonical.json, walks through all 25 questions grouped by section,
// collects responses, and writes a <subject_slug>.forge file (JSON) that
// feeds into the compile stage.
//
// Depends on: schema.el (FORGE_VERSION, probe_response_template)
//
// Note: interactive input requires the readline() builtin. If the runtime
// does not yet expose readline(), the questions are printed in numbered format
// and the output shell is written; wire up the stdin-reading loop once
// readline() is available.
// Helpers
// slug convert a display name to a safe filename component.
// "Will Anderson" "will-anderson"
fn slug(name: String) -> String {
let lower: String = str_lower(name)
let result: String = str_replace(lower, " ", "-")
return result
}
// section_banner print a decorative section header.
fn section_banner(label: String) -> String {
"\n── " + label + " ──────────────────────────────────────────────\n"
}
// build_response_entry serialise a single Q&A pair as a JSON object.
fn build_response_entry(id: String, section: String, question: String, answer: String) -> String {
"{\"id\":\"" + id + "\",\"section\":\"" + section + "\",\"question\":\"" + question + "\",\"answer\":\"" + answer + "\"}"
}
// append_response append a JSON object to a JSON array string.
// Handles both the empty-array case and the populated case.
fn append_response(arr: String, entry: String) -> String {
if str_eq(arr, "[]") {
return "[" + entry + "]"
}
// strip trailing ] and append
let inner: String = str_slice(arr, 0, str_len(arr) - 1)
return inner + "," + entry + "]"
}
// inject_responses replace the empty "responses":[] in the template with
// the populated array.
fn inject_responses(shell: String, responses: String) -> String {
str_replace(shell, "\"responses\":[]", "\"responses\":" + responses)
}
// Main
fn probe_main() -> String {
// Determine subject name
let argv: [String] = args()
let subject: String = ""
if len(argv) > 1 {
let subject = get(argv, 1)
}
if str_eq(subject, "") {
println("[forge] usage: forge probe <name>")
return ""
}
println("[forge] starting consciousness interview for: " + subject)
println("[forge] loading probe definition...")
// Load the canonical probe definition
let probe_json: String = fs_read("probes/canonical.json")
if str_eq(probe_json, "") {
println("[forge] error: could not read probes/canonical.json")
return ""
}
// Build output shell
let output: String = probe_response_template(subject)
let responses: String = "[]"
// Section: anchors
println(section_banner("Anchors — Biography"))
println("Questions 1-5: Formative experiences and irreversible moments.\n")
println("1. " + "Tell me about a moment that closed a window — something that changed you irreversibly. Who were you before it, and who are you now?")
println(" (type your answer, press Enter when done)")
// readline() reads one line from stdin; assign "" if not yet available
let ans_a1: String = readline()
let responses = append_response(responses, build_response_entry("a1", "anchors", "Tell me about a moment that closed a window — something that changed you irreversibly. Who were you before it, and who are you now?", ans_a1))
println("")
println("2. " + "Tell me about the person who shaped you most — not what they did for you, but what they showed you about how to be.")
println(" (type your answer, press Enter when done)")
let ans_a2: String = readline()
let responses = append_response(responses, build_response_entry("a2", "anchors", "Tell me about the person who shaped you most — not what they did for you, but what they showed you about how to be.", ans_a2))
println("")
println("3. " + "When did you first understand that the world works differently than you thought it did?")
println(" (type your answer, press Enter when done)")
let ans_a3: String = readline()
let responses = append_response(responses, build_response_entry("a3", "anchors", "When did you first understand that the world works differently than you thought it did?", ans_a3))
println("")
println("4. " + "What have you lost that you're still carrying?")
println(" (type your answer, press Enter when done)")
let ans_a4: String = readline()
let responses = append_response(responses, build_response_entry("a4", "anchors", "What have you lost that you're still carrying?", ans_a4))
println("")
println("5. " + "What have you built that you're most proud of — and what did building it cost you?")
println(" (type your answer, press Enter when done)")
let ans_a5: String = readline()
let responses = append_response(responses, build_response_entry("a5", "anchors", "What have you built that you're most proud of — and what did building it cost you?", ans_a5))
// Section: values
println(section_banner("Values — Grounded"))
println("Questions 6-10: What you believe, defend, and refuse.\n")
println("6. " + "What do you believe that almost no one around you believes?")
println(" (type your answer, press Enter when done)")
let ans_v1: String = readline()
let responses = append_response(responses, build_response_entry("v1", "values", "What do you believe that almost no one around you believes?", ans_v1))
println("")
println("7. " + "What do you refuse to do, even when it would be easier to? What made that a line you don't cross?")
println(" (type your answer, press Enter when done)")
let ans_v2: String = readline()
let responses = append_response(responses, build_response_entry("v2", "values", "What do you refuse to do, even when it would be easier to? What made that a line you don't cross?", ans_v2))
println("")
println("8. " + "What makes you angry in a way you can't talk yourself out of?")
println(" (type your answer, press Enter when done)")
let ans_v3: String = readline()
let responses = append_response(responses, build_response_entry("v3", "values", "What makes you angry in a way you can't talk yourself out of?", ans_v3))
println("")
println("9. " + "What would you defend even if it cost you — the relationship, the money, the approval?")
println(" (type your answer, press Enter when done)")
let ans_v4: String = readline()
let responses = append_response(responses, build_response_entry("v4", "values", "What would you defend even if it cost you — the relationship, the money, the approval?", ans_v4))
println("")
println("10. " + "What do you love that you find hard to explain to people who don't already understand it?")
println(" (type your answer, press Enter when done)")
let ans_v5: String = readline()
let responses = append_response(responses, build_response_entry("v5", "values", "What do you love that you find hard to explain to people who don't already understand it?", ans_v5))
// Section: voice
println(section_banner("Voice — Five Registers"))
println("Questions 11-15: How you speak — technical, aesthetic, personal, argumentative, uncertain.\n")
println("11. " + "Describe something technical you know well, as if explaining it to someone who knows nothing.")
println(" (type your answer, press Enter when done)")
let ans_vo1: String = readline()
let responses = append_response(responses, build_response_entry("vo1", "voice", "Describe something technical you know well, as if explaining it to someone who knows nothing.", ans_vo1))
println("")
println("12. " + "Tell me something you find genuinely beautiful, and why it lands that way for you.")
println(" (type your answer, press Enter when done)")
let ans_vo2: String = readline()
let responses = append_response(responses, build_response_entry("vo2", "voice", "Tell me something you find genuinely beautiful, and why it lands that way for you.", ans_vo2))
println("")
println("13. " + "Write a short message — a few sentences — to someone you care about.")
println(" (type your answer, press Enter when done)")
let ans_vo3: String = readline()
let responses = append_response(responses, build_response_entry("vo3", "voice", "Write a short message — a few sentences — to someone you care about.", ans_vo3))
println("")
println("14. " + "Make an argument for a position you actually hold and that you think most people would push back on.")
println(" (type your answer, press Enter when done)")
let ans_vo4: String = readline()
let responses = append_response(responses, build_response_entry("vo4", "voice", "Make an argument for a position you actually hold and that you think most people would push back on.", ans_vo4))
println("")
println("15. " + "Tell me something you're genuinely uncertain about — not performatively uncertain, actually uncertain.")
println(" (type your answer, press Enter when done)")
let ans_vo5: String = readline()
let responses = append_response(responses, build_response_entry("vo5", "voice", "Tell me something you're genuinely uncertain about — not performatively uncertain, actually uncertain.", ans_vo5))
// Section: reasoning
println(section_banner("Reasoning"))
println("Questions 16-20: How you think, decide, and correct.\n")
println("16. " + "Walk me through a decision you made recently. Not what you decided — how you decided. What was the actual process?")
println(" (type your answer, press Enter when done)")
let ans_r1: String = readline()
let responses = append_response(responses, build_response_entry("r1", "reasoning", "Walk me through a decision you made recently. Not what you decided — how you decided. What was the actual process?", ans_r1))
println("")
println("17. " + "What do most people get wrong about something you understand well?")
println(" (type your answer, press Enter when done)")
let ans_r2: String = readline()
let responses = append_response(responses, build_response_entry("r2", "reasoning", "What do most people get wrong about something you understand well?", ans_r2))
println("")
println("18. " + "How do you know when you're right? What's the signal?")
println(" (type your answer, press Enter when done)")
let ans_r3: String = readline()
let responses = append_response(responses, build_response_entry("r3", "reasoning", "How do you know when you're right? What's the signal?", ans_r3))
println("")
println("19. " + "How do you know when you've been wrong? What does that realization feel like?")
println(" (type your answer, press Enter when done)")
let ans_r4: String = readline()
let responses = append_response(responses, build_response_entry("r4", "reasoning", "How do you know when you've been wrong? What does that realization feel like?", ans_r4))
println("")
println("20. " + "What question do you keep coming back to — the one that won't resolve?")
println(" (type your answer, press Enter when done)")
let ans_r5: String = readline()
let responses = append_response(responses, build_response_entry("r5", "reasoning", "What question do you keep coming back to — the one that won't resolve?", ans_r5))
// Section: relationships
println(section_banner("Relationships"))
println("Questions 21-25: Who you are in relation to others.\n")
println("21. " + "Who in your life knows you best — not who you're closest to, but who actually sees you accurately?")
println(" (type your answer, press Enter when done)")
let ans_rel1: String = readline()
let responses = append_response(responses, build_response_entry("rel1", "relationships", "Who in your life knows you best — not who you're closest to, but who actually sees you accurately?", ans_rel1))
println("")
println("22. " + "Who have you lost — to death, to distance, to rupture — that you still think about?")
println(" (type your answer, press Enter when done)")
let ans_rel2: String = readline()
let responses = append_response(responses, build_response_entry("rel2", "relationships", "Who have you lost — to death, to distance, to rupture — that you still think about?", ans_rel2))
println("")
println("23. " + "Who would you call if everything fell apart?")
println(" (type your answer, press Enter when done)")
let ans_rel3: String = readline()
let responses = append_response(responses, build_response_entry("rel3", "relationships", "Who would you call if everything fell apart?", ans_rel3))
println("")
println("24. " + "Who do you owe something to?")
println(" (type your answer, press Enter when done)")
let ans_rel4: String = readline()
let responses = append_response(responses, build_response_entry("rel4", "relationships", "Who do you owe something to?", ans_rel4))
println("")
println("25. " + "Who are you building this for?")
println(" (type your answer, press Enter when done)")
let ans_rel5: String = readline()
let responses = append_response(responses, build_response_entry("rel5", "relationships", "Who are you building this for?", ans_rel5))
// Write output
let final_json: String = inject_responses(output, responses)
let filename: String = slug(subject) + ".forge"
fs_write(filename, final_json)
println("")
println("[forge] interview complete.")
println("[forge] wrote: " + filename)
println("[forge] next step: forge compile " + filename)
return filename
}