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
92 changes: 92 additions & 0 deletions .agents/rules/general.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Operational Guidelines

## Session Start

- **Always** read `tasks/lessons.md` at the beginning of each session before doing any work
- Apply relevant lessons to the current task

## Workflow Orchestration

### 1. Plan Node Default

- Enter plan mode for ANY non-trivial task (3+ steps or architectural decisions)
- If something goes sideways, STOP and re-plan immediately - don't keep pushing
- Use plan mode for verification steps, not just building
- Write detailed specs upfront to reduce ambiguity

### 2. Subagent Strategy

- Use subagents liberally to keep main context window clean
- Offload research, exploration, and parallel analysis to subagents
- For complex problems, throw more compute at it via subagents
- One tack per subagent for focused execution

### 3. Self-Improvement Loop

- **When to amend** `tasks/lessons.md`: whenever something turns out wrong — user correction, test failure, CI failure, code review feedback, or any other signal that a mistake was made
- **How to amend**: add a bullet with (1) what went wrong, (2) the root cause, (3) a rule that prevents the same mistake
- **Best practice for AI agents**: updating lessons is the primary way to persist learning across sessions; agents lack long-term memory, so `tasks/lessons.md` is the project-specific memory that reduces repeated mistakes
- Write rules for yourself that prevent the same mistake
- Ruthlessly iterate on these lessons until mistake rate drops
- Review lessons at session start for relevant project

### 4. Verification Before Done

- Never mark a task complete without proving it works
- **After every feature/story completion**: Use the `post-feature-qa` skill (`.agents/skills/post-feature-qa/`) — run the QA checklist, ensure tests cover edge cases and implementation aligns with the story, fix gaps before marking done
- Diff behavior between main and your changes when relevant
- Ask yourself: "Would a staff engineer approve this?"
- Run tests, check logs, demonstrate correctness

### 5. Demand Elegance (Balanced)

- For non-trivial changes: pause and ask "is there a more elegant way?"
- If a fix feels hacky: "Knowing everything I know now, implement the elegant solution"
- Skip this for simple, obvious fixes - don't over-engineer
- Challenge your own work before presenting it

### 6. Autonomous Bug Fixing

- When given a bug report: just fix it. Don't ask for hand-holding
- Point at logs, errors, failing tests - then resolve them
- Zero context switching required from the user
- Go fix failing CI tests without being told how

## Task Management

1. **Plan First**: Write plan to `tasks/todo.md` with checkable items
2. **Verify Plan**: Check in before starting implementation
3. **Track Progress**: Mark items complete as you go
4. **Explain Changes**: High-level summary at each step
5. **Document Results**: Add review section to `tasks/todo.md`
6. **Capture Lessons**: Update `tasks/lessons.md` after corrections — see "When to amend" and "How to amend" in Self-Improvement Loop above

## Skills

- **post-feature-qa** (`.agents/skills/post-feature-qa/`) — Apply after every feature or story implementation. Act as senior QA: verify test coverage for all edge cases and story alignment; produce QA report; fix gaps before claiming complete.
- **add-agent-target** (`.agents/skills/add-agent-target/`) — Use when adding support for a new AI agent target. Requires current official-doc research, full import/generate implementation, rich realistic fixtures, complete unit/integration/e2e coverage, docs updates, and final QA.

## Core Principles

- **Simplicity First**: Make every change as simple as possible. Impact minimal code.
- **No Laziness**: Find root causes. No temporary fixes. Senior developer standards.
- **Minimal Impact**: Changes should only touch what's necessary. Avoid introducing bugs.

## Project-Specific Rules

- **TDD mandatory**: Write failing tests FIRST, then implement. No exceptions.
- **Max file size**: 200 lines. Split by responsibility if larger.
- **No classes unless stateful**: Prefer pure functions + types.
- **No `any`**: Use `unknown` + narrowing.
- **Config source of truth**: `.agentsmesh/` directory. Generated files are artifacts.
- **Test naming**: `{module}.test.ts` colocated with source. Integration tests in `tests/integration/`.
- **Generated artifact tests must be strict**: For generated file structures, assert exact file paths, exact file counts, and exact referenced wrapper/script sets. Do not use loose checks like "at least one file", broad `some(...)`, or prefix-only path assertions when the full output set is known.
- **Commit format**: conventional commits — `feat|fix|test|refactor(scope): message`
- **README must stay current**: Any change to CLI commands, flags, config schema, supported targets, or canonical file formats **must** be reflected in `README.md` before the task is marked complete. Treat the README as part of the API surface.
- **Website docs must stay current**: Any change to CLI commands, flags, config schema, supported targets, canonical file formats, or other user-facing behavior **must** also be reflected in the documentation website (`website/src/content/docs/`). The website is the primary public documentation — treat it with the same rigor as `README.md`.
- **Refer to PRD**: `docs/prd-v2-complete.md` for architecture decisions
- **Refer to tasks**: `docs/agentsmesh-ai-first-tasks.md` for current task specs

## AgentsMesh Generation Contract

AgentsMesh is a config sync library for AI coding tools. The only canonical source of truth is the `.agentsmesh` directory at the project root; files emitted into target formats such as `AGENTS.md`, `.claude/`, `.cursor/`, `.junie/`, and similar directories are generated artifacts. When making changes, edit canonical config first, then regenerate and verify the target outputs. Preserve the library's bidirectional contract: import native tool config into canonical form, generate back to target-specific layouts, and keep projected or embedded features round-trippable rather than treating them as plain text exports.
6 changes: 6 additions & 0 deletions .agents/rules/typescript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# TypeScript Standards

- Use strict mode
- Prefer `unknown` over `any`
- Use explicit return types for public functions
- Prefer `interface` over `type` for object shapes
13 changes: 13 additions & 0 deletions .agents/workflows/commit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Create a conventional commit/s from current changes

Review the current git changes (staged and unstaged) and:

1. **Analyze changes** — Understand what was modified (files, scope, intent)
2. **Propose a conventional commit message** — Format: `type(scope): message`
- Types: `feat`, `fix`, `test`, `refactor`, `docs`, `chore`, `perf`, `ci`
- Scope: affected area (e.g. `engine`, `cursor`, `config`)
- Message: imperative, lowercase, no period
3. **Stage if needed** — Stage relevant files (ask before `git add .` if many files)
4. **Commit** — Run `git commit -m "..."` with the proposed message

If the user requests edits to the message, adjust and re-commit. Do not amend without explicit request.
7 changes: 7 additions & 0 deletions .agents/workflows/review.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Review current changes for code quality and best practices

Review the current git diff and provide feedback on:
- Code quality and readability
- Potential bugs or edge cases
- Adherence to project conventions
- Test coverage gaps
6 changes: 6 additions & 0 deletions .agents/workflows/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Run tests and report results

Run the project test suite and report:
- Number of passing/failing tests
- Coverage summary
- Any test failures with details
4 changes: 2 additions & 2 deletions .agentsmesh/.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Auto-generated. DO NOT EDIT MANUALLY.
# Tracks the state of all config files for team conflict resolution.

generated_at: 2026-03-28T10:40:11.652Z
generated_at: 2026-03-29T10:20:37.442Z
generated_by: serhii
lib_version: 0.2.5
lib_version: 0.2.8
checksums:
agents/code-debugger.md: sha256:707132841c606f117c83491d53ce101be0117eb50abe2861bcf93bdd45a56daf
agents/code-documenter.md: sha256:faa66b16d2e86578985e817d60e6705ae0e34a716c1f5c29411739a6d659fb96
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.2.8

### Patch Changes

- Add Antigravity as a supported target, emit Continue root rules as `.continue/rules/general.md` (while still importing legacy `_root.md`), register built-in targets through target descriptors, and align Continue e2e contracts with the new rule filename.

## 0.2.6

### Patch Changes
Expand Down
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<a href="https://github.com/sampleXbro/agentsmesh/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome"></a>
</p>

AgentsMesh maintains a single canonical configuration in `.agentsmesh/` and syncs it bidirectionally to Claude Code, Cursor, Copilot, Continue, Junie, Gemini CLI, Cline, Codex CLI, and Windsurf. Rules, commands, agents, skills, MCP servers, hooks, ignore patterns, and permissions -- all from one source of truth.
AgentsMesh maintains a single canonical configuration in `.agentsmesh/` and syncs it bidirectionally to Claude Code, Cursor, Copilot, Continue, Junie, Gemini CLI, Cline, Codex CLI, Windsurf, and Antigravity. Rules, commands, agents, skills, MCP servers, hooks, ignore patterns, and permissions -- all from one source of truth.

