feat: add you-md export to write preferences into each tool's native instruction file - #24
Merged
Merged
Conversation
…ve instruction files Exports the discovered you.md profile into Claude Code, Codex CLI, Gemini CLI, Windsurf, Cursor, and project AGENTS.md instruction files using idempotent managed-block markers. Extracts the shared context formatter out of the MCP server into src/core/formatter.ts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds a
you-md exportcommand that writes your you.md preferences into each AI tool's native instruction file. This is the outbound counterpart to the existingconvertcommand: tools that do not speak MCP (or that you have not wired the skill into) still get your preferences, because they already read these files at session start.Targets:
claude(/.claude/CLAUDE.md),/.codex/AGENTS.md),codex(gemini(~/.gemini/GEMINI.md),windsurf(global_rules.md),cursor(.cursor/rules/you-md.mdc),agents(./AGENTS.md).Exports are idempotent. Managed content lives between
<!-- you-md:begin -->and<!-- you-md:end -->markers, so hand-written content in the same file is preserved and re-exports update the block in place. Existing files are backed up to<file>.backupbefore every write. The cursor target writes a dedicated.mdcrule file (withalwaysApply: truefrontmatter) that you-md owns entirely.Why now (market rationale)
you-md convert .cursorrulespulls other formats in, and the MCPyoumd_tool_configtool generates per-tool snippets but never writes them anywhere. Export closes the loop and makes you.md useful even for tools where the MCP skill is not installed.Runner-up candidates considered today and passed on: JUnit XML output plus fail-on-threshold CI gating for PromptLens (timely given promptfoo's acquisition by OpenAI in March 2026, but the repo has 33 stale automated PRs touching adjacent code, high overlap risk), and profile-scoped tools/list filtering for MCP-Profiles using the ttlMs/cacheScope cache hints added in the 2026-07-28 MCP spec (strong first-mover window, but higher spec-interpretation risk for a one-day build).
Implementation notes
src/cli/commands/export.ts: target registry, managed-block merge logic (applyManagedBlock), atomic writes (tmp file + rename) with.backupcopies, matching the existing conventions inskill.ts.src/core/formatter.ts: the context formatter previously private to the MCP server, now shared.src/mcp/server.tsdelegates to it (net deletion there), so MCP output and exported files stay byte-identical.src/cli/args.tsandsrc/cli/index.ts: register theexportcommand plus--alland--dry-runflags, help text updated.test/cli/export.test.ts: vitest suite covering marker wrapping, idempotent re-apply, user-content preservation, backups, cursor own-file mode, path scoping, and output override.you-md exportsection with a target table.Test status
test/cli/export.test.ts, 13 cases mirrored end to end).vitest/tsccould not be installed there. All 13 test cases plus a full end-to-endexportCommandrun against a real.you.mdfixture (discovery, dry-run, unknown-target and flag-validation error paths) were executed against the actual source with Node 24 native type stripping and pass. Please runnpm testandnpm run linton a machine with registry access before merging.