Skip to content
Data
Skill

/forgetful-encode-repo

Encode a repository into the Forgetful knowledge base — bootstrap the project, its entities, memories, and documents from the codebase itself. Use when bringing a new repo under Forgetful or refreshing a stale encoding. Re-encoding is an update pass: query-before-create makes it

From plugin
forgetful
33910 skills

Claude Code

$ npx -y skills add ScottRBK/forgetful --skill forgetful-encode-repo --agent claude-code

SKILL.md

forgetful-encode-repo.SKILL.md
name: forgetful-encode-repo
description: >-
  Encode a repository into the Forgetful knowledge base, or refresh an existing encoding after
  development work. A first encode builds the project, entities, memories, and documents from
  the codebase. A refresh reviews the git changes since the project's last encoded commit and
  updates, obsoletes, or adds only the knowledge those changes affect. Use when bringing a repo
  under Forgetful, or syncing its knowledge after commits, merges, or a release.
license: MIT
disable-model-invocation: true
tags: [bootstrap, encoding, refresh, repository, knowledge-base, git]
allowed-tools:
  - mcp__forgetful__discover_forgetful_tools
  - mcp__forgetful__how_to_use_forgetful_tool
  - mcp__forgetful__execute_forgetful_tool
  - Bash(forgetful:*)

Encoding a repository

An encoding is a claim about the code at one commit. The project's `last_encoding_point` holds that commit's SHA: the checkpoint. Forgetful stores the checkpoint but never sets or advances it; this skill moves it, and only after a run has reviewed every change up to the new commit. A first encode builds knowledge from the codebase. A refresh reviews the changes since the checkpoint.

**Decide, then load.** Begin with Step 1. The branch comes from what Steps 1 and 2 observe in git and Forgetful, not from whether the request says encode or refresh, and Step 2 ends by writing it down as the branch decision. Open a reference only after that decision, and only the one it names.

Invoking operations

Operations are named by registry name (`list_projects`, `update_memory`, ...). Invoke via whichever surface this agent has:

  • **MCP**: `execute_forgetful_tool(tool_name="list_projects", arguments={...})`
  • **CLI**: `forgetful call list_projects --args '{"repo_name": "..."}' --json`

Get any operation's schema at runtime: `how_to_use_forgetful_tool` (MCP) or `forgetful tools info <operation>` (CLI) — schemas are deliberately not repeated here.

Skills named below resolve via `search_skills` → `export_skill` when not already available.

Step 1 — Pin the run

Run git in the repository being encoded (the current directory unless the user named one). Record, before any write:

  • **HEAD**: `git rev-parse HEAD`. Unless the user names another range end, this is the end

commit: everything this run writes describes it.

  • **Clean worktree**: `git status --porcelain` prints nothing. Otherwise knowledge read from

uncommitted or untracked files would be stamped with a commit that lacks them, so ask the user to commit or stash, and wait.

  • **Project**: `git remote get-url origin` → `owner/repo` → `list_projects` with `repo_name`.

When no remote exists or several projects match, ask the user. Record the project ID and its `last_encoding_point` as read now.

Done when: HEAD, a clean worktree, and the project (or its absence) are recorded.

Step 2 — Choose the branch

Two requests override the table. A full re-encode selects the first-encode branch, including its review of existing knowledge. An explicit range for an existing encoding selects refresh, even when its end equals the checkpoint; resolve the range as described below. For a repo with no encoding, use the first-encode branch at the requested end commit instead.

Otherwise, the first matching row wins:

| Situation | Branch | |---|---| | No project for this repo | First encode | | Project has no encoded knowledge (check below) | First encode | | Checkpoint equals the end commit | Nothing to review: go to Step 6 | | Checkpoint is a commit and an ancestor of the end commit | Refresh, checkpoint → end | | Project holds knowledge; checkpoint missing, unknown here, or not an ancestor | Pause |

