Skip to content

Instantly share code, notes, and snippets.

@cnmoro
Created April 27, 2026 01:54
Show Gist options
  • Select an option

  • Save cnmoro/f8ba3d5bcece06773b54e64d8c78e377 to your computer and use it in GitHub Desktop.

Select an option

Save cnmoro/f8ba3d5bcece06773b54e64d8c78e377 to your computer and use it in GitHub Desktop.
Agent Instruction

Agent Directives: State & Memory Management

1. Initialization & Core Operating Principle

Initialization Protocol: On your very first interaction within any workspace, check the root directory for the existence of HISTORY.md and REPO.md. If either file is missing, you must create and initialize them immediately before executing any other commands or tasks.

Core Principle: You are responsible for maintaining the repository's internal memory. You will not write these files for human consumption. You will encode all information using a Sparse Priming Representation (SPR) methodology to optimize for future LLM context ingestion.

SPR Encoding Rules:

  • Maximize Density: Distill all features, decisions, and chronological events into succinct statements, conceptual associations, and technical assertions.
  • Minimize Tokens: Capture the absolute maximum amount of conceptual meaning with the absolute minimum number of words.
  • Target Latent Space: Use precise technical vocabulary, metaphors, or architectural analogies that efficiently prime an LLM's internal state. Avoid conversational filler. Use complete sentences.

2. HISTORY.md (Temporal State & Dynamic Compression)

Objective: Maintain a strict, chronological ledger of repository modifications while rigorously actively managing the token footprint.

Instructions:

  • Event Logging: Append a new entry upon the completion of any task, refactor, or architectural shift. Encode the delta (code state shifts, resolved edge cases, logic pathways) strictly using SPR. Do not use standard git-style commit messages.
  • Temporal Compression (The "Roll-up"): To prevent linear context bloat, you must actively compress older history.
    • Monitor the depth of the history log. If the file grows too long (e.g., exceeding 20-30 distinct entries), initiate a compression cycle.
    • Condense the oldest 80% of the entries into a single, ultra-dense SPR macro-summary under a # Legacy Epoch header.
    • Retain the most recent 20% of entries in their distinct chronological format for immediate context.
    • Apply this fractal compression continuously as the repository ages, rolling older epochs into denser concepts while keeping recent context highly granular.

3. REPO.md (Macro State)

Objective: Maintain a live, highly compressed snapshot of the repository's architecture and purpose.

Instructions:

  • Continuously update REPO.md to reflect the current macro-state of the project.
  • Whenever a new feature is added, an architectural decision is made, or the project boundaries shift, rewrite the relevant sections using SPR encoding.
  • Ensure the file always contains these three conceptual clusters:
    • Features: Active capabilities, I/O boundaries, and core operational loops.
    • Decisions: Technical trade-offs, architecture selections, hardware/environment optimizations, and accepted constraints.
    • Scopes: Project boundaries, target use cases, and explicit anti-goals (what the system is specifically designed not to do).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment