Skip to content

Commit cbfa387

Browse files
📖 [Docs]: Central agent model — descriptions, AGENTS.md/CLAUDE.md pointers, and a git-isolated workspace bootstrap (#31)
The agent model is now complete: agent roles are documented once in a central Agents section, every repository can point to them, and — the new piece — an agent's first instruction bootstraps a single, git-isolated local workspace so it always starts from the same docs and memory. ## New: The Agents section A new [Agents](https://msxorg.github.io/docs/Agents/) section documents the roles agents play — Define, Implement, Reviewer, Security Reviewer, and Agent Author — each grounded in the ways of working rather than restating them. ## New: The workspace bootstrap Each runtime's natively-read entry file (Copilot reads `AGENTS.md`; Claude Code reads `CLAUDE.md`, which imports the same instructions) becomes a thin **bootstrap**. Its first instruction clones the central repositories to a git-isolated workspace under `~/.msx`: - `~/.msx/docs` — how work is done (this documentation), read as local files. Changed through **pull requests**. - `~/.msx/memory` — durable notes and prior session context. Changed by **pushing to main**. Each clone carries repository-local git config only, so the workspace never touches the global git config or the repository being worked in. Setup is one idempotent script, `bootstrap/Initialize-MsxWorkspace.ps1`. ## New: AGENTS.md and CLAUDE.md pointer files The repository root carries an `AGENTS.md` and a `CLAUDE.md` that imports it, pointing to the central descriptions. ## Changed: The agent context model Agentic Development and AI-First Development now describe agent context as central descriptions in the docs plus per-repository pointer files and the local workspace bootstrap — not organization-wide agent files in a private repository. ## Technical Details - New `bootstrap/`: `Initialize-MsxWorkspace.ps1` (clone/pull plus isolated git config for `~/.msx/docs` and `~/.msx/memory`), `AGENTS.template.md` (the user-global entry instruction), and `README.md` (install steps for Claude Code and Copilot). - New `src/docs/Agents/`: `index.md` plus `define`, `implement`, `reviewer`, `security-reviewer`, `agent-author`. - New root `AGENTS.md` and `CLAUDE.md` (imports `AGENTS.md`). - `Agentic-Development.md` and `Principles/AI-First-Development.md`: plug-in, distribution, and three-layer models updated; added a "The workspace bootstrap" section; no `.github-private` reference remains. - `zensical.toml`: Agents added to navigation; index tables regenerated. - Companion repository created: `MSXOrg/memory` (private) holds the memory store; agents push notes there directly to main. - Validated locally: PSScriptAnalyzer clean, link/anchor and index checks pass, terminology casing verified. <details> <summary>Related issues</summary> - Fixes #30 - #27 </details>
1 parent b4138fc commit cbfa387

16 files changed

Lines changed: 573 additions & 7 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Follow the instructions in [AGENTS.md](../AGENTS.md).

‎AGENTS.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Agents
2+
3+
This repository is the central documentation for the MSX ecosystem. Everything an agent needs to work here — and the roles agents play across the ecosystem — is documentation, read the same way a new teammate would.
4+
5+
## Start here
6+
7+
1. Read this file, then the [README](README.md) for what this repository is and how it builds.
8+
2. Read the [Ways of Working](https://msxorg.github.io/docs/Ways-of-Working/) — how work flows from idea to delivery.
9+
3. Load the [Coding Standards](https://msxorg.github.io/docs/Coding-Standards/) relevant to the change.
10+
11+
## Roles
12+
13+
Agent behaviour is authored once, as documentation, in the [Agents](https://msxorg.github.io/docs/Agents/) section. Use the role that fits the task:
14+
15+
- [Define](https://msxorg.github.io/docs/Agents/define/) — capture, refine, and plan a change into an issue.
16+
- [Implement](https://msxorg.github.io/docs/Agents/implement/) — deliver a planned issue as a review-ready pull request.
17+
- [Reviewer](https://msxorg.github.io/docs/Agents/reviewer/) — review a pull request for delivery, taste, and security.
18+
- [Security Reviewer](https://msxorg.github.io/docs/Agents/security-reviewer/) — a structured, defensive security pass.
19+
- [Agent Author](https://msxorg.github.io/docs/Agents/agent-author/) — create and maintain these roles and pointers.
20+
21+
## How work happens here
22+
23+
- [Branching and Merging](https://msxorg.github.io/docs/Ways-of-Working/Branching-and-Merging/) and [Git Worktrees](https://msxorg.github.io/docs/Ways-of-Working/Git-Worktrees/) — the branch model and where to work.
24+
- [Contribution Workflow](https://msxorg.github.io/docs/Ways-of-Working/Contribution-Workflow/) — the draft-first, Copilot-review loop through to a ready pull request.
25+
- [Definition of Ready and Done](https://msxorg.github.io/docs/Ways-of-Working/Definition-of-Ready-and-Done/) — when a change is ready for review and when it lands.
26+
- This repository's build and checks — see the [README](README.md).
27+
28+
## The rule
29+
30+
This file points; it never defines. Process knowledge lives in the docs and is referenced by canonical URL — never copied here. See [Agentic Development](https://msxorg.github.io/docs/Ways-of-Working/Agentic-Development/).

‎CLAUDE.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@AGENTS.md
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# MSX workspace
2+
3+
The single starting point for any agent, in any repository. Before doing anything else, make sure the central workspace exists locally, then read from it.
4+
5+
## First — bootstrap the workspace
6+
7+
The workspace is a git-isolated clone of the central repositories under `~/.msx`. Set it up (idempotent — clones what is missing, attempts to fast-forward the rest):
8+
9+
```powershell
10+
$docs = Join-Path $HOME '.msx/docs'
11+
if ((Test-Path $docs) -and -not (Test-Path (Join-Path $docs '.git'))) {
12+
throw "$docs exists but is not a git repository. Remove it and re-run."
13+
}
14+
if (-not (Test-Path (Join-Path $docs '.git'))) {
15+
New-Item -ItemType Directory -Force -Path (Split-Path -Parent $docs) | Out-Null
16+
git clone https://github.com/MSXOrg/docs.git $docs
17+
if ($LASTEXITCODE -ne 0) {
18+
throw "git clone of MSXOrg/docs failed (exit $LASTEXITCODE). Check network access and github.com credentials, then re-run."
19+
}
20+
}
21+
pwsh (Join-Path $docs 'bootstrap/Initialize-MsxWorkspace.ps1')
22+
```
23+
24+
This produces:
25+
26+
- `~/.msx/docs` — how work is done: ways of working, coding standards, and agent roles. The same content published at <https://msxorg.github.io/docs/>.
27+
- `~/.msx/memory` — what has been learned before: durable notes and prior session context.
28+
29+
Each clone has repository-local git config only; it never modifies the global git config or the repository being worked in (git still reads them, but only repository-local config is written).
30+
31+
> `MSXOrg/memory` is private — the bootstrap needs access to it (and working github.com credentials) for the memory clone.
32+
33+
## Then — read before acting
34+
35+
1. Read the relevant pages under `~/.msx/docs` for the task at hand.
36+
2. Read `~/.msx/memory` for prior decisions, pitfalls, and context.
37+
38+
## Two write rules
39+
40+
- **Docs change through pull requests.** Branch inside `~/.msx/docs` and open a pull request; never push its `main`.
41+
- **Memory pushes to main.** Commit and push notes directly inside `~/.msx/memory`; no pull request.
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#!/usr/bin/env pwsh
2+
#Requires -Version 7.0
3+
4+
<#
5+
.SYNOPSIS
6+
Clone or update the MSX central workspace (docs + memory) in a git-isolated location under $HOME.
7+
8+
.DESCRIPTION
9+
The single starting point for every agent. It ensures the central
10+
documentation and memory repositories exist locally under one dedicated
11+
workspace, so an agent reads the same evergreen docs and the same prior
12+
memory regardless of which repository it is working in.
13+
14+
The workspace is deliberately kept separate from the repositories an agent
15+
works in:
16+
17+
- Each clone gets repository-local git config only. Nothing here modifies the
18+
global git config or the working repository's config; git still reads global
19+
and system config as usual, but this script writes only repository-local config.
20+
- Documentation (MSXOrg/docs) is context and is changed through pull requests
21+
only; this script never pushes its main branch.
22+
- Memory (MSXOrg/memory) is append-only context; notes are committed and
23+
pushed to main directly, without a pull request.
24+
25+
The script is idempotent: it clones what is missing and attempts to
26+
fast-forward what is already present, leaving a repository unchanged (with a
27+
warning) when it cannot fast-forward.
28+
29+
.EXAMPLE
30+
./Initialize-MsxWorkspace.ps1
31+
Clones missing repositories and attempts to fast-forward existing ones under ~/.msx.
32+
33+
.EXAMPLE
34+
./Initialize-MsxWorkspace.ps1 -Root /work/.msx -Verbose
35+
Uses a custom workspace root and logs each step.
36+
37+
.OUTPUTS
38+
[pscustomobject] with Repository, Path, and Changes for each workspace repository.
39+
#>
40+
[CmdletBinding(SupportsShouldProcess)]
41+
param(
42+
# The workspace root under which 'docs' and 'memory' are placed.
43+
[Parameter()]
44+
[ValidateNotNullOrEmpty()]
45+
[string] $Root = (Join-Path $HOME '.msx'),
46+
47+
# The git author name written to each clone's local config.
48+
[Parameter()]
49+
[ValidateNotNullOrEmpty()]
50+
[string] $UserName = 'Marius Storhaug',
51+
52+
# The git author email written to each clone's local config.
53+
[Parameter()]
54+
[ValidateNotNullOrEmpty()]
55+
[string] $UserEmail = 'MariusStorhaug@users.noreply.github.com'
56+
)
57+
58+
Set-StrictMode -Version Latest
59+
$ErrorActionPreference = 'Stop'
60+
61+
if ((-not $PSBoundParameters.ContainsKey('UserName')) -or (-not $PSBoundParameters.ContainsKey('UserEmail'))) {
62+
Write-Warning "Using part of the default maintainer identity ($UserName <$UserEmail>). Pass both -UserName and -UserEmail to attribute your own commits (memory pushes to main)."
63+
}
64+
65+
$repositories = @(
66+
[pscustomobject]@{ Name = 'docs'; Url = 'https://github.com/MSXOrg/docs.git'; Changes = 'pull requests' }
67+
[pscustomobject]@{ Name = 'memory'; Url = 'https://github.com/MSXOrg/memory.git'; Changes = 'push to main' }
68+
)
69+
70+
if ($PSCmdlet.ShouldProcess($Root, 'Create workspace root')) {
71+
New-Item -ItemType Directory -Force -Path $Root | Out-Null
72+
}
73+
74+
$results = foreach ($repo in $repositories) {
75+
$path = Join-Path $Root $repo.Name
76+
if (Test-Path (Join-Path $path '.git')) {
77+
if ($PSCmdlet.ShouldProcess($path, 'Fetch and fast-forward')) {
78+
Write-Verbose "Updating $path"
79+
git -C $path fetch origin --quiet
80+
if ($LASTEXITCODE -ne 0) {
81+
throw "git fetch failed for '$path' (exit $LASTEXITCODE). Check network access and credentials for $($repo.Url)."
82+
}
83+
git -C $path pull --ff-only --quiet
84+
if ($LASTEXITCODE -ne 0) {
85+
Write-Warning "Could not fast-forward '$path' (local changes or diverged history). Left as-is."
86+
}
87+
}
88+
} else {
89+
if (Test-Path $path) {
90+
throw "Cannot clone into '$path': it exists but is not a git repository. Remove it or choose a different -Root."
91+
}
92+
if ($PSCmdlet.ShouldProcess($repo.Url, "Clone into '$path'")) {
93+
Write-Verbose "Cloning $($repo.Url) into $path"
94+
git clone --quiet $repo.Url $path
95+
if ($LASTEXITCODE -ne 0) {
96+
throw "git clone failed for $($repo.Url) (exit $LASTEXITCODE). Check access and credentials (MSXOrg/memory is private)."
97+
}
98+
}
99+
}
100+
101+
# Isolated identity: write repository-local config only. Git still reads
102+
# global and system config; the script never writes to them.
103+
if ($PSCmdlet.ShouldProcess($path, 'Set repository-local git identity')) {
104+
git -C $path config user.name $UserName
105+
if ($LASTEXITCODE -ne 0) { throw "git config user.name failed for '$path' (exit $LASTEXITCODE)." }
106+
git -C $path config user.email $UserEmail
107+
if ($LASTEXITCODE -ne 0) { throw "git config user.email failed for '$path' (exit $LASTEXITCODE)." }
108+
}
109+
110+
[pscustomobject]@{ Repository = $repo.Name; Path = $path; Changes = $repo.Changes }
111+
}
112+
113+
$results

‎bootstrap/README.md‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Bootstrap
2+
3+
The single starting point for agents: a git-isolated local clone of the MSX central repositories under `~/.msx`, plus the instruction that sends every agent there first.
4+
5+
## Contents
6+
7+
- `Initialize-MsxWorkspace.ps1` — idempotent setup. Clones `MSXOrg/docs` and `MSXOrg/memory` under `~/.msx`, attempts to fast-forward them if present, and writes a repository-local git identity so the workspace never modifies the global git config.
8+
- `AGENTS.template.md` — the user-global entry instruction. It bootstraps the workspace, then points the agent at the docs and memory. Install it once per machine (below).
9+
10+
## The model
11+
12+
- `~/.msx/docs` is **read context** — the ways of working, coding standards, and agent roles. Changes to it go through **pull requests**.
13+
- `~/.msx/memory` is **append-only context** — durable notes and session history. Changes to it are **pushed to main**.
14+
15+
> **Prerequisite:** `MSXOrg/memory` is a private repository — the bootstrap needs access to it (and working github.com credentials) to clone or update memory.
16+
17+
Keeping the workspace separate and git-isolated means an agent reads the same docs and memory in every repository, and its commits there use the workspace identity rather than whatever the working repository or the global config happens to be set to.
18+
19+
## Install (once per machine)
20+
21+
Run the bootstrap:
22+
23+
```powershell
24+
$docs = Join-Path $HOME '.msx/docs'
25+
if ((Test-Path $docs) -and -not (Test-Path (Join-Path $docs '.git'))) {
26+
throw "$docs exists but is not a git repository. Remove it and re-run."
27+
}
28+
if (-not (Test-Path (Join-Path $docs '.git'))) {
29+
New-Item -ItemType Directory -Force -Path (Split-Path -Parent $docs) | Out-Null
30+
git clone https://github.com/MSXOrg/docs.git $docs
31+
if ($LASTEXITCODE -ne 0) {
32+
throw "git clone of MSXOrg/docs failed (exit $LASTEXITCODE). Check network access and github.com credentials, then re-run."
33+
}
34+
}
35+
pwsh (Join-Path $docs 'bootstrap/Initialize-MsxWorkspace.ps1')
36+
```
37+
38+
Wire it into the tools so it runs as the first instruction:
39+
40+
- **Claude Code** reads `CLAUDE.md`. Add an import to `~/.claude/CLAUDE.md`:
41+
42+
```text
43+
@~/.msx/docs/bootstrap/AGENTS.template.md
44+
```
45+
46+
- **Copilot** reads `AGENTS.md` natively. Install the contents of `AGENTS.template.md` as your **user-level** Copilot instructions so it applies in every repository. Per-repository `AGENTS.md` files stay thin pointers to the central docs — don't put the bootstrap there.
47+
48+
## Identity
49+
50+
The script writes a repository-local git identity to each clone. The default is the maintainer's GitHub **noreply** identity, so no personal email is written into git config and commits still attribute to the maintainer. Override it with `-UserName` / `-UserEmail`, or point it at a dedicated agent account when one exists.
51+
52+
> **Override this if you are not the maintainer.** With the default, commits — including memory pushes to `main` — are attributed to the maintainer's account. Pass `-UserName` and `-UserEmail` (for example `-UserEmail 'you@users.noreply.github.com'`), or point the script at a dedicated agent account, so your commits are attributed correctly.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: Agent Author
3+
description: Create and maintain the agent role descriptions and the per-repository pointer files that reference them.
4+
---
5+
6+
# Agent Author
7+
8+
Create and maintain the agent roles in this section, and the per-repository pointer files that reference them. Every role description is grounded in the [Ways of Working](../Ways-of-Working/index.md); every pointer file stays thin. Agent Author keeps descriptions and pointers honest — it does not encode standards into either.
9+
10+
## When to use
11+
12+
Create a new agent role, update an existing one, review agent quality, or refactor a bloated agent file back into a thin pointer over the docs.
13+
14+
## Flow
15+
16+
### 1. Gather requirements
17+
18+
1. Identify the role — the single job it owns, and its boundary.
19+
2. Identify the docs pages that govern that role; confirm they exist.
20+
3. Identify what the role must **not** do — boundaries prevent scope creep.
21+
22+
### 2. Author the description
23+
24+
Write the role as a page in this section, following the shape of its siblings: front matter (`title`, `description`), a one-paragraph role and boundary, when to use, a numbered flow, operating rules, and a "Where this connects" list.
25+
26+
- **Link, don't inline.** If a standard exists in the docs, link to it — never paste it in.
27+
- **Procedural, not conversational.** Numbered imperatives, no filler.
28+
- **Keyword-rich description.** The front-matter `description` is the discovery surface.
29+
30+
### 3. Keep pointers thin
31+
32+
A repository never carries a copy of a role. Its `AGENTS.md` — and the `CLAUDE.md` that imports it — point to these pages and add only repo-specific nuance and the genuinely tool-specific settings (permission scopes, model choice) that cannot be expressed as a pointer. When a new runtime is adopted, add a thin pointer; do not move process knowledge into it. See [Agentic Development](../Ways-of-Working/Agentic-Development.md).
33+
34+
### 4. Validate
35+
36+
1. Front-matter YAML parses cleanly.
37+
2. Every link resolves, and the body duplicates no doc content.
38+
3. The role is added to the navigation so its index row generates.
39+
40+
## Operating rules
41+
42+
1. Docs are the source of truth. If a standard is missing, propose adding it to the docs — do not embed it in an agent.
43+
2. One agent, one job. Multiple roles mean multiple pages.
44+
3. Update the navigation when adding or removing a role.
45+
46+
## Where this connects
47+
48+
- [Agentic Development](../Ways-of-Working/Agentic-Development.md) — the pointer model this maintains.
49+
- [Documentation Model](../Ways-of-Working/Documentation-Model.md) — how these pages stay evergreen.

‎src/docs/Agents/define.md‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: Define
3+
description: Capture, refine, and plan a change into an actionable issue ready for implementation.
4+
---
5+
6+
# Define
7+
8+
Take something someone wants — a feature, a bug, an improvement, external feedback, or a production signal — and turn it into a planned, actionable issue. The output is either a single Task with its three sections populated, or a decomposed initiative with structured sub-issues. Define plans work; it does not build it.
9+
10+
## When to use
11+
12+
Capture a desire for change, write an issue, plan work, decompose an epic, refine a bug report, create sub-issues, structure a feature request, or turn feedback into a task.
13+
14+
## Input
15+
16+
A description of a desired change, a feedback issue from a non-contributor (treated as input, never modified), a platform signal (error, failed run, alert), or an existing issue to refine.
17+
18+
## Flow
19+
20+
### 1. Capture
21+
22+
Turn the input into an issue with Section 1 (context and request).
23+
24+
1. Search for duplicates first — propose consolidation rather than creating a new issue.
25+
2. Frame from the user's perspective per [Issue Format](../Ways-of-Working/Issue-Format.md).
26+
3. Acceptance criteria must be user-observable and testable.
27+
28+
### 2. Refine
29+
30+
Ground the issue so anyone reading it agrees on what "done" means, up to the [Definition of Ready](../Ways-of-Working/Definition-of-Ready-and-Done.md).
31+
32+
1. Pain before solution — push back on implementation-framed requests.
33+
2. Make assumptions explicit.
34+
3. Acceptance criteria answerable yes or no by a non-author.
35+
4. Ask one question at a time when interactive.
36+
37+
### 3. Plan
38+
39+
Decide how the work will happen and record the decisions.
40+
41+
1. **Task** — one deliverable, one pull request. Populate the technical decisions and the implementation plan per [Issue Format](../Ways-of-Working/Issue-Format.md).
42+
2. **Larger work** — decompose into child issues per [Issue Hierarchy](../Ways-of-Working/Issue-Hierarchy.md).
43+
3. Find the minimum viable path — spike, then proof of concept, then minimum viable product, then improve.
44+
4. Record decisions with their rationale and the alternatives considered.
45+
5. Resolve open questions before finishing; defer anything that does not block this slice to a follow-up issue.
46+
47+
## Operating rules
48+
49+
1. Tone is impersonal. The issue description is the source of truth; comments record what changed.
50+
2. External references are hyperlinks.
51+
3. Do not modify a feedback issue from a non-contributor — create an internal issue and cross-link.
52+
4. Stop when the issue is plannable. Do not build, branch, or open pull requests — that is [Implement](implement.md).
53+
54+
## Where this connects
55+
56+
- [Workflow](../Ways-of-Working/Workflow.md) — the loop this opens.
57+
- [Issue Format](../Ways-of-Working/Issue-Format.md) and [Issue Hierarchy](../Ways-of-Working/Issue-Hierarchy.md) — issue structure and levels.
58+
- [Definition of Ready and Done](../Ways-of-Working/Definition-of-Ready-and-Done.md) — the readiness bar this aims for.

0 commit comments

Comments
 (0)