Closing the Feedback Loop: How One Edit Connected Human Knowledge to an Autonomous LLM Agent
In the span of a single, deceptively simple edit command, the assistant executed a pivotal architectural decision that transformed the autonomous fleet management agent from a system that could receive human feedback into one that could learn from it. The message in question — message index 4570 — reads in its entirety:
Now make the agent read knowledge entries and include them in its prompt. Update the Python: [edit] /tmp/czk/cmd/vast-manager/agent/vast_agent.py Edit applied successfully.
This brief exchange belies the profound shift it represents. To understand why this message was written, one must trace the chain of reasoning that led to it, the assumptions it encoded, and the knowledge it created.
The Problem: An Agent That Couldn't Remember
The context for this message begins with a user complaint at [msg 4553]: the UI showed "8 unacked" alerts, but there was no way for the human operator to acknowledge them, provide feedback, or influence the agent's future behavior. The user's request was specific and insightful: alert acknowledgments should include buttons for dismissal, agent-proposed actions, and a text input for custom actions. More importantly, the agent needed a way to "save preferences/knowledge that is persistent in its context from this feedback."
This last requirement was the crux. Up to this point, the agent — a Python script running on a 5-minute systemd timer, powered by an LLM making scaling decisions for a fleet of GPU proving instances — was effectively amnesiac. Each invocation was a fresh start. The agent could observe the current state of the fleet and make decisions, but it had no mechanism to carry forward lessons learned from previous interactions. If a human operator corrected the agent's behavior — "don't launch instances on machine X, it has thermal throttling issues" — that correction was lost the moment the agent finished its run.
The assistant recognized this as a fundamental architectural gap. The agent needed persistent memory, and that memory needed to be grounded in a durable store that survived across invocations.
Building the Infrastructure
The assistant's response was systematic. Rather than bolting on a quick fix, it built a complete three-layer system:
- Backend persistence ([msg 4557]): A SQLite-backed
agent_knowledgetable was added to the Go server, with CRUD endpoints (GET/POST/DELETE /api/agent/knowledgeand item-level operations). Each knowledge entry stored acategory,content,source(human or agent), and timestamp. - Frontend UI (<msg id=4565-4569>): The HTML UI was extended with alert acknowledgment buttons (dismiss, agent-proposed actions, custom text input) and a dedicated "Knowledge" tab alongside the existing "Notes" tab. JavaScript functions (
ackAlert,addKnowledge,deleteKnowledge) wired the UI to the backend. - Agent integration ([msg 4570]): The Python agent script was modified to fetch knowledge entries from the API and inject them into the LLM's system prompt. The target message is the third and final piece — the one that closes the loop.
What the Edit Actually Did
While the message itself doesn't show the diff, the surrounding context reveals its purpose. The agent's prompt construction logic (visible in earlier reads of vast_agent.py) assembles a system message containing fleet state, performance data, and operational rules. The edit added a new section: a call to GET /api/agent/knowledge followed by formatting the returned entries into the prompt as a "Knowledge from previous interactions" block.
This is deceptively simple but architecturally profound. The knowledge entries are not ephemeral chat history — they are structured, categorized, and persisted in SQLite. They survive agent crashes, server restarts, and context window truncation. They are visible in the UI for human review and editing. And crucially, they are fed directly into the LLM's context on every invocation, ensuring the agent always operates with the full set of accumulated wisdom.
Assumptions and Design Decisions
The assistant made several key assumptions in this design:
Knowledge as structured data, not conversation history. The assistant chose to store knowledge as discrete entries (category + content) rather than relying on the agent's conversation log. This was a deliberate rejection of the "just keep the chat history" approach, which had already proven fragile — context windows overflow, compaction fails, and session resets lose everything. Structured knowledge is resilient.
The agent reads, the human writes. Knowledge entries are created by humans acknowledging alerts or by the agent itself via the add_note tool. But the critical pathway is human-to-agent: the operator provides feedback through the UI, which becomes a knowledge entry, which the agent reads on its next cycle. This creates a genuine feedback loop where human preferences shape agent behavior.
Knowledge is visible and auditable. By exposing the knowledge store in the UI, the assistant ensured that the human operator can see exactly what the agent "knows." This transparency is essential for trust — the operator can verify that their feedback was recorded and can delete or correct entries if the agent misinterprets something.
The Thinking Process
The assistant's reasoning, visible across the sequence of messages, reveals a methodical approach. After diagnosing that the agent was running correctly but hitting its fast-path (no action needed), the assistant pivoted to the user's actual request. The todo list at [msg 4556] shows the three items being tackled in parallel: alert ack UI, knowledge store, and exposing it in the UI.
The order of implementation is telling: backend first (data model and API), then frontend (UI rendering and interaction), then agent (consumption). This is classic layered architecture — build the foundation before the integration. The assistant even iterated on the Go code, adding the knowledge handlers in [msg 4564] after the LSP errors in [msg 4562] revealed missing method implementations.
The target message represents the "aha" moment where all the pieces click together. The backend stores knowledge, the UI creates it, and now the agent consumes it. The loop is complete.
Input and Output Knowledge
Input knowledge required to understand this message includes: familiarity with the agent architecture (Python script, systemd timer, LLM-based decision making), the Go backend's API structure, the SQLite schema for knowledge entries, and the user's prior complaint about unacknowledged alerts. One must also understand that the agent constructs its prompt dynamically each run by fetching data from the API.
Output knowledge created by this message is the integration point between the knowledge store and the agent's reasoning. After this edit, every agent invocation includes a "Knowledge from previous interactions" section in its system prompt, containing all human-provided preferences and corrections. This transforms the agent from a stateless observer into a learning system that accumulates operational wisdom over time.
Significance
This message, for all its brevity, represents the moment the fleet management agent gained genuine memory. The infrastructure was already in place — the database tables, the API endpoints, the UI buttons — but without this final edit, the knowledge store was a library with no readers. The agent could receive feedback but could not act on it.
By connecting the Python agent to the knowledge API, the assistant completed a feedback loop that is the hallmark of well-designed autonomous systems: observe, decide, act, receive feedback, remember, and improve. The agent would no longer repeat mistakes. It would no longer need to be told the same thing twice. And the human operator gained a durable mechanism to shape the agent's behavior without editing code or modifying prompts.
In the broader arc of the conversation, this edit is the culmination of a multi-hour effort to build an autonomous fleet manager that is both powerful and controllable. The knowledge store gives the human operator a steering wheel — not by overriding the agent's decisions, but by informing them.