Skip to content

Give an agent its brief

At the end of this guide, an agent reads its brief before it changes files, and the onboard skill tells it when to.

The examples come from the repository in Answer questions and record decisions, with its DECISIONS.md and its folder rule.

  1. Print the brief for the files the agent will change:

    Terminal window
    $ pnpm exec ashlar brief apps/api/src/db/index.ts
    # Brief for `apps/api/src/db/index.ts`
    ## Areas
    - Db (`apps/api/src/db`), owned by @lee
    ## Data rules
    - Real data never enters the repository: not in code, tests, fixtures or documents.
    - Secrets are never printed, logged or written into the repository.
    ## Ashlar’s rules here
    - **public-api-only**: Import another feature or area through its `index.ts`. If you need something inside it, it belongs in its index or in `shared/`.
    - **no-comment**: Comments go stale and nothing checks them. Rename it, or write a test. Git leads from any line to the item or task that wrote it.
    - **no-disable**: No comment turns a rule off. If a rule is wrong for a case, change the rule and record why in the ledger.
    - **max-lines**: A file over 600 lines costs every agent that reads it. Split it along what it does.
    ## Decisions
    - 2026-12-01 @sam [apps/api] setup: `pnpm --filter api dev` starts it on port 3000, on the seeded database.
    - 2026-12-02 @lee [apps/api/src/db] rule: Every query goes through `rows`, so a test can swap the database.

    Name files or folders, as many as the work touches. The brief is Markdown, so it can go straight into the agent's prompt.

  2. Read what it holds. The same command on a feature's file carries more, because more applies there:

    Terminal window
    $ pnpm exec ashlar brief apps/desktop/src/features/cart/Cart.tsx
    # Brief for `apps/desktop/src/features/cart/Cart.tsx`
    ## Areas
    - Cart (`apps/desktop/src/features/cart`), owned by @sam
    ## Data rules
    - Real data never enters the repository: not in code, tests, fixtures or documents.
    - Secrets are never printed, logged or written into the repository.
    ## Ashlar’s rules here
    - **no-cross-process-import**: `src/` and `src-tauri/` never import each other, not even types. Put the contract in `shared/`.
    - **public-api-only**: Import another feature or area through its `index.ts`. If you need something inside it, it belongs in its index or in `shared/`.
    - **no-effect**: `useEffect` belongs to `client/` and `primitives/`. A feature that needs one needs a hook in `primitives/`, named for what it does, instead.
    - **no-timer**: A timer patches over a render you don't control. Use a hook from `primitives/`, named for what it waits on.
    - **no-dom-query**: Reach an element by its ref, not by `querySelector`.
    - **client-only**: Only `client/` talks to the services.
    - **no-comment**: Comments go stale and nothing checks them. Rename it, or write a test. Git leads from any line to the item or task that wrote it.
    - **no-disable**: No comment turns a rule off. If a rule is wrong for a case, change the rule and record why in the ledger.
    - **max-lines**: A file over 600 lines costs every agent that reads it. Split it along what it does.
    - **feature-reach**: Every feature folder holds a reach script, `reach.ts`: the developer's way to the feature as drive steps, ending on a snapshot of what it reaches. It is plain data that imports only types. Write one, then run it with `ashlar drive <feature>`.
    ## Folder rules
    ### Prices are cents (gotcha: SHOP-142)
    Every price in a feature is a whole number of cents. Show it with `formatPrice` from `packages/money`, never by
    dividing by 100 in the feature.
    ## Features
    - Cart: Open cart › Cart
    Section What it holds
    Areas The areas the paths touch, each with its owner.
    Owners The owner of each path that lies in no area, when there is one.
    Data rules onboard.dataRules, or the two defaults. Every brief has them.
    Ashlar’s rules here The rules the config leaves on that apply at those places, in the config's own words.
    Folder rules Each rule in .claude/rules/ whose paths match, and each rule with no paths, marked when it is a gotcha.
    Decisions The lines whose area covers the paths, and the lines for *.
    Features The features the paths touch, each with its reach.
    Open questions here The questions still open in those areas, each with who to ask. Only when onboard.owner is set.
  3. Know what it never holds. A brief carries no access line and no owner line: the owner shows in Areas instead. It carries nothing about other areas: the API's brief above has no rule for features and no cart. And it never holds a secret. When a knowledge file holds something shaped like one, the brief refuses to run:

    Terminal window
    $ pnpm exec ashlar brief apps/api/src/db
    Secrets never enter knowledge files, and these lines look like one:
    DECISIONS.md:9:57 holds what looks like a password or token.
    Take the value out. Say who grants access instead, as an `access` line, never the credential.

    It exits with 2. A brief covers files in the project only, and refuses paths none of which exist:

    Terminal window
    $ pnpm exec ashlar brief apps/nothing.ts
    None of these is in the project: apps/nothing.ts.
  4. Give a tool the JSON. --json prints the same brief as one object, for a tool that reads it:

    {
    "version": 1,
    "paths": ["apps/api/src/db/index.ts"],
    "areas": [{ "path": "apps/api/src/db", "name": "Db", "owner": "@lee" }],
    "owners": [{ "path": "apps/api/src/db/index.ts", "owner": "@lee" }],
    "dataRules": [
    "Real data never enters the repository: not in code, tests, fixtures or documents.",
    "Secrets are never printed, logged or written into the repository."
    ],
    "rules": [
    {
    "id": "public-api-only",
    "message": "Import another feature or area through its `index.ts`. If you need something inside it, it belongs in its index or in `shared/`."
    }
    ],
    "folderRules": [],
    "decisions": [
    {
    "date": "2026-12-02",
    "owner": "@lee",
    "areas": ["apps/api/src/db"],
    "kind": "rule",
    "text": "Every query goes through `rows`, so a test can swap the database."
    }
    ],
    "features": [],
    "questions": []
    }

    This is shortened: the real output lists every rule and decision the text shows. JSON outputs gives every field.

  5. Give the agent the onboard skill, so it reads its brief without being told:

    Terminal window
    $ pnpm exec ashlar skill onboard --write
    Wrote .claude/skills/onboard/SKILL.md.

    The skill tells the agent to run ashlar brief before it changes files, to add a line to DECISIONS.md only on a person's word, and never to put a secret or an account detail in the repository. It runs Ashlar the way your lockfile says, here with pnpm:

    # Know the area before you change it
    Before you change files, run `pnpm exec ashlar brief <the files or folders>`. It prints only what that area needs:
    the data rules, the rules that apply there, the folder rules and their gotchas, the decisions people made
    about it, the features it touches and the questions still open there. Follow what it says. It never holds
    access or account details, and you never ask for them.

    Without --write, the command prints the skill. A skill file you changed is kept:

    Terminal window
    $ pnpm exec ashlar skill onboard --write
    .claude/skills/onboard/SKILL.md differs from Ashlar's onboard skill: give `--force` to replace it with Ashlar's.

    --force replaces it with Ashlar's.