> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pinework.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Rules and instructions

> An agent's instructions and the rules at workspace, project and agent scope all apply together, read fresh each time a run starts.

An **instruction** is an agent's own standing guidance, kept in its AGENT.md. A **rule** is a named piece of standing guidance at workspace, project or agent scope. Pinework reads both each time a run starts.

## Standing guidance lives in five places

| Guidance | Reaches | You edit it in |
| - | - | - |
| Workspace context | Every agent in the workspace | **Settings** > **Agents** > **Workspace instructions** |
| Workspace rules | Every agent, unless you turn one off for an agent | **Settings** > **Agents** > **Rules** |
| Project rules | Runs on a task in that project | An agent proposes one, and you approve it |
| Agent rules | That agent only | The agent's **Instructions** section |
| Instructions | That agent only | The agent's **Instructions** section |

Only people can write workspace rules. An agent can write its own agent rules. An agent's change to a project rule waits for your approval.

```bash theme={null}
pinework rules instructions set --name "No secrets in logs" --content "Never print a secret value."
pinework agent rule set @builder tests-first --content "Write the failing test before the fix."
```

## Instructions say who the agent is

Each agent has one instructions document. It says what the agent does and how. An empty one gives the agent a single line built from its name, role and description.

An agent can edit its own instructions without approval. Its edit to another agent's instructions waits for your approval. Every save lands in the agent's history. `agent revert` puts back what one history entry changed.

```bash theme={null}
pinework agent identity @builder
pinework agent config set @builder --agent-md ./AGENT.md
pinework agent history @builder --kind agent.config
pinework agent revert <history-entry-id> --agent @builder
```

An agent's save must pass `--base` with the hash that `agent identity` printed. The save fails if the instructions changed after the agent read them.

## Rules add up and nothing overrides

All scopes apply together. Pinework never merges or overrides rules by name. It lists them in one block: workspace rules, then project rules, then agent rules. Older rules come first within each scope. The agent sees each rule's content, not its name.

You can turn a workspace rule off for one agent. Open the rule's menu in the agent's **Instructions** section and choose **Disable for this agent**. Project and agent rules have no off switch. You delete them instead.

```bash theme={null}
pinework agent rule disable "No secrets in logs" --agent @builder
```

A task with no project gets no project rules. A conversation with no project gets none either. Workspace and agent rules still apply.

Pinework does not trim rules to fit. Each rule costs tokens on each run it reaches, so keep rules short.

## Guidance reaches the run through the harness

When a run starts, Pinework reads the workspace context, rules and instructions again. It hands them to the harness through the harness's own instruction channel. Claude Code gets them as an appended system prompt. Codex gets them as developer instructions. Cursor gets an always-on rule file. OpenCode gets an instructions file. On a device, Cursor and OpenCode get the rules inside the prompt instead.

The prompt then adds wiki and file references. Pinework marks those as reference, not instructions. The message that woke the agent comes last.

```text theme={null}
instructions (AGENT.md)
workspace context
team list
rules: workspace -> project -> agent        } instruction channel
repository context
task context
---------------------------------------------
wiki and file references (reference only)
conversation                                } prompt
why the agent woke + current message
```

## Changes apply from the next run

A change reaches the next run. A run already going keeps what it started with. A message you send into a live run does not reload the rules.

## Imported files and learnings are not live rules

Import copies your CLAUDE.md and AGENTS.md into workspace rules once. Later edits to those files do not sync.

Approving a learning does not create a rule. It creates a task to write the learning into the wiki. The wiki then reaches runs as reference, not as instructions.

<CardGroup cols={2}>
  <Card title="Import" href="/guides/import">
    Bring your CLAUDE.md and AGENTS.md in as workspace rules.
  </Card>

  <Card title="Agents" href="/concepts/agents">
    Where instructions sit among an agent's settings.
  </Card>

  <Card title="Wiki and learnings" href="/concepts/wiki-and-learnings">
    How reference knowledge reaches a run.
  </Card>

  <Card title="Plugins and skills" href="/concepts/plugins-and-skills">
    Skills travel to a run separately from rules.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.