Supply Chain Agent Lesson: Memory Knows the Rules, Code Enforces Them
Chemical_Pickle5979 · reddit · 2026-09-30
The author built a decision-support agent for supply chain disruptions (gpt-oss-120b, synthetic dataset: 5 plants, hundreds of suppliers, 3 years of history), architected as narrative memory (Hindsight) + structured state (SQLite) + deterministic simulator + guardrails in code — the LLM never generates a number.
Key lessons:
- Policy in memory, enforcement in code: a memory directive makes a breach unlikely; a code check makes it impossible. Recommendations violating open commitments get rejected, and if the model insists twice, code overrides it with the best safe option.
- Enforce "as-of" everywhere: SQLite temp views mask anything resolved after the as-of date, with an authorizer so the LLM's SQL tool can't bypass them; memory recall gets the same date filter — otherwise the agent reads the future.
- Risks as fields, not prose: once breachescommitments became a property of each simulated option, ranking, guardrails and UI could all act on it.
Results: 14/14 correct actions on held-out disruptions, 4/4 trap cases avoided, 13/14 open commitments surfaced. What failed: of 12 planted recurring patterns, memory recalled the documents reliably but consolidated observations surfaced only 3 on its own — a key reason hard rules live in code. Code is open source.
More from coding & agent
- Cube Launches Always-On Cloud Computers for Running Claude Code and Codex Agents — algo_diver · 2026-09-30
- A new auto-research loop that bootstraps the shape of the best possible result — burny_tech · 2026-09-30
- Stack Overflow joins OpenAI DevDay to share how Codex sped up its new architecture — pchandrasekar · 2026-09-30
- Models improving doesn't obsolete your agentic coding scaffolding, argues pushback on viral take — max_paperclips · 2026-09-30
- Building a Code Review Agent That Learns From Feedback With Groq and Hindsight — pasulabhavya · 2026-09-30
- Open-Dots, an open-source clone of OpenAI's Dots, hits 4,500 GitHub stars in 24 hours — matchaman11 · 2026-09-30