Portable AI Identity โ me.md and rules.md
KMGraph introduces two files scaffolded at knowledge/ that give your AI assistant a consistent understanding of who you are and how you work โ regardless of which AI platform you're using today.
The Problem: Platform Lock-In and Rule Driftโ
If you've been using AI coding assistants for a while, you've probably accumulated configuration in CLAUDE.md, .cursorrules, copilot-instructions.md, and other platform-specific files. These files work โ until you add a second tool, switch platforms, or have a collaborator join your project.
Three problems surface quickly:
- Platform lock-in.
CLAUDE.mdsyntax is Claude Code-only. Rules written there don't travel to Cursor, Windsurf, or Gemini. Every new platform requires rewriting the same context. - Rule drift. When you update a rule in one file, its duplicate in another platform file silently goes stale. No warning. The rule exists โ just in the wrong version.
- Identity fragmentation. There's no single "who am I in this project" document. Working style, communication preferences, and domain expertise live scattered across
CLAUDE.md, memory files, and implicit expectations.
The Solution: Your AI OSโ
Nick Milo describes this pattern in his Obsidian ACE framework and AI OS walkthrough: platform files should be thin shims that say "read these foundation files first." The foundation files are plain markdown โ readable by any AI tool, owned by you.
KMGraph implements this pattern directly. Three files, scaffolded automatically during kmgraph init:
| File | Purpose | Committed? |
|---|---|---|
knowledge/rules.md | Project conventions shared by all contributors โ branch naming, commit format, workflow rules | Yes |
knowledge/me.md | Who you are in this project โ working style, domain expertise, communication preferences | No โ gitignored |
knowledge/triggers.md | When to apply rules โ maps workflow phases (planning, committing, architecture decisions) to the relevant rules.md sections | Yes |
Your platform files (CLAUDE.md, .cursorrules, etc.) become one-line shims:
# CLAUDE.md
For full context, read `knowledge/rules.md` and `knowledge/me.md` before acting.
No more duplication. When you add a new AI platform, you add one line, not rewrite everything.
Two-Level Hierarchyโ
The same pattern extends to a personal scope โ rules and identity that apply across all your projects:
| Scope | File | Contents |
|---|---|---|
| Project | knowledge/rules.md | Project-specific conventions โ committed, shared by all contributors |
| Project | knowledge/me.md | Your identity in this project โ gitignored, per-contributor |
| Project | knowledge/triggers.md | When to apply rules โ workflow phase โ rules.md section mappings โ committed |
| Personal | ~/.kmgraph/rules.md | Cross-project behavioral rules (e.g., "always use feature flags") |
| Personal | ~/.kmgraph/me.md | Your identity across all projects โ style, expertise, preferences |
| Personal | ~/.kmgraph/triggers.md | Cross-project trigger timing โ personal phases extend (never replace) project entries |
Precedence: project-scoped files override personal files when they conflict. Personal files supply defaults.
knowledge/rules.md โ Project Conventionsโ
rules.md is the single authoritative home for behavioral rules. It replaces the scattered conventions in platform files:
# Rules โ My Project
## Git Workflow
- Branch format: `v{ver}-{description}`
- Commit format: `type(scope): subject` โ include `Closes #N` in body
- Never auto-merge; push and await user review
- **Why:** auto-merges skipped code review and shipped broken features in v0.2.x
## Workflow Preferences
- Parallel tool calls: always run independent searches and reads in parallel
- **Source:** [[ADR-017-four-layer-architecture]]
Each entry supports optional Why: and Source: annotations. Why: is a one-sentence micro-rationale. Source: links to the lesson or ADR that created the rule. This means you can understand why a rule exists without loading the full lesson into context.
knowledge/me.md โ Your Identityโ
me.md is gitignored โ each contributor on a project maintains their own. It tells the AI assistant who it's working with, how to communicate, and what domain expertise to assume:
# About Me โ My Project
## Role
Senior backend engineer, primary maintainer of the payments service.
Strong in TypeScript and PostgreSQL; new to the React components in this repo.
## Working Style
- Direct communication: skip preamble, get to the answer
- Show diffs, not rewrites โ I read code well
- Ask before refactoring anything I didn't specifically request
## What I Value
Correctness over speed. If a change might break something, say so first.
Two contributors on the same project have different me.md files. Committing one person's me.md would surface the wrong identity context for every other contributor. That's why it's gitignored.
knowledge/triggers.md โ When Rules Applyโ
triggers.md is the third identity file. It maps workflow phases to the rules in rules.md โ telling the AI assistant when to apply each rule, not just what the rules say.
# Triggers โ When to Apply Rules
## After writing an implementation plan
- Apply: `rules.md ยง Plan Protocol > Parallelism Analysis`
- If plan includes changes to `commands/` or `core/templates/`:
apply `rules.md ยง Development Workflow > Plugin Cache & Local Testing`
(add cache sync + reload as the final implementation step)
## Before committing
- Apply: `rules.md ยง Knowledge Capture > Plan-First Rule`
- Apply: `rules.md ยง Knowledge Capture > Branch-Close Rule`
## When making an architecture decision
- Apply: `rules.md ยง Knowledge Capture > When to Capture` (ADR trigger condition)
## At session end
- Apply: `rules.md ยง Knowledge Capture > Cadence & Routing` (run sync-all)
triggers.md is committed โ it documents project workflow phases shared by all contributors. The AI reads it alongside rules.md at every phase transition to ensure the right rules are applied at the right time. All AI platforms read this file; there is no platform-specific version.
During init, triggers.md is pre-populated by mapping the section headings in rules.md to trigger phases. The dry-run preview shows the derived entries so the user can confirm, edit, or skip each one.
Setting Upโ
Run kmgraph init in any project. When me.md, rules.md, or triggers.md are missing, the wizard:
- Scans existing sources โ reads all platform files found at the project root (
CLAUDE.md,GEMINI.md,.cursorrules,AGENTS.md, etc.), plusREADME, ADRs, lessons, and sessions to extract recommendations - Presents a dry-run preview โ shows proposed content for each missing file, pre-populated from the scan, before anything is written
- Archives originals โ any existing file that would be overwritten is archived to
.kg-archive-{date}/with a note showing the archive path so it can be rolled back - Waits for approval โ the user confirms, edits, or skips each file individually before it is written
- Updates platform files โ shows which cross-reference comments would be added to each platform file and flags any content that overlaps with
rules.mdfor optional removal (with user approval)
For the personal scope, run /kmgraph:init-personal-kg. It creates ~/.kmgraph/me.md, ~/.kmgraph/rules.md, and ~/.kmgraph/triggers.md and offers to populate them from ~/.claude/CLAUDE.md.
Keeping Rules Up to Date โ rules-captureโ
The rules-capture skill watches for behavioral corrections mid-session:
"from now on, always X"
"never do X again"
"I prefer X over Y"
When detected, it appends a suggestion to your response with a shortcut menu:
โ Capture as rule? (project-rules / project-me / personal-rules / personal-me / no)
Selecting an option dispatches to rules-capture-agent, which reads the target file, checks for duplicates, drafts the rule in house style, and presents an Approve / Edit / Discard loop before writing.
Rules stay current without manual editing.
Before/Afterโ
Before:
CLAUDE.md โ rules + identity + Claude-specific syntax, 150 lines
.cursorrules โ duplicates 40% of CLAUDE.md, silently stale
~/.claude/CLAUDE.md โ personal preferences, Claude-only
After:
knowledge/rules.md โ single authoritative rules source (committed)
knowledge/me.md โ contributor identity in this project (gitignored)
knowledge/triggers.md โ when to apply rules โ workflow phase mappings (committed)
~/.kmgraph/rules.md โ cross-project personal rules (local only)
~/.kmgraph/me.md โ cross-project personal identity (local only)
~/.kmgraph/triggers.md โ cross-project trigger timing (local only)
CLAUDE.md โ shim: "read knowledge/rules.md, me.md, and triggers.md"
.cursorrules โ shim: "read knowledge/rules.md, me.md, and triggers.md"
One rule update. Four platforms served.
Relatedโ
- Personal vs Project KGs โ Understanding the two scopes
- ADR-028 โ Full architectural rationale
- Nick Milo โ Obsidian ACE Framework
- Nick Milo โ Building Your AI OS