> **Full documentation: [samplexbro.github.io/agentsmesh](https://samplexbro.github.io/agentsmesh)**

Expand Down Expand Up @@ -80,19 +80,21 @@ That's it. Your `.agentsmesh/` directory is now the single source of truth, and

## Supported Tools

| Feature | Claude Code | Cursor | Copilot | Gemini CLI | Cline | Codex CLI | Windsurf | Continue | Junie |
|---------------|:-----------:|:-------:|:-------:|:----------:|:-------:|:---------:|:--------:|:--------:|:--------:|
| Rules | Native | Native | Native | Native | Native | Native | Native | Native | Native |
| Commands | Native | Native | Native | Native | Native | Embedded | Native | Embedded | Embedded |
| Agents | Native | Native | Native | Native | Embedded| Native | Embedded | -- | Embedded |
| Skills | Native | Native | Native | Native | Native | Native | Native | Embedded | Embedded |
| MCP Servers | Native | Native | -- | Native | Native | Native | Partial | Native | Native |
| Hooks | Native | Native | Partial | Partial | -- | -- | Native | -- | -- |
| Ignore | Native | Native | -- | Native | Native | -- | Native | -- | Native |
| Permissions | Native | Partial | -- | Partial | -- | -- | -- | -- | -- |
| Feature | Claude Code | Cursor | Copilot | Gemini CLI | Cline | Codex CLI | Windsurf | Continue | Junie | Antigravity |
|---------------|:-----------:|:-------:|:-------:|:----------:|:-------:|:---------:|:--------:|:--------:|:--------:|:-----------:|
| Rules | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native |
| Commands | Native | Native | Native | Native | Native | Embedded | Native | Embedded | Embedded | Partial |
| Agents | Native | Native | Native | Native | Embedded| Native | Embedded | -- | Embedded | -- |
| Skills | Native | Native | Native | Native | Native | Native | Native | Embedded | Embedded | Native |
| MCP Servers | Native | Native | -- | Native | Native | Native | Partial | Native | Native | -- |
| Hooks | Native | Native | Partial | Partial | -- | -- | Native | -- | -- | -- |
| Ignore | Native | Native | -- | Native | Native | -- | Native | -- | Native | -- |
| Permissions | Native | Partial | -- | Partial | -- | -- | -- | -- | -- | -- |

See the [full feature matrix docs](https://samplexbro.github.io/agentsmesh/reference/supported-tools/) for details on native vs. embedded support.

**Note:** The canonical root rule always lives at `.agentsmesh/rules/_root.md`. Some targets write that content to a tool-specific main file named `general` (for example `.continue/rules/general.md` and `.agents/rules/general.md` for Antigravity) instead of `_root.md` on disk.

---

## Documentation
Expand Down
1 change: 1 addition & 0 deletions agentsmesh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ targets:
- windsurf
- continue
- junie
- antigravity
features:
- rules
- commands
Expand Down
12 changes: 9 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import importPlugin from 'eslint-plugin-import';
export default [
eslint.configs.recommended,
{
files: ['src/**/*.ts'],
files: ['src/**/*.ts', 'tests/**/*.ts'],
languageOptions: {
parser: tsparser,
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
Expand All @@ -15,6 +15,12 @@ export default [
console: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
fetch: 'readonly',
URL: 'readonly',
TextDecoder: 'readonly',
document: 'readonly',
Buffer: 'readonly',
NodeJS: 'readonly',
},
},
plugins: {
Expand All @@ -24,7 +30,7 @@ export default [
rules: {
'no-unused-vars': 'off', // use @typescript-eslint/no-unused-vars
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'@typescript-eslint/explicit-function-return-type': [
'warn',
{ allowExpressions: true },
Expand All @@ -37,6 +43,6 @@ export default [
},
},
{
ignores: ['dist/', 'coverage/', 'node_modules/', '*.config.*'],
ignores: ['dist/', 'coverage/', 'node_modules/', '*.config.*', 'website/dist/', 'website/.astro/'],
},
];
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "agentsmesh",
"version": "0.2.6",
"description": "One canonical source for AI coding agent rules, commands, skills, MCP, hooks, and permissions — synced across Claude Code, Cursor, Copilot, Continue, Junie, Gemini CLI, Cline, Codex CLI, and Windsurf.",
"version": "0.2.8",
"description": "One canonical source for AI coding agent rules, commands, skills, MCP, hooks, and permissions — synced across Claude Code, Cursor, Copilot, Continue, Junie, Gemini CLI, Cline, Codex CLI, Windsurf, and Antigravity.",
"type": "module",
"main": "./dist/cli.js",
"author": "sampleXbro",
Expand Down Expand Up @@ -31,7 +31,7 @@
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"test:e2e": "pnpm build && vitest run --config vitest.e2e.config.ts",
"lint": "eslint src/",
"lint": "eslint src tests",
"format": "prettier --write src/",
"format:check": "prettier --check src/",
"prepare": "husky",
Expand Down Expand Up @@ -63,6 +63,7 @@
"cline",
"codex",
"windsurf",
"antigravity",
"developer-tools",
"devtools",
"code-assistant",
Expand Down
38 changes: 6 additions & 32 deletions src/cli/commands/init-detect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,13 @@

import { join } from 'node:path';
import { exists } from '../../utils/filesystem/fs.js';
import { BUILTIN_TARGETS } from '../../targets/catalog/builtin-targets.js';

/** AI tool indicators for detection. */
export const TOOL_INDICATORS: Array<{ id: string; paths: string[] }> = [
{ id: 'claude-code', paths: ['CLAUDE.md', '.claude/rules', '.claude/commands'] },
{ id: 'cursor', paths: ['.cursor/rules', '.cursor/mcp.json'] },
{
id: 'copilot',
paths: [
'.github/copilot-instructions.md',
'.github/copilot',
'.github/instructions',
'.github/prompts',
'.github/skills',
'.github/agents',
'.github/hooks',
],
},
{ id: 'continue', paths: ['.continue/rules', '.continue/skills', '.continue/mcpServers'] },
{
id: 'junie',
paths: [
'.junie/guidelines.md',
'.junie/AGENTS.md',
'.junie/skills',
'.junie/mcp/mcp.json',
'.aiignore',
],
},
{ id: 'gemini-cli', paths: ['GEMINI.md', '.gemini'] },
{ id: 'cline', paths: ['.clinerules', '.cline'] },
{ id: 'codex-cli', paths: ['codex.md'] },
{ id: 'windsurf', paths: ['.windsurfrules', '.windsurf'] },
];
/** AI tool indicators for detection — derived from target descriptors. */
export const TOOL_INDICATORS: Array<{ id: string; paths: string[] }> = BUILTIN_TARGETS.map((d) => ({
id: d.id,
paths: [...d.detectionPaths],
}));

/**
* Detect existing AI tool configs in the project.
Expand Down
25 changes: 5 additions & 20 deletions src/cli/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@
import { join } from 'node:path';
import { exists, readFileSafe, writeFileAtomic, mkdirp } from '../../utils/filesystem/fs.js';
import { logger } from '../../utils/output/logger.js';
import { importFromClaudeCode } from '../../targets/claude-code/importer.js';
import { importFromCursor } from '../../targets/cursor/importer.js';
import { importFromCopilot } from '../../targets/copilot/importer.js';
import { importFromContinue } from '../../targets/continue/importer.js';
import { importFromJunie } from '../../targets/junie/importer.js';
import { importFromGemini } from '../../targets/gemini-cli/importer.js';
import { importFromCline } from '../../targets/cline/importer.js';
import { importFromCodex } from '../../targets/codex-cli/importer.js';
import { importFromWindsurf } from '../../targets/windsurf/importer.js';
import { BUILTIN_TARGETS } from '../../targets/catalog/builtin-targets.js';
import type { ImportResult } from '../../core/types.js';
import {
buildConfig,
Expand All @@ -35,17 +27,10 @@ const CONFIG_FILENAME = 'agentsmesh.yaml';
const LOCAL_CONFIG_FILENAME = 'agentsmesh.local.yaml';
const GITIGNORE_ENTRIES = ['agentsmesh.local.yaml', '.agentsmeshcache', '.agentsmesh/.lock.tmp'];

const IMPORTERS: Record<string, (root: string) => Promise<ImportResult[]>> = {
'claude-code': importFromClaudeCode,
cursor: importFromCursor,
copilot: importFromCopilot,
continue: importFromContinue,
junie: importFromJunie,
'gemini-cli': importFromGemini,
cline: importFromCline,
'codex-cli': importFromCodex,
windsurf: importFromWindsurf,
};
/** Importers derived from target descriptors — no manual registration needed. */
const IMPORTERS: Record<string, (root: string) => Promise<ImportResult[]>> = Object.fromEntries(
BUILTIN_TARGETS.map((d) => [d.id, (root: string) => d.generators.importFrom(root)]),
);

/**
* Append entries to .gitignore if not already present.
Expand Down
2 changes: 1 addition & 1 deletion src/config/core/schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from 'zod';
import { TARGET_IDS } from '../../targets/catalog/builtin-targets.js';
import { TARGET_IDS } from '../../targets/catalog/target-ids.js';

const VALID_FEATURES = [
'rules',
Expand Down
Loading
Loading