Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
db6e1c7
feat(instructions)!: generate targets from instruction files
showxu Oct 26, 2026
1c6f567
fix(instructions): align doctor, install and init with own files
showxu Oct 26, 2026
f7125ce
fix(instructions): own targets by their notice and harden placement
showxu Oct 26, 2026
66d75ff
fix(instructions): keep selection, restore and watch to their inputs
showxu Oct 26, 2026
50d44ba
docs: generate AGENTS.md from instruction units
showxu Oct 26, 2026
28abb80
ci: pin shared workflows to the policy that accepts instruction files
showxu Oct 26, 2026
0a4c560
docs(instructions): drop the vendor link from the design references
showxu Oct 26, 2026
063fecb
fix(cache): keep dangling symbolic links that stay inside the tree
showxu Oct 26, 2026
38d667d
ci: pin shared workflows to the policy that keeps nested private stat…
showxu Oct 26, 2026
c62338c
docs: commit the project declaration and lock
showxu Oct 26, 2026
7d57573
docs: ask for actionlint on workflow changes
showxu Oct 26, 2026
f81c9fe
docs: route module boundaries to the package architecture
showxu Oct 26, 2026
318acf9
fix(cache): resolve links inside the root as the kernel does
showxu Oct 26, 2026
16452c2
fix(cache): split link paths at slash bytes and stop before missing p…
showxu Oct 26, 2026
a97e3db
feat(state): write the declaration and lock in Prettier's JSON layout
showxu Oct 26, 2026
89b3880
ci: pin shared workflows to the merged instruction files policy
showxu Oct 26, 2026
c463c12
chore(release): prepare 0.2.0
showxu Oct 26, 2026
8df88c2
docs: follow the organization standard's default branch
showxu Oct 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .agent/agents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"instructions": {
"agents": ["claude-code", "codex"],
"sections": [
"guide",
"agents-tools:shared/swift-package-route",
"agents-tools:shared/swift-package-tests"
]
},
"sources": {
"agents-tools": {
"branch": "master",
"git": "github.com/agents-tools/.github",
"path": ".agent"
}
}
}
47 changes: 47 additions & 0 deletions .agent/agents.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"instructions": {
"chatgpt": {},
"sections": [
{
"hash": "sha256:b954b104c6cf0639214a105a846d4fc8e73fd55f14eb695f407f942b905bf22e",
"name": "guide",
"path": ".agent/instructions/guide.md",
"source": "."
},
{
"hash": "sha256:a45b15d662eecec4b252fa2e35a608bab0ee137fae525669097f45d0f8c3f39d",
"name": "shared/swift-package-route",
"path": ".agent/instructions/shared/swift-package-route.md",
"revision": "fc8a2fc1b9d5dcea39788d0c70cd35dded2673ea",
"source": "github.com/agents-tools/.github"
},
{
"hash": "sha256:5d9f40d101938d2805482b9a147397bc07e9c3c9223cfe040f0905cb6c746825",
"name": "shared/swift-package-tests",
"path": ".agent/instructions/shared/swift-package-tests.md",
"revision": "fc8a2fc1b9d5dcea39788d0c70cd35dded2673ea",
"source": "github.com/agents-tools/.github"
}
],
"targets": {
"AGENTS.md": {
"agents": ["claude-code", "codex"],
"blockHash": "sha256:a025a4ce7d403ace72e30ffe5b2922f571c44f0f6ea52998f5a1bfe6a7ee3fd6",
"created": false,
"headingOffset": 0
}
}
},
"skills": {},
"sources": {
"github.com/agents-tools/.github": {
"kind": "git",
"path": ".agent",
"requirement": {
"branch": "master"
},
"url": "https://github.com/agents-tools/.github"
}
},
"version": 1
}
22 changes: 22 additions & 0 deletions .agent/instructions/guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
description: Keep agents-tools/core's modules, dependency direction and public surface within their boundaries.
---
# core Agent Guide

## Task Route

- Run the build, test and strict formatting checks in `README.md#development`
before handoff.
- For workflow changes, run `actionlint` on every workflow.
- Community files and templates are organization defaults in
`agents-tools/.github`; this repository keeps `CODEOWNERS`, the Dependabot
configuration and workflow callers under `.github/`.

## Module Boundaries