Checks: the checkpoint is a commit here when `git rev-parse --verify --quiet <sha>^{commit}` prints the stored value itself; a branch or tag name moves, so it does not count. `git merge-base --is-ancestor <sha> <end>` succeeds when it is an ancestor. Check for knowledge with `get_recent_memories` (project ID, `include_obsolete`), `list_documents`, `list_code_artifacts`, and `list_entities`, each scoped to the project. Any item returned proves knowledge; a project record alone does not. Knowledge is absent only when all four reads succeed and return nothing. A read that still fails after correcting the call leaves knowledge unknown, which counts as present.

**Pause** means: ask the user for a baseline, a commit the stored knowledge is known to describe, and refresh from it once it resolves as an ancestor of the end commit. Take the baseline from the user; tags, dates, and recent commits are guesses. The user may instead ask for a full re-encode, which runs the first-encode branch over the existing knowledge.

**User ranges.** A user may name a range `A..B`. Resolve both ends to SHAs; B becomes the end commit. The checkpoint may move to B only when the range leaves no unreviewed commit after the current checkpoint: A is the checkpoint or one of its ancestors, and the checkpoint is an ancestor of B. A user-named baseline counts as the checkpoint for this rule. Any other range still gets reviewed and curated, but the checkpoint stays where it is.

**Branch decision.** End this step by writing the decision in your response: the project ID or none, the checkpoint as read, the end commit, whether knowledge is present and which reads show it, and the branch with its range. The decision names the reference Step 3 opens: `references/first-encode.md` for a first encode, `references/refresh.md` for a refresh, and none for a pause or nothing to review.

Done when: the branch decision is written, and each value in it comes from a command or tool result in this run.

Step 3 — Load and run the branch

Open the reference the branch decision names, from where this skill came from so it matches this SKILL.md, and follow its steps, applying the curation rules below to every write:

  • **Skill folder**: read that path, relative to this SKILL.md's folder.
  • **For
Read more
@scottrbk
Ships withforgetful

Opensource Memory for Agents

Stars on GitHub

Momentum

stars in total
339
Star history of ScottRBK/forgetful on GitHub, a chart by star-history.com

Other skills on forgetful.

forgetful-cli-setup

forgetful-cli-setup

Set up the Forgetful CLI and connect from a terminal — install, local or remote mode, auth, and verification. Use when connecting…

@scottrbk@scottrbkInstall Skill
forgetful-context-gather

forgetful-context-gath…

Gather deep context before planning or implementing — one pass that turns a task description into a cited context pack: relevant…

@scottrbk@scottrbkInstall Skill
forgetful-entities

forgetful-entities

Model the things knowledge attaches to — people, organisations, devices, products, system components. Use when a new thing…

@scottrbk@scottrbkInstall Skill
forgetful-explore

forgetful-explore

Explore the Forgetful knowledge graph when flat search isn't enough — cross-project investigations, "what do we know about X",…

@scottrbk@scottrbkInstall Skill
forgetful-files

forgetful-files

File binary content into the knowledge base — screenshots, PDFs, diagrams, fonts, assets. Use when a binary artifact is worth…

@scottrbk@scottrbkInstall Skill
forgetful-mcp-setup

forgetful-mcp-setup

Set up an MCP client for Forgetful — wire Claude Code, Cursor, Copilot, Codex, Gemini, or OpenCode to the server and verify the…

@scottrbk@scottrbkInstall Skill

More skills from other plugins.

context-loader
Auto-invoked

context-loader

Search memories from earlier Pi sessions in this repository. Use it when earlier work may already explain the code, error,…

mem05d69k
@mem0ai@mem0aiInstall Skill
analyzing-ai-citations

analyzing-ai-citations

Answer AI citation and answer engine optimization (AEO) questions in PostHog: whether AI answer engines (ChatGPT, Claude, and an…

posthog11d41k
@posthog@posthogInstall Skill

Questions about forgetful-encode-repo.

Which coding agents can use forgetful-encode-repo?
forgetful-encode-repo installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.