Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 10 additions & 2 deletions .tool-configs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Tool Configuration Files

These files make the scaffold work with specific AI coding tools.
All contain the same content — a pointer to `.mex/ROUTER.md`.
Most embed the same content — a pointer to `.mex/ROUTER.md`. OpenCode uses a JSON config that references `.mex/AGENTS.md` instead.

## Which file does your tool use?

Expand All @@ -11,6 +11,8 @@ All contain the same content — a pointer to `.mex/ROUTER.md`.
| Cursor | `.cursorrules` → copy or symlink to project root |
| Windsurf | `.windsurfrules` → copy or symlink to project root |
| GitHub Copilot | `copilot-instructions.md` → copy to `.github/` in project root |
| OpenCode | `opencode.json` → copy to `.opencode/` in project root |
| Codex (OpenAI) | Copy `CLAUDE.md` as `AGENTS.md` to project root |
| Any other tool | Point agent to `.mex/AGENTS.md` |
Comment on lines 13 to 16
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

This table is introduced as “All contain the same content”, but the new OpenCode entry uses opencode.json, which does not contain the same markdown content as the other tool configs (it references .mex/AGENTS.md). Please adjust the wording to reflect the OpenCode/Codex behavior (e.g., “most contain…” or call out the JSON indirection) to avoid misleading setup instructions.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 0576b57.


## Setup
Expand All @@ -29,6 +31,12 @@ cp .tool-configs/.windsurfrules ./.windsurfrules

# Copilot
mkdir -p .github && cp .tool-configs/copilot-instructions.md ./.github/copilot-instructions.md

# OpenCode
mkdir -p .opencode && cp .tool-configs/opencode.json ./.opencode/opencode.json

# Codex (OpenAI)
cp .tool-configs/CLAUDE.md ./AGENTS.md
```

## If your tool is not listed
Expand All @@ -38,5 +46,5 @@ or paste it at the start of each session. The scaffold works identically.

## Content

All files contain identical content — the Circle 1 anchor from `.mex/AGENTS.md`.
Most files embed the Circle 1 anchor from `.mex/AGENTS.md`. OpenCode's `opencode.json` references it by path instead.
`.mex/AGENTS.md` is the source of truth. If you update it, update your root tool config too.
4 changes: 4 additions & 0 deletions .tool-configs/opencode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://opencode.ai/config.json",
"instructions": [".mex/AGENTS.md"]
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

This config points OpenCode at .mex/AGENTS.md, while the surrounding docs describe tool configs as pointing to .mex/ROUTER.md / having identical embedded content. Please make the project’s guidance consistent (either change this to reference .mex/ROUTER.md if that’s what OpenCode should load, or update the READMEs to explicitly document that OpenCode loads .mex/AGENTS.md).

Suggested change
"instructions": [".mex/AGENTS.md"]
"instructions": [".mex/ROUTER.md"]

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

AGENTS.md is intentional. It's the always-loaded anchor (~150 tokens) that then directs to ROUTER.md. All other tool configs embed the AGENTS.md content; OpenCode references it by path. Changing to ROUTER.md would skip the anchor layer.

}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,11 @@ your-project/
| Claude Code | `CLAUDE.md` |
| Cursor | `.cursorrules` |
| Windsurf | `.windsurfrules` |
| GitHub Copilot | `copilot-instructions.md` |
| GitHub Copilot | `.github/copilot-instructions.md` |
| OpenCode | `.opencode/opencode.json` |
| Codex (OpenAI) | `AGENTS.md` |

All config files contain identical content. `mex setup` asks which tool you use and copies the right one.
Most config files embed the same instructions directly. OpenCode is the exception — `.opencode/opencode.json` references `.mex/AGENTS.md` instead of embedding content. `mex setup` asks which tool you use and creates the appropriate config.

## Contributing

Expand Down
23 changes: 16 additions & 7 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,12 @@ echo " 1) Claude Code"
echo " 2) Cursor"
echo " 3) Windsurf"
echo " 4) GitHub Copilot"
echo " 5) Multiple (select next)"
echo " 6) None / other (skip)"
echo " 5) OpenCode"
echo " 6) Codex (OpenAI)"
echo " 7) Multiple (select next)"
echo " 8) None / other (skip)"
echo ""
printf "Choice [1-6] (default: 1): "
printf "Choice [1-8] (default: 1): "
read -r tool_choice
tool_choice="${tool_choice:-1}"

Expand All @@ -251,22 +253,29 @@ copy_tool_config() {
[ "$DRY_RUN" -eq 0 ] && mkdir -p "$PROJECT_DIR/.github"
safe_copy "$SCRIPT_DIR/.tool-configs/copilot-instructions.md" "$PROJECT_DIR/.github/copilot-instructions.md"
;;
5)
[ "$DRY_RUN" -eq 0 ] && mkdir -p "$PROJECT_DIR/.opencode"
safe_copy "$SCRIPT_DIR/.tool-configs/opencode.json" "$PROJECT_DIR/.opencode/opencode.json"
;;
6)
safe_copy "$SCRIPT_DIR/.tool-configs/CLAUDE.md" "$PROJECT_DIR/AGENTS.md"
;;
esac
}

case "$tool_choice" in
1|2|3|4)
1|2|3|4|5|6)
copy_tool_config "$tool_choice"
;;
5)
7)
echo ""
printf "Enter tool numbers separated by spaces (e.g. 1 2 4): "
printf "Enter tool numbers separated by spaces (e.g. 1 2 5): "
read -r multi_choices
for choice in $multi_choices; do
copy_tool_config "$choice"
done
;;
6|"")
8|"")
info "Skipped tool config — AGENTS.md in .mex/ works with any tool that can read files"
;;
*)
Expand Down
18 changes: 12 additions & 6 deletions src/setup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ const TOOL_CONFIGS: Record<string, { src: string; dest: string }> = {
"2": { src: ".tool-configs/.cursorrules", dest: ".cursorrules" },
"3": { src: ".tool-configs/.windsurfrules", dest: ".windsurfrules" },
"4": { src: ".tool-configs/copilot-instructions.md", dest: ".github/copilot-instructions.md" },
"5": { src: ".tool-configs/opencode.json", dest: ".opencode/opencode.json" },
"6": { src: ".tool-configs/CLAUDE.md", dest: "AGENTS.md" }, // Codex reads AGENTS.md at root
Comment on lines 44 to +48
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

PR description/issue #12 mention updating drift checking to include the new tool config(s), but drift’s project-root tool-config scan currently only includes CLAUDE.md, .cursorrules, and .windsurfrules (see src/drift/index.ts:98). With OpenCode/Codex support added here, drift should also consider .opencode/opencode.json and AGENTS.md (and likely .github/copilot-instructions.md) when present, otherwise changes to those files won’t be detected.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Valid point — drift checking should include the new tool configs. Out of scope for this PR; tracked as a follow-up.

};

// ── Helpers ──
Expand Down Expand Up @@ -309,11 +311,13 @@ async function selectToolConfig(
console.log(" 2) Cursor");
console.log(" 3) Windsurf");
console.log(" 4) GitHub Copilot");
console.log(" 5) Multiple (select next)");
console.log(" 6) None / skip");
console.log(" 5) OpenCode");
console.log(" 6) Codex (OpenAI)");
console.log(" 7) Multiple (select next)");
console.log(" 8) None / skip");
console.log();

const choice = (await rl.question("Choice [1-6] (default: 1): ")).trim() || "1";
const choice = (await rl.question("Choice [1-8] (default: 1): ")).trim() || "1";

let selectedClaude = false;

Expand Down Expand Up @@ -352,16 +356,18 @@ async function selectToolConfig(
case "2":
case "3":
case "4":
case "5":
case "6":
copyConfig(choice);
break;
case "5": {
const multi = (await rl.question("Enter tool numbers separated by spaces (e.g. 1 2 4): ")).trim();
case "7": {
const multi = (await rl.question("Enter tool numbers separated by spaces (e.g. 1 2 5): ")).trim();
for (const c of multi.split(/\s+/)) {
copyConfig(c);
}
break;
}
case "6":
case "8":
info("Skipped tool config — AGENTS.md in .mex/ works with any tool that can read files");
break;
default:
Expand Down
50 changes: 50 additions & 0 deletions templates/.tool-configs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Tool Configuration Files

These files make the scaffold work with specific AI coding tools.
Most embed the same content — a pointer to `.mex/ROUTER.md`. OpenCode uses a JSON config that references `.mex/AGENTS.md` instead.

## Which file does your tool use?

| Tool | File to use |
|------|-------------|
| Claude Code | `CLAUDE.md` → copy or symlink to project root |
| Cursor | `.cursorrules` → copy or symlink to project root |
| Windsurf | `.windsurfrules` → copy or symlink to project root |
| GitHub Copilot | `copilot-instructions.md` → copy to `.github/` in project root |
| OpenCode | `opencode.json` → copy to `.opencode/` in project root |
| Codex (OpenAI) | Copy `CLAUDE.md` as `AGENTS.md` to project root |
| Any other tool | Point agent to `.mex/AGENTS.md` |
Comment on lines +12 to +16
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

This templates README says “All contain the same content”, but opencode.json is JSON and only references .mex/AGENTS.md instead of containing the same markdown content. Please update the wording to reflect the OpenCode/Codex behavior so generated docs are accurate.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 0576b57.


## Setup

Copy the relevant file to the correct location in your project root:

```bash
# Claude Code
cp .tool-configs/CLAUDE.md ./CLAUDE.md

# Cursor
cp .tool-configs/.cursorrules ./.cursorrules

# Windsurf
cp .tool-configs/.windsurfrules ./.windsurfrules

# Copilot
mkdir -p .github && cp .tool-configs/copilot-instructions.md ./.github/copilot-instructions.md

# OpenCode
mkdir -p .opencode && cp .tool-configs/opencode.json ./.opencode/opencode.json

# Codex (OpenAI)
cp .tool-configs/CLAUDE.md ./AGENTS.md
```

## If your tool is not listed

Add "Read .mex/ROUTER.md before starting any task" to your tool's system prompt
or paste it at the start of each session. The scaffold works identically.

## Content

Most files embed the Circle 1 anchor from `.mex/AGENTS.md`. OpenCode's `opencode.json` references it by path instead.
`.mex/AGENTS.md` is the source of truth. If you update it, update your root tool config too.
4 changes: 4 additions & 0 deletions templates/.tool-configs/opencode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://opencode.ai/config.json",
"instructions": [".mex/AGENTS.md"]
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

This config references .mex/AGENTS.md, but the templates/.tool-configs README claims tool configs all contain the same content / point to .mex/ROUTER.md. Please align the template config and documentation (either reference .mex/ROUTER.md here, or update the docs to call out the indirection via .mex/AGENTS.md).

Suggested change
"instructions": [".mex/AGENTS.md"]
"instructions": [".mex/ROUTER.md"]

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Same as above — AGENTS.md is the correct entry point.

}
Loading