- Keep each target's responsibilities, dependencies and access levels as
`Documentation/Architecture/Package.md` states, and update it with the
dependency graph in `Package.swift`.
- Keep package-domain prefixes out of internal target names unless the package
boundary stops making that context clear.
- Disable automatic maintenance and gc in fixture Git repositories.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
permissions:
contents: read
actions: read
uses: agents-tools/github-workflows/.github/workflows/swift-package.yml@3fb2887e2831d9d5a287af73819e2ba3a39d0045
uses: agents-tools/github-workflows/.github/workflows/swift-package.yml@bb0a8c8c39827a364b9d3cbf4069754e7d975586
2 changes: 1 addition & 1 deletion .github/workflows/source-policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:
jobs:
policy:
if: github.event_name != 'push' || !github.event.deleted
uses: agents-tools/github-workflows/.github/workflows/policy.yml@3fb2887e2831d9d5a287af73819e2ba3a39d0045
uses: agents-tools/github-workflows/.github/workflows/policy.yml@bb0a8c8c39827a364b9d3cbf4069754e7d975586
with:
allow-terms: |
ChatGPT
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.DS_Store
.agent/
.vscode/
/.build
/Packages
Expand All @@ -9,3 +8,7 @@ DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
/.agent/*
!/.agent/instructions/
!/.agent/agents.json
!/.agent/agents.resolved
105 changes: 34 additions & 71 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,81 +1,44 @@
# core Agent Guide

Read `README.md` first for repository purpose, library API, and development
entry points.
<!-- Generated by agents from instruction files. Edit those files and run `agents update`. -->

## First-Principles Work

- Name the behavior, root cause, invariant, owner, data flow, and validation
before changing reusable files.
- Change the owning layer, not the nearest convenient file.
- Keep changes traceable to the request, source evidence, or owning invariant.
- Validate with package-local checks when behavior changes.
# core Agent Guide

## Task Route

- For documentation placement, read `Documentation/README.md` before editing.
- For current package structure, read `Documentation/Architecture/README.md`
and the relevant architecture files.
- For unresolved design work, use `Documentation/Proposals/*`.
- For durable rationale, use `Documentation/Decisions/*`.
- For migration notes, use `Documentation/Migrations/*`.
- For retired material, use `Documentation/Archive/*`.
- For supporting details and examples, use `Documentation/Reference/*`.
- Run the build, test and strict formatting checks in `README.md#development`
before handoff.
- For workflow changes, run `actionlint` on every workflow.
- Community files and templates are organization defaults in
`agents-tools/.github`; this repository keeps `CODEOWNERS`, Dependabot
`agents-tools/.github`; this repository keeps `CODEOWNERS`, the Dependabot
configuration and workflow callers under `.github/`.
- Follow the organization [maintenance change flow](https://github.com/agents-tools/.github/blob/master/MAINTENANCE.md#change-flow).

## Authority

- `AGENTS.md` is the agent guide for repository work.
- `README` files index scope and placement.
- `Documentation/Architecture/*` states current truth.
- `Documentation/Proposals/*` is design-in-progress.
- `Documentation/Decisions/*`, `Documentation/Migrations/*`, and
`Documentation/Archive/*` are history.
- `.github/*` is GitHub-facing workflow metadata.

## Boundary Guardrails

- Do not promote machine-local paths, one-run state, fixture-only values, or
temporary execution state into reusable docs, scripts, templates, or
automation.
- If a value changes by input or environment, pass it in, configure it, derive
it, or link to the owning artifact.
- Keep command parsing and terminal behavior in consuming repositories.
- Keep shared source, registry, lock, and watch behavior in `AgentsCore`; skill
discovery and lifecycle behavior belongs in `AgentsSkills`.
- `AgentsCore` must not depend on `AgentsSkills`. Yams belongs to `AgentsSkills`.

## Tests

- Run the build, test and strict formatting checks in
[README.md](README.md#development) before handoff. The required CI contexts
are `policy / policy` and `validate / result`; keep their caller job
IDs and shared workflow pins consistent with the
[shared workflow reference](https://github.com/agents-tools/github-workflows#configuration).
Shared CI compiles and tests only with the latest stable Xcode selected in
`.github/swift-package.json`.
Render and check the social preview locally with the github-readme-design
toolchain against `agents-tools/.github`'s DESIGN, fonts and catalog; see
`Documentation/Reference/Presentation.md`. Commit the resulting assets.
For workflow edits, also run `actionlint` on every workflow.
- Pass an explicit initial branch when creating Git fixtures.
- Disable automatic maintenance and gc in fixture Git repositories.
- Each test that creates a temporary directory removes it.
- Run tests with agent configuration variables unset:

```bash
env -u CODEX_HOME -u CLAUDE_CONFIG_DIR -u XDG_CONFIG_HOME -u XDG_STATE_HOME -u XDG_CACHE_HOME swift test
```

## Operating Notes
## Module Boundaries

- Keep each target's responsibilities, dependencies and access levels as
`Documentation/Architecture/Package.md` states, and update it with the
dependency graph in `Package.swift`.
- Keep package-domain prefixes out of internal target names unless the package
boundary stops making that context clear.
- Keep shared primitives and source resolution in `Sources/AgentsCore`.
- Keep skill discovery, installation, and orchestration in `Sources/AgentsSkills`.
- Expose consumer operations and their models publicly; keep implementation
details internal or package-visible when shared between the two targets.
- Run `swift test` before handing off behavior changes.
- Disable automatic maintenance and gc in fixture Git repositories.

## Package Route

- Read `README.md` and, when present, `CONTRIBUTING.md` before editing, and
follow the organization
[maintenance change flow](https://github.com/agents-tools/.github/blob/master/MAINTENANCE.md#change-flow).
- Before changing versions, dependencies, packaging or release workflows, read
the organization [VERSIONING](https://github.com/agents-tools/.github/blob/master/VERSIONING.md)
and `Documentation/Reference/Release.md`.
- `.github/swift-package.json` configures package validation; the required
checks are `policy / policy` and `validate / result`. Keep shared workflow
callers pinned to one full commit of agents-tools/github-workflows.
- Read toolchain and deployment minimums from `Package.swift` and
`.github/swift-package.json` instead of restating them.
- Read `Documentation/README.md` before placing documentation and
`Documentation/Architecture/README.md` before changing package structure.

## Test Isolation

- Run tests with an isolated `HOME` and with `CODEX_HOME`, `CLAUDE_CONFIG_DIR`
and the `XDG_*` variables unset; never inherit agent or Git configuration.
- Create Git fixtures with an explicit initial branch, and remove every
fixture and temporary directory a test creates.
71 changes: 71 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,77 @@ publication follows the [release checklist](Documentation/Reference/Release.md).

## Unreleased

## 0.2.0 - 2026-10-27

### Added

- Instructions files may sit in subdirectories of `instructions/` and
`.agents/instructions/`; a file's name is its container-relative path, such
as `epd/review`.
- A project's own instructions in `.agent/instructions/` are selected by bare
name and read from the working tree. `InstructionAddOptions(source: ".")`
adds them; `listOwn(environment:)` lists them. Restoring a lock fails with
`InstructionError.ownChanged` when an own file changed since the lock.
- Front matter `paths` scopes a section: its patterns are named after its first
heading, and in project scope the section is written to the `AGENTS.md` of
the directory the patterns share.
- `InstructionOperations.export(projectRoots:environment:)` maps the locked
targets of the user scope and given projects to their sections.
- Doctor reports own files changed since the lock and links in generated
targets that no longer resolve.

### Changed

- **Breaking:** an instructions file needs front matter with a `description`,
and its body may start at any heading level. Add front matter to existing
files; headings are written as authored.
- **Breaking:** targets are generated in full: a notice line followed by the
sections. Custom content in targets, managed blocks, title detection, heading
offsets and adoption of matching custom sections are gone. Move hand-written
content into instructions files. A file is owned when it is blank or starts
with the notice; writing over any other file needs `replace`, and
`InstructionError.unownedTargets` names it. Upgrading from 0.1.2 therefore
takes over targets that kept custom content only with `replace`.
- **Breaking:** `InstructionTargetChange.assembly` is replaced by `foreign`,
and `InstructionDrift` is `clean`, `drifted` or `missing`. Diagnostic kinds
`missingBlock`, `adoption` and `conflict` are removed; `missingTarget`,
`foreignTarget`, `ownChanged` and `invalidLink` are added.
- **Breaking:** `initializeInstructions(named:environment:)` replaces
`initializeInstructions(named:directory:)` and creates
`.agent/instructions/<name>.md` in the project, using the project's state
lock.
- A declaration may omit `sources`.
- `agents.json` and `agents.resolved` are written in Prettier's default JSON
layout: two-space indentation, `"key": value`, expanded objects, empty
containers as `{}` and `[]`, and an array on one line when it fits in 80
columns. Any operation that writes state rewrites a file in another layout,
such as the one earlier versions wrote, even when its content is unchanged.
Empty lock sections remain so earlier readers decode the lock.
- A local link in a section must resolve, from the target, to a file in the
checkout being written; user targets accept no local links.
- Removing a name that equals a declared reference removes that reference, so
an own file's bare name no longer collides with a source's same-named file.
- Install restores the locked Claude import files instead of recomputing them.
- A nested target's directory cannot be a symbolic link, `.git`, or inside
another repository. Discovery skips `AGENTS.md` and `GEMINI.md` in
containers, and a symbolic link at or below a source's search path is an
error.
- Doctor reports a Claude file that keeps Claude Code from reading a generated
nested `AGENTS.md`, and checks root forwarding only when the root
`AGENTS.md` is a Claude target.
- A target that no longer receives sections is deleted only while it equals its
locked rendering.

### Fixed

- Materializing a source and copying a subtree keep a dangling symbolic link
that stays inside, such as one to an uncommitted file, instead of rejecting
the whole source; a link that leaves the tree is still rejected.
- Doctor's Codex size check counts only the project chain, as Codex does: the
user file is loaded separately without a limit, separators are not counted,
whitespace-only files add nothing, fallback names apply in every directory,
and an existing `AGENTS.override.md`, even an empty one, hides `AGENTS.md`.

## 0.1.2 - 2026-10-25

### Added
Expand Down
Loading
Loading