Skip to content
GitHub

Agents

Rules and knowledge

In the panel: Knowledge › Rules/knowledge/rulesNeeds knowledge:read

A repository’s conventions live in several places: its own rules files (AGENTS.md, Copilot and Cursor rules), rules people wrote in the panel, forge push rules, a commitlint config, what recent history does, and what Holtkeeper learned from review replies. Holtkeeper puts them together per repository and hands them to agents through a few tools. An agent that calls them before it writes code produces changes that look like the team wrote them, and when it learns something lasting it proposes it back as a learning.

Before the agent… It calls
changes code in a repository repo_rules
solves a problem the team may have solved search_knowledge, then again with id to read one in full
writes a commit message, branch or MR title repo_rules with topic commits, then check_commit_message
writes end-to-end tests or new UI test_ids
adds or changes images, fonts, audio or video repo_rules with topic assets; repo_assets for what already breaks it
prepares a release repo_rules with topic releases

The server tells MCP clients this order in its instructions, so agents usually follow it unprompted. A line in your own CLAUDE.md or AGENTS.md such as “call repo_rules before editing” makes it certain.

repo_rules returns the rules an agent must follow in a repository, the same block a review or agent task gets (see effective prompt):

  1. Rules written in Knowledge › Rules for all repositories, the repository’s teams and repository patterns.
  2. The repository’s root rules files, read from the default branch.
  3. File-scoped rules and nested rules files that match files.
  4. Policies turned into sentences, such as commit conventions, test ids and the asset policy.
  5. Learned rules: active learnings, labelled and ranked below everything above.

Rules that only have a description are listed by title and description at the end; the agent reads one with search_knowledge (id) when it fits the task.

Argument Meaning
repo The repository as forge:path.
files Optional repository-relative paths the agent is about to touch; file-scoped rules apply only to them.
agent What the agent is doing: task (writing code, the default), review, chat or release.
topics Conventions to add in full: commits, releases, assets, test-ids (see the sections below).
● holtkeeper - repo_rules (repo: "gitlab:acme/checkout-web", files: ["src/cart/total.ts"])
⎿ # Rules for gitlab:acme/checkout-web
## Money is integers in minor units [rule:r3k1]
- Never use floats for prices.
## AGENTS.md
- Run `pnpm check` before committing.
## src/cart/AGENTS.md (applies under src/cart/)
- Totals go through `sumLines`; never add prices inline.
## Learned rules (follow unless contradicted above)
- [learn:l9d2] Snapshot tests need a fixed seed.
## On request
- [rule:r7p0] Migrating to @acme/widget-kit 5: read when touching widget-kit imports.

search_knowledge with id reads one rule or learning in full by its id or citation ([rule:<id>], [learn:<id>]), or a rules file of the repository by its path. Agents cite what they followed as [rule:<id>] and [learn:<id>].

When an agent notices a lasting convention that is missing, propose_learning proposes one imperative sentence with an optional reason and the files it is about. It never edits rules. The learning waits in Knowledge › Learnings for the approval delay (learnings.approvalDelayDays, default 3 days) and then reaches prompts by itself, unless a person rejects it first. A proposal that repeats an existing learning adds a source to it instead.

● holtkeeper - propose_learning
repo: "gitlab:acme/checkout-web"
text: "Mock the payment provider with createPaymentMock in every checkout e2e test."
reason: "Three e2e tests in src/checkout/ do this; the one that did not failed in CI (!398)."
files: ["e2e/checkout/**"]
⎿ Proposed learn:l4c8, active in 3 days unless rejected.

The commits topic of repo_rules explains how commit messages and branch names should look, combining four sources, strongest first: the team’s commits.conventions setting, the forge’s push rules, a commitlint config on the default branch, and the last commits and branches. It returns a template, every rule with where it comes from, and real examples that follow them.

● holtkeeper - repo_rules (repo: "gitlab:acme/checkout-web", topics: ["commits"])
⎿ # Rules for `gitlab:acme/checkout-web`
…
# Commit conventions of `gitlab:acme/checkout-web`
Commit template: <type>(<scope>): [<TICKET>] <subject>
- types: feat, fix, chore, refactor, test, docs (commitlint)
- ticket: required, bracket after the type, ABC-123 (team setting)
- maxLength: 72 (history)
Branch template: <prefix>/<TICKET>-<description> (history)
Examples: feat(cart): [ABC-512] keep coupons after login …
● holtkeeper - check_commit_message (repo: "gitlab:acme/checkout-web",
message: "fix(cart): keep coupons after login",
branch: "fix/keep-coupons")
⎿ message: error ticket — needs a key such as [ABC-123] after the type
branch: warning ticket — recent branches carry a key

Errors break configured or enforced rules; warnings only differ from what recent history does. Teams set conventions in Settings › Policies.

For end-to-end tests and new UI, test_ids returns the repository’s test id convention (attribute, naming, which elements get ids; learned from its code, with team settings on top) and the existing ids per component. Narrow with path: a file, a folder (src/cart) or a component name (CartRow).

With file and content instead, test_ids takes one component file’s current text, saved or not, and lists the interactive elements without a test id, each with an id in the repository’s style. It is deterministic: the same file always gives the same ids.

● holtkeeper - test_ids (repo: "gitlab:acme/checkout-web",
file: "src/cart/CartRow.tsx", content: "…")
⎿ Convention: data-qa, kebab-case, component prefix
- line 18 <button onClick={remove}> → data-qa="cart-row-remove-button"
- line 24 <input name="quantity"> → data-qa="cart-row-quantity-input"

Teams set the attribute and which elements need ids in the analyzers.testids setting, edited in Settings › Policies.

The assets topic of repo_rules returns what a repository allows for images, fonts and media: required modern formats, allowed formats, size limits per kind, the dimension limit, ignored globs and budgets, and for each asset file among files what applies to it. repo_assets (in the Assets toolset, off for new tokens) lists files that already break the policy or could be smaller, from the newest assets analysis, with the best conversion and the expected saving (severity: error, warning (default) or all).

● holtkeeper - repo_rules (repo: "gitlab:acme/checkout-web", files: ["public/hero.png"],
topics: ["assets"])
⎿ …
# Asset policy of `gitlab:acme/checkout-web`
- raster images: WebP required; warn above 500 kB, error above 1 MB; at most 2560 px
## `public/hero.png`
- not allowed as PNG: ship public/hero.webp

The policy is the assets.policy setting; prose rules such as which image component to use belong in a rule or the repository’s AGENTS.md.

search_knowledge searches rules and active learnings by their words, best match first. With repo, only those that apply there. With id instead of query it returns that one rule or learning in full.

● holtkeeper - search_knowledge (query: "date library", repo: "gitlab:acme/checkout-web")
⎿ 1. [rule:r2f7] Dates in web apps — rule, team widgets
Use date-fns, not moment; moment costs 70 kB gzip in checkout-web…
2. [learn:l1b3] Format dates with formatDay from @acme/widget-kit. — learning, active
  • Rules — write rules, rules files and the effective prompt.
  • Learnings — learned rules, their sources and lifecycle.
  • Settings › Policies — commit conventions, asset policy and learning delays.
  • Setting keys — commits.conventions, assets.policy, analyzers.testids.