agentleFS
naviktnavikt/copilot/AGENTS.md

copilot

AGENTS.md54 starsChanged 3 months agoMITView on GitHub

Minimal guide for agents working in this repository. Monorepo for Nav's Copilot ecosystem: SECURITY.md has the security model and trust boundaries. Keep tool output small. Run targeted commands, do not dump whole files or full build logs into context, and reach for deterministic tools (rg, git, gh) before asking the model to guess. rtk is an optional CLI proxy that filters terminal output before it reaches the model. Use it if you want to (rtk git status). Nothing here requires…

The file

We split this AGENTS.md into the rules it gives an agent

7 rules. About 1 is common, 2 are distinctive, and 4 are very specific to this project.

  • ≈1

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Keep tool output small. Run targeted commands, do not dump whole files or full build logs into context, and reach for deterministic tools …

    line 19
  2. Very specific:

    After editing an app, run mise check in that app's directory.

    line 34
  3. Distinctive:

    Start with the smallest safe change and keep diffs task-focused.

    line 56
  4. Common:

    Do not commit secrets.

    line 62
  5. Distinctive:

    Do not push unless explicitly asked.

    line 63
  6. Very specific:

    Every Go test package in cli/nav-pilot has a TestMain that calls testhome.Run (internal/testhome).

    line 116
  7. Very specific:

    Do not assume a command only reads.

    line 127

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md for navikt/copilot

Minimal guide for agents working in this repository.

What this repo is

Monorepo for Nav's Copilot ecosystem:

  • apps/my-copilot (Next.js/TypeScript web app)
  • apps/copilot-api (Go backend API)
  • apps/copilot-metrics (Go metrics job)
  • apps/mcp-onboarding (Go MCP reference server)
  • apps/mcp-registry (Go MCP registry API)

SECURITY.md has the security model and trust boundaries.

Efficiency rule

Keep tool output small. Run targeted commands, do not dump whole files or full build logs into context, and reach for deterministic tools (rg, git, gh) before asking the model to guess.

rtk is an optional CLI proxy that filters terminal output before it reaches the model. Use it if you want to (rtk git status). Nothing here requires or assumes it, and public controlled measurement has not reproduced its advertised savings (JetBrains study).

Standard commands

From repo root:

mise check
mise test
mise build
mise all

After editing an app, run mise check in that app's directory. Run mise all when the change reaches across the repo.

Conventions

  • PR bodies may be in Norwegian, but issue-closing references must use GitHub's English keywords: Closes #NNN / Fixes #NNN. Lukker #NNN does not link or auto-close anything, and three months of shipped-but-open issues in this repo trace back to exactly that. Verify with the PR's closingIssuesReferences when it matters.
  • Artifact language: body text in instructions and skills is English; metadata in the YAML frontmatter stays Norwegian (#179). The rule governs every artifact in this repo and was only recorded in a changelog entry, which is not where an author looks before editing a skill (#679).
  • Text a human reads gets a språkvask and unslop pass before it ships: docs, READMEs, issue and PR bodies, user-facing CLI strings and error messages, Norwegian and English alike. Cut filler and AI tells, keep every command, flag and value verbatim. Recorded after the 2026-09-13 pass over navikt/apt and nais/pilot#3, where a denial message an engineer meets mid-task had to be cut down to what is wrong and what to run.
  • Start with the smallest safe change and keep diffs task-focused.
  • Reuse existing patterns before adding new abstractions.
  • In my-copilot, use Aksel spacing tokens, not Tailwind p-*/m-* utilities.
  • /cplt in my-copilot is the external landing page for the cplt open-source project: keep it in English (lang="en") and keep its dark design. Don't translate it or restyle it to the ki-utvikling/Aksel look; fix bugs only.
  • Do not commit secrets.
  • Do not push unless explicitly asked.

Merging a stacked pull request

This repository uses a merge queue, and pull requests are sometimes registered as a GitHub stack (GET /repos/{owner}/{repo}/pulls/{n} shows a stack object). A stacked PR refuses every ordinary merge route, each with a different error, so it is easy to spend a long time concluding the wrong thing:

  • gh pr merge --auto reports Auto-merge is not supported for stacked pull requests.
  • GraphQL enqueuePullRequest refuses and points at the async REST API.
  • PUT /pulls/{n}/merge refuses stacked PRs outright.
  • PATCH /pulls/{n} cannot change the base while the PR is in a stack.

The route that works is the asynchronous one:

gh api -X PUT repos/OWNER/REPO/pulls/N/merge-async

Do not pass merge_method. The merge queue sets it, and supplying one makes the request fail with Custom merge params are not supported when merging via a merge queue.

Poll the result. The endpoint returns {"status":"pending"} with a uuid whether or not the request will succeed. The failure only appears here:

gh api repos/OWNER/REPO/pulls/N/merge-async/UUID

That returns enqueued, or failed with the actual reason: a rejected merge param, checks still owing results, and so on. Treating the pending response as success means retrying a request that has already failed, silently.

Running the nav-pilot binary in tests or verification

nav-pilot writes to the developer's own environment: ~/.copilot/, ~/.nav-pilot/ and the repository you are standing in. A verification that runs the real binary without isolation changes a real setup, and it has: an install run during testing pointed a user scope at a temporary worktree and left 23 of 52 files in conflict, which sync then silently skipped. Nothing had been edited by hand.

Whenever you run the binary — directly, or through a test that calls run():

  • Set HOME to a temporary directory. That is the one that matters, because everything resolves through os.UserHomeDir. nav-pilot does not read COPILOT_HOME. Also set NAV_PILOT_CONFIG (relocates ~/.nav-pilot/config.toml, see internal/cli/config.go) and XDG_CONFIG_HOME (honoured on the opencode export path, see internal/provider/opencode_launch.go). In Go tests, isolatedConfig(t) does this for you — use it.
  • Every Go test package in cli/nav-pilot has a TestMain that calls testhome.Run (internal/testhome). It points HOME, the XDG directories and NAV_PILOT_CONFIG at a temporary directory for the whole test binary and fails the run if the test binary opened nav-pilot's files in the real home (Go's test log shows it). A change in those files that the binary did not open is a warning locally, since a real nav-pilot may be running, and a failure in CI. A new test package needs the same TestMain; TestEveryTestPackageCallsRun fails without it. A test that sets HOME itself must also set NAV_PILOT_CONFIG, or it uses the config testhome.Run chose. isolatedConfig(t) sets both.
  • Do not assume a command only reads. install, sync, config and the launch paths all write.
  • Hash ~/.copilot and ~/.nav-pilot before and after, and report any difference. Isolation that is set up wrong looks exactly like isolation until someone checks.
  • Say so loudly if you did touch something. A silent change to a developer's setup is worse than a failed test.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.