Skip to content

feat: write file output, config-relative paths, SGR routing support - #74

Merged
mirpo merged 1 commit into
mainfrom
feat/write-file-output
Jul 22, 2026
Merged

feat: write file output, config-relative paths, SGR routing support#74
mirpo merged 1 commit into
mainfrom
feat/write-file-output

Conversation

@mirpo

@mirpo mirpo commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a terminal write: step and closes the read → LLM → write office loop with no shell glue. Also makes local-file paths config-relative and teaches the schema strict-checker about discriminated unions (SGR routing).

What's in it

  • write: step — exports a source step's rows to a deliverable file: .csv (sorted union header, JSON-encoded nested cells), .json (pretty array), .md (table), .jsonl; format inferred from extension or format: override. Terminal (can't be a from/forEach/placeholder source). fs/write.go + step/write_step.go; shared collectRows extracted from transform-collect (no JSONL-plane change).
  • Config-relative paths — relative read:/write: paths now resolve to the config file's directory (absolute paths unchanged), so a workflow's data travels with it and runs from any working directory. Applies to both read (was CWD-relative) and write.
  • SGR Routing (engine) — the strict-compat walker (jsonschema) now recurses anyOf/oneOf/allOf branches, so discriminated-union schemas are validated for OpenAI strict output. Deterministic tests: TestStrictCompatibilityIssues_UnionBranch, TestValidateJSONText_DiscriminatedUnion.
  • Examplescsv-enrichment (minimal read→enrich→write) and inbox-triage (read emails → SGR triage → jq board → draft replies → write csv + md).
  • Docs — README "Schema-Guided Reasoning (SGR)" section (Cascade / Routing / Cycle). Routing documented as a cloud-model pattern: small local models (≤3B) reliably mis-route anyOf unions (verified across qwen3:1.7b, llama3.2:3b, deepseek-r1:1.5b), so the local examples use Cascade.

Verification

  • Build + full go test ./... + golangci-lint green.
  • Both examples run end-to-end from a foreign working directory; deliverables land next to their config (config-relative confirmed live).

Note

Path model has a known open follow-up (intermediate JSONL/dataset/ still resolves CWD-relative while read/write are config-relative; --output control) — tracked separately, out of scope here.

Add a terminal `write:` step that exports a source step's rows to a
deliverable file (csv / json / md / jsonl, inferred by extension or
`format:`), closing the read → LLM → write office loop with no shell.

- write step + fs/write.go (WriteCSV union-header, WriteJSONArray,
  WriteMarkdownTable); shared collectRows extracted from transform-collect
- relative read/write paths now resolve to the config file's directory
  (absolute unchanged), so a workflow runs from any working directory
- jsonschema strict-compat walker recurses anyOf/oneOf/allOf branches, so
  SGR discriminated-union (routing) schemas are validated for strict output
- examples: csv-enrichment (minimal read→enrich→write) and inbox-triage
  (read emails → SGR triage → jq board → draft replies → write csv + md)
- README: "Schema-Guided Reasoning (SGR)" section (Cascade / Routing / Cycle)
@mirpo
mirpo force-pushed the feat/write-file-output branch from ea9e15f to 4d75f86 Compare July 22, 2026 18:06
@mirpo
mirpo merged commit d317c60 into main Jul 22, 2026
3 checks passed
@mirpo
mirpo deleted the feat/write-file-output branch July 22, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant