centralize-ai-output
Skill3 starsChanged 35 days agoMITView on GitHub
Move everything in a project's .ai/ folder into the central AI agent output folder (${AI_AGENT_OUTPUT_DIR:-~/.ai}/<project>), replace .ai with a symbolic link to it, and install a global rule so AI agents write their outputs there unless the user names another location. Use when the user runs /centralize-ai-output, asks where the AI outputs of a project are, asks to move or migrate the .ai/ folder, or asks agents to keep their outputs out of the project.
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- 2020-hindsight-scalaSkill
- gen-motion-graphicsSkill
- pr-analysisSkill
- riper-5Skill
- setup-metals-mcpSkill
- setup-serena-mcpSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 2 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Every step starts with a dry run.
- Very specific: line 19
When the user runs migrate, link or install-rule directly, first run sh <skill>/scripts/install-rule.sh --check.
- Very specific: line 20
After status, migrate and install-rule, do the link offer (see below).
- Very specific: line 21
If a script exits with an error, show its message and stop.
- Distinctive: line 37
Run these and report the results in short form:
- Very specific: line 48
Run sh <skill>/scripts/migrate-ai-output.sh --all (dry run) and show the result.
- Very specific: line 49
Ask the user. Only after an explicit yes, run it with --apply.
- Distinctive: line 51
Do the link offer.
- Very specific: line 57
Run sh <skill>/scripts/link-ai-folder.sh (dry run).
- Very specific: line 63
Always ask the user whether to link .ai to the output folder, unless the project already has a .ai that is not empty.
- Very specific: line 65
Run sh <skill>/scripts/link-ai-folder.sh (dry run).
- Very specific: line 66
If it prints already linked, do not ask.
- Very specific: line 73
Run sh <skill>/scripts/install-rule.sh (dry run).
- Very specific: line 79
Ask the user. Only after an explicit yes, run it with --apply.
- Very specific: line 84
When a rule is outdated or has broken markers, ai-output-dir.sh of this skill (the script that the rule runs) prints a note for the agent …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
centralize-ai-output
AI agents write plans, reports, notes, videos and other outputs. This skill keeps them out of the project, in one central folder with one folder for each project, and makes agents use that folder by default.
<skill> below means this skill's directory. The scripts are in <skill>/scripts/. They are POSIX sh scripts. Run them from the project folder.
Rules
- The folder is
${AI_AGENT_OUTPUT_DIR:-~/.ai}/<project>.sh <skill>/scripts/ai-output-dir.shprints it. Do not calculate it yourself. <project>is<host>/<owner>/<repo>of the Git remote (origin, else the first remote by name), without the user, the credentials, the port and.git, in lowercase. All clones and worktrees of one repository share one folder. Without a remote, or outside Git, it islocal/<name>-<hash>: the folder name and 8 hexadecimal digits of thecksumvalue of the absolute path. The path keeps symbolic links, and all worktrees share one folder. When that folder does not exist, but a folderlocal/<name>-<other hash>has a.project-infowith the samecanonical=path, the script uses that folder. This happens when the same project is opened through another path with the same name, for example through a symbolic link.AI_AGENT_OUTPUT_DIRcan be an absolute path,~, or a path that starts with~/,$HOME/or${HOME}/.- Each project folder has a hidden
.project-infofile with the remote and every path that used the folder. - Every step starts with a dry run. Run a step with
--applyonly after the user explicitly agrees to that step. Never delete or overwrite a file, except what thelinkstep lists and the user accepts. - When the user runs
migrate,linkorinstall-ruledirectly, first runsh <skill>/scripts/install-rule.sh --check. If it exits 3, tell the user in one line which rule is outdated or broken and thatinstall-ruleupdates it. Then continue the step. - After
status,migrateandinstall-rule, do the link offer (see below). Do it every time. - If a script exits with an error, show its message and stop. If a sandbox blocks a write, tell the user to allow writes to the root folder (
sh <skill>/scripts/ai-output-dir.sh --rootprints it) or to the agent config folder.
Arguments
The text after /centralize-ai-output selects the step:
| Argument | Step |
none or status | status, then offer the next steps |
migrate | migrate |
link | link |
install-rule | install-rule |
help, --help, -h | Reply with the text in references/help.md, as it is, and stop |
status
Run these and report the results in short form:
sh <skill>/scripts/ai-output-dir.sh --print-only: the output folder.sh <skill>/scripts/migrate-ai-output.sh --check --all: the entries of.ai/that still have files.sh <skill>/scripts/link-ai-folder.sh: the link state.sh <skill>/scripts/install-rule.sh: the rule state of each agent.createoraddmeans that the rule is not installed.outdatedmeans that the rule is installed but is different from the rule that the script writes now: an older skill version, a different script path, or a hand edit.unchangedmeans that the rule is up to date.
Then offer the steps that are not done yet. When a rule is outdated, offer install-rule first, then migrate and link. Else use this order: migrate, link, install-rule. Ask the user which to run, with a choice prompt if the agent has one. Always include link when the link offer below applies. After the steps that the user chose are done, do the link offer again, because a migrate can make .ai empty.
migrate
- Run
sh <skill>/scripts/migrate-ai-output.sh --all(dry run) and show the result. It moves every entry of.ai/, files at the top level included..DS_Storefiles stay. - Ask the user. Only after an explicit yes, run it with
--apply. - Report what moved, what is the same, the conflicts and what is left. A conflict means that a different file with the same name exists in the output folder. Both files stay. Let the user decide what to do with them.
- Do the link offer.
link
The link makes .ai a symbolic link to the output folder, so any agent or tool that writes .ai/... writes into the output folder.
- Run
sh <skill>/scripts/link-ai-folder.sh(dry run). If it exits with 4, explain why (files are still in.ai,.aiis tracked by Git, or.ailinks to a different place) and stop. - Show what it removes. This is the only step that removes anything:
.DS_Storefiles and empty folders in.ai. Ask each time. Only after an explicit yes, run it with--apply. - If it prints the gitignore warning, explain it: a
.ai/pattern matches only a folder, not a symbolic link, so.aishows as untracked. The fix is.ai(no slash) in the project's.gitignoreor in the global gitignore file. Do not change any gitignore file unless the user asks.
Link offer
Always ask the user whether to link .ai to the output folder, unless the project already has a .ai that is not empty.
- Run
sh <skill>/scripts/link-ai-folder.sh(dry run). - If it prints
already linked, do not ask. If it exits with 4, do not ask..aistill has files, is tracked by Git, or links to a different place. When.aihas files, tell the user that migrate must move them first. - Else
.aidoes not exist, or has only empty folders and.DS_Storefiles. Ask the user whether to link it, with a choice prompt if the agent has one. Show what the dry run removes. If the user agrees, do the link step from its step 2 (the--applyrun). Ask again each time, also when the user said no before.
install-rule
The rule tells agents to write their outputs into the output folder unless the user names another location.
Run
sh <skill>/scripts/install-rule.sh(dry run). It lists an action for each agent whose config folder exists:- Claude:
~/.claude/rules/Centralize-AI-Output.md(or under$CLAUDE_CONFIG_DIR) - Codex: a marked block in
~/.codex/AGENTS.md(or under$CODEX_HOME) - Gemini: a marked block in
~/.gemini/GEMINI.md
The actions are
create(no file),add(the file has no block),outdated(the installed rule is different) andunchanged. Thescript:line under each action is theai-output-dir.shthat the rule of that agent runs: the agent's own copy of this skill when it exists, else the copy that runs the installer. For each outdated rule, show the diff that the dry run prints before you ask.- Claude:
- Ask the user. Only after an explicit yes, run it with
--apply. Use--target claude,--target codexor--target geminiwhen the user wants only some of them. Each changed file gets a backup,<file>.bak.<YYYYmmdd-HHMMSS>. - Cursor has no user rule file. Show the text from
sh <skill>/scripts/install-rule.sh --print, and tell the user to paste it into Cursor Settings > Rules > User Rules. - The rule takes effect in new sessions.
- The rule has no key format. It only runs
ai-output-dir.sh, so a change of the project key needs no rule update. - Do the link offer.
- When a rule is outdated or has broken markers,
ai-output-dir.shof this skill (the script that the rule runs) prints a note for the agent on stderr.AI_AGENT_OUTPUT_RULE_CHECK=0turns the note off.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

