encode-repo

encode-repo is a command for coding agents from ScottRBK/forgetful. It costs 9 tokens per session (4,978 once invoked), scanned A, original, MIT.

A command that records a code repository in Forgetful, a searchable knowledge base for project information. It builds project context from the code and its documentation.

In plain words
What is it for?
Onboard a project, assess its size and scope, create linked project knowledge, and prepare the repository for AI-assisted work.
Why use it?
It gives an AI agent and team members a structured reference for an existing codebase instead of relying on scattered or missing documentation.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/scottrbk/forgetful/encode-repo
Clone the repo
git clone --depth 1 https://github.com/ScottRBK/forgetful

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for encode-repo

README.md
[![agentmods](https://agentmods.dev/badge/commands/scottrbk/forgetful/encode-repo.svg)](https://agentmods.dev/commands/scottrbk/forgetful/encode-repo)
Your own site
<a href="https://agentmods.dev/commands/scottrbk/forgetful/encode-repo"><img src="https://agentmods.dev/badge/commands/scottrbk/forgetful/encode-repo.svg" alt="Measured on agentmods" height="20"></a>
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,978 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00009 $0.04978
Opus 5 $0.00005 $0.02489
Sonnet 5 $0.00002 $0.00996
Haiku 4.5 $0.00001 $0.00498

Measured 4d ago against content hash 56ed19fee5cb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

encode-repo scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/opencode/commands/encode-repo.md · 708 lines

How it starts

The opening of the file, as written. The whole thing — 708 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Encode Repository

Systematically populate the Forgetful knowledge base with comprehensive project context using the Zettelkasten-inspired bootstrap protocol.

Purpose

Transform an undocumented or lightly-documented codebase into a rich, searchable knowledge repository. Use this when:

  • Starting to use Forgetful for an existing project
  • Onboarding a new project into the memory system
  • Preparing a project for AI agent collaboration
  • Creating institutional knowledge for team members

Arguments

$ARGUMENTS

Parse for:

  • Project path: Directory to encode (default: current working directory)
  • Project name: Override auto-detected name (optional)
  • Phases: Specific phases to run (optional, default: all)

Phase 0: Discovery & Assessment (ALWAYS START HERE)

Step 1: Check for Existing Project

execute_forgetful_tool("list_projects", {})

Search for the project. If found:

  • Note the project_id (required for linking)
  • Review description, project_type, status
  • Check notes field for operational details

Step 2: Assess Project Size & Scope

Explore the codebase to determine:

Project Size:

  • Lines of code: Small <5K, Medium 5K-50K, Large >50K
  • File count: Small <50, Medium 50-500, Large >500

Project Type:

  • Simple app/script
  • Standard web app
  • Library/SDK
  • Microservice
  • Monorepo
  • Integration/ETL

Step 3: Query Existing KB Coverage

execute_forgetful_tool("query_memory", {
  "query": "<project-name> architecture overview",
  "query_context": "Assessing existing knowledge base coverage for bootstrap",
  "k": 10,
  "include_links": true,
  "project_ids": [<project_id if exists>]
})

Step 4: Analyze Current Codebase

Read key files:

  • README.md
  • pyproject.toml / package.json / Cargo.toml
  • Main entry points
  • Configuration files

Step 5: Gap Analysis

Compare KB vs Codebase:

  • What's documented and current?
  • What's documented but outdated?
  • What's missing from KB?
  • What memories reference non-existent code?

Read the full file on GitHub · 708 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 708 lines · 9 tokens per session scan A 56ed19fee5cb

Subscribe to this mod's changes

encode-repo is a command published in the GitHub repository ScottRBK/forgetful (296 stars, last pushed 2d ago), licensed MIT. It adds 9 tokens to every session and 4,978 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.