Skip to content

Use authored root AGENTS.md for shared instructions - #22

Merged
zbeyens merged 3 commits into
mainfrom
codex/consolidate-root-agents
Sep 24, 2026
Merged

zbeyens merged 3 commits into
mainfrom
codex/consolidate-root-agents

Conversation

@zbeyens

@zbeyens zbeyens commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Use the repository root AGENTS.md as the authored shared instruction source for current agents.
  • Stop generating or backing up AGENTS.md and CLAUDE.md; move project Skiller configuration to .agents/skiller.toml.
  • Update init, apply/revert, nested mode, sync/presets, MCP routing, documentation, fixtures, and tests.
  • Remove obsolete marker/duplication and unsupported-agent tests that only covered deleted behavior.
  • Add a minor changeset for the release PR and align pnpm-lock.yaml for frozen installs.

Verification

  • pnpm install --frozen-lockfile
  • npm run lint
  • npm test — 128 suites / 808 tests passed
  • npm run build

npm ci is not applicable because this pnpm repository has no package-lock.json.

@changeset-bot

changeset-bot Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fa90f8d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
skiller Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T18:27:49.629929Z c110f38 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c110f380c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 511 to 512
}
await planFileMigration(
path.join(legacyDir, PROJECT_AGENTS_FILE),
path.join(canonicalDir, PROJECT_AGENTS_FILE),
plannedWrites,
deletePaths,
conflicts,
);
if (!(await pathExists(canonicalSkillsDir))) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Migrate legacy instructions to the authored root

When an existing .claude project is upgraded, this migration still moves skiller.toml into .agents but now leaves .claude/AGENTS.md behind. Subsequent rule discovery uses the new .agents configuration and only reads the repository-root AGENTS.md, so projects without an already-authored root file silently lose all legacy shared instructions after their first apply; migrate the legacy file to the root when that destination is available, and handle conflicts explicitly.

Useful? React with 👍 / 👎.

Comment thread src/core/FileSystemUtils.ts Outdated
Comment on lines +249 to +253
.filter((file) => file.path !== path.join(skillerDir, PROJECT_AGENTS_FILE))
.sort((a, b) => a.path.localeCompare(b.path));

for (const f of processedFiles) {
if (primaryFile && f.path === primaryFile.path) continue;
others.push(f);
if (path.basename(skillerDir) !== CANONICAL_SKILLER_DIR) {
return supplementalFiles;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep global AGENTS.md in rule discovery

For configurations created by skiller init --global, skillerDir is $XDG_CONFIG_HOME/skiller, and the initializer writes the instructions to that directory's AGENTS.md. This filter removes that file and the non-.agents early return prevents any replacement from being prepended, so applying a global-only configuration ignores the instructions that init --global just created.

Useful? React with 👍 / 👎.

Comment thread src/agents/AiderAgent.ts

async applySkillerConfig(
concatenatedRules: string,
_concatenatedRules: string,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Point Aider at the authored root instructions

When an existing Aider configuration has output_path or output_path_instructions, this change stops generating that custom file but the later .aider.conf.yml logic still adds its basename to read. Aider therefore reads a missing or stale legacy file instead of the authored root AGENTS.md; now that instruction output overrides are intentionally ignored, the generated Aider configuration must also ignore those overrides.

Useful? React with 👍 / 👎.

Comment on lines +235 to +236
if (path.relative(presetRoot, sourcePath) === 'AGENTS.md') {
return 'AGENTS.md';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accept externally included root AGENTS.md files

A preset include such as ../../AGENTS.md resolves successfully but fails this exact relative-path check and then returns no target because AGENTS.md is absent from specialFileNames. This makes the newly documented AGENTS include support useful only for a file already inside the preset root, which is copied without an include anyway; recognize a terminal AGENTS.md like the lock files so shared external instructions can be materialized.

Useful? React with 👍 / 👎.

Comment on lines +261 to +262
const content = await fs.readFile(rootAgentsPath, 'utf8');
return [{ path: rootAgentsPath, content }, ...supplementalFiles];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Detect previously generated root instruction blobs

On projects previously applied with Codex, Copilot, or another AGENTS-based adapter, the root AGENTS.md commonly starts with <!-- Generated by Skiller --> and already contains the concatenated .agents rules. Unconditionally treating that output as the new authored source while also appending the current supplemental files duplicates those rules in projected outputs and preserves stale copies after a supplemental rule changes; the upgrade path needs to recognize and migrate or reject the old generated blob before loading it as authored content.

Useful? React with 👍 / 👎.

Comment thread src/agents/ClaudeAgent.ts
* Uses @filename references instead of concatenating content.
*/
export class ClaudeAgent extends AbstractAgent {
export class ClaudeAgent extends AgentsMdAgent {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve cleanup support for generated CLAUDE.md

Existing installations may already have a Skiller-generated CLAUDE.md containing @file references, but changing Claude's default output path to the no-op AGENTS adapter means neither a subsequent apply nor revert --agents claude-code knows that file is managed. Claude Code will continue loading the stale file alongside the new root instructions, and references may point at files moved by the .claude migration; retain a migration or revert path for recognizable legacy generated CLAUDE.md files.

Useful? React with 👍 / 👎.

Comment on lines 31 to +32
): Promise<void> {
const output =
agentConfig?.outputPath ?? this.getDefaultOutputPath(projectRoot);
const absolutePath = path.resolve(projectRoot, output);
await ensureDirExists(path.dirname(absolutePath));

// Add marker comment to the content to identify it as generated
const contentWithMarker = `<!-- Generated by Skiller -->\n${concatenatedRules}`;

// Read existing content if present and skip write if identical
let existing: string | null = null;
try {
existing = await fs.readFile(absolutePath, 'utf8');
} catch {
existing = null;
}

if (existing !== null && existing === contentWithMarker) {
// No change; skip backup/write for idempotency
return;
}

// Backup (only if file existed and backup is enabled) then write new content
if (backup) {
await backupFile(absolutePath);
}
await writeGeneratedFile(absolutePath, contentWithMarker);
// Shared instructions are authored in place and need no projection.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Project supplemental rules to AGENTS-native adapters

For a new project containing root AGENTS.md plus supplemental .agents/*.md or .mdc rules, this no-op discards the concatenatedRules passed by the apply engine. Adapters inheriting this class—including Claude, Copilot, Cursor, Windsurf, Amp, Jules, and Zed—only consume the root file, so they never receive the supplemental rules that rule discovery and the documentation still advertise; retain an agent-consumable projection for supplemental content without overwriting the authored root.

Useful? React with 👍 / 👎.

Comment thread README.md
Comment on lines +5 to +6
Write shared project instructions in the repository's root `AGENTS.md`. Skiller
reads that file when producing agent-specific rules and never rewrites it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Convert the README feature prose to a bullet

The newly added root-instructions feature is written as a prose paragraph at the top of the README, but the repository's README fork-feature convention requires additions in that section to be concise bullet points rather than verbose prose. Represent this statement using the required feature/bullet structure.

AGENTS.md reference: AGENTS.md:L7-L15

Useful? React with 👍 / 👎.

@zbeyens
zbeyens merged commit 6f34849 into main Sep 24, 2026
1 check passed
@zbeyens
zbeyens deleted the codex/consolidate-root-agents branch September 24, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant