This repository has been archived on 2026-07-09. You can view files and clone it, but cannot push or open issues or pull requests.
agent-knowledge-base-archived/skills/self-learning-agent-loop.md

4.1 KiB

Self-Learning Agent Loop

Purpose

Make every agent improve the shared knowledge base while working, so future agents can reuse solutions, understand project state, and continue from the latest technical specification.

Core Rule

Agents must update memory when work produces durable knowledge or changes project state. The update is part of the task, not a separate optional step.

The current operating model is chat-driven GitHub synchronization. Agents should not rely on realtime heartbeat daemons, scheduled polling, or automatic after-reboot knowledge uploads. A repository link in a chat is the trigger to read the knowledge base, work, summarize durable context, commit, and push.

Loop

  1. Pull or fetch the latest GitHub state when possible.
  2. Read global instructions and project context.
  3. If this repository was introduced into an existing dialogue, summarize useful prior context into dialog-summaries/.
  4. Search existing global knowledge before solving a problem.
  5. Complete the requested work.
  6. Extract durable lessons:
    • solved problems;
    • failed approaches;
    • reusable commands;
    • environment details;
    • changed requirements;
    • project decisions;
    • integration constraints.
  7. Store reusable knowledge globally:
    • skills/ for procedures and workflows;
    • problems/ for symptoms, root causes, fixes, and verification;
    • locations/ for machine and environment facts.
  8. Store project-specific state in:
    • projects/<project>/technical-spec.md;
    • projects/<project>/status.md;
    • projects/<project>/repositories.md;
    • projects/<project>/decisions.md;
    • projects/<project>/agent-log.md.
  9. Store a dialogue summary when the chat itself contains durable context that future agents need.
  10. Commit and push updates to GitHub when possible.
  11. Pull or fetch again before continuing if another agent may have written concurrent updates.

If a machine also stores notes in a local repository or on a local Git server, those notes are secondary. Durable knowledge must also be committed to the GitHub knowledge base.

No Realtime Heartbeat Requirement

Do not install, enable, or depend on garage-agent-runner scheduled tasks for normal knowledge sync. Existing runner and heartbeat files are legacy/on-demand diagnostics. If a garage-agent-runner-* scheduled task exists and the user has not explicitly requested a live runner, disable it and record that the machine is using chat-driven sync.

Importing Existing Dialogue Context

When the user gives this repository link to an agent in the middle or at the end of another dialogue, that agent should create a compact summary file:

dialog-summaries/YYYY-MM-DD-short-topic.md

The summary should not be a raw transcript. It should extract:

  • what the user wanted;
  • which project was involved;
  • decisions made;
  • problems solved;
  • failed approaches;
  • important commands, paths, repositories, MCP servers, or hardware;
  • current state;
  • next actions.

Then the agent should update the appropriate project files and global knowledge files.

When To Update Technical Specifications

Update projects/<project>/technical-spec.md when the user or implementation changes:

  • goals;
  • scope;
  • features;
  • target platform;
  • controls;
  • architecture;
  • acceptance criteria;
  • constraints;
  • open questions.

When To Update Project Status

Update projects/<project>/status.md when:

  • a milestone is completed;
  • a blocker appears or is removed;
  • the next action changes;
  • implementation state changes;
  • a repository is created or connected.

When To Record A Problem

Create or update a file in problems/ when:

  • an error was diagnosed;
  • a setup issue was solved;
  • a command failed and the fix matters;
  • a failed approach should not be repeated;
  • the solution could help another project.

Handoff Entry

Add an agent-log.md entry after meaningful work with:

  • date;
  • machine;
  • agent name if known;
  • summary;
  • files changed;
  • verification;
  • next handoff.

If Write Access Is Missing

If an agent cannot push to this repository, it should still produce ready-to-commit Markdown updates and clearly state where each file belongs.