dotai-cli 0.3.0__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/.gitignore +1 -0
  2. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/PKG-INFO +206 -37
  3. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/README.md +205 -36
  4. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/pyproject.toml +1 -1
  5. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/__init__.py +1 -1
  6. dotai_cli-0.5.0/src/dotai/agents.py +156 -0
  7. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/cli/__init__.py +9 -4
  8. dotai_cli-0.5.0/src/dotai/cli/agents_cmd.py +108 -0
  9. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/cli/rules_cmd.py +255 -0
  10. dotai_cli-0.5.0/src/dotai/cli/sync_cmd.py +349 -0
  11. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/cli/watch_cmd.py +18 -4
  12. dotai_cli-0.5.0/src/dotai/context.py +359 -0
  13. dotai_cli-0.5.0/src/dotai/maintenance.py +821 -0
  14. dotai_cli-0.5.0/src/dotai/seed/skills/compress.md +59 -0
  15. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/sync.py +310 -40
  16. dotai_cli-0.5.0/tests/test_agents.py +110 -0
  17. dotai_cli-0.5.0/tests/test_context.py +181 -0
  18. dotai_cli-0.5.0/tests/test_maintenance.py +362 -0
  19. dotai_cli-0.5.0/tests/test_sync.py +378 -0
  20. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/uv.lock +1 -1
  21. dotai_cli-0.3.0/src/dotai/cli/sync_cmd.py +0 -211
  22. dotai_cli-0.3.0/tests/test_sync.py +0 -154
  23. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/.github/workflows/ci.yml +0 -0
  24. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/.github/workflows/publish.yml +0 -0
  25. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/LICENSE +0 -0
  26. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/rdc.yaml +0 -0
  27. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/__main__.py +0 -0
  28. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/cli/__main__.py +0 -0
  29. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/cli/prefs_cmd.py +0 -0
  30. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/cli/roles_cmd.py +0 -0
  31. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/cli/skills_cmd.py +0 -0
  32. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/converter.py +0 -0
  33. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/import_agent.py +0 -0
  34. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/indexer.py +0 -0
  35. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/models.py +0 -0
  36. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/preferences.py +0 -0
  37. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/roles.py +0 -0
  38. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/rules.py +0 -0
  39. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/roles/architect.md +0 -0
  40. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/roles/debugger.md +0 -0
  41. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/roles/founder.md +0 -0
  42. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/roles/mentor.md +0 -0
  43. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/roles/product-manager.md +0 -0
  44. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/roles/qa.md +0 -0
  45. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/roles/reviewer.md +0 -0
  46. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/roles/security.md +0 -0
  47. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/roles/ship.md +0 -0
  48. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/roles/writer.md +0 -0
  49. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/skills/careful.md +0 -0
  50. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/skills/commit-helper.md +0 -0
  51. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/skills/context-dump.md +0 -0
  52. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/skills/investigate.md +0 -0
  53. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/skills/learn.md +0 -0
  54. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/skills/parallel-work.md +0 -0
  55. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/skills/plan.md +0 -0
  56. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/skills/review.md +0 -0
  57. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/skills/scaffold.md +0 -0
  58. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/skills/ship.md +0 -0
  59. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/skills/techdebt.md +0 -0
  60. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/seed/skills/verify.md +0 -0
  61. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/skills.py +0 -0
  62. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/store.py +0 -0
  63. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/tools/__init__.py +0 -0
  64. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/tools/base.py +0 -0
  65. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/tools/registry.py +0 -0
  66. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/utils.py +0 -0
  67. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/src/dotai/vet.py +0 -0
  68. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/tests/__init__.py +0 -0
  69. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/tests/conftest.py +0 -0
  70. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/tests/test_converter.py +0 -0
  71. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/tests/test_import_agent.py +0 -0
  72. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/tests/test_models.py +0 -0
  73. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/tests/test_preferences.py +0 -0
  74. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/tests/test_roles.py +0 -0
  75. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/tests/test_rules.py +0 -0
  76. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/tests/test_skills.py +0 -0
  77. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/tests/test_store.py +0 -0
  78. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/tests/test_utils.py +0 -0
  79. {dotai_cli-0.3.0 → dotai_cli-0.5.0}/tests/test_vet.py +0 -0
@@ -13,3 +13,4 @@ CLAUDE.md
13
13
  .cursorrules
14
14
  AGENTS.md
15
15
  GEMINI.md
16
+ .dotai-compression-proposal.json
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dotai-cli
3
- Version: 0.3.0
3
+ Version: 0.5.0
4
4
  Summary: Universal AI context for any coding agent. Roles, skills, and rules in ~/.ai/
5
5
  Project-URL: Homepage, https://github.com/dawalama/dotai
6
6
  Project-URL: Repository, https://github.com/dawalama/dotai
@@ -29,29 +29,63 @@ Description-Content-Type: text/markdown
29
29
 
30
30
  # dotai
31
31
 
32
- Universal AI context for any coding agent. Roles, skills, and rules in `~/.ai/`.
32
+ **Your coding agents should remember what you taught them.**
33
33
 
34
- ## The Problem
34
+ dotai gives Claude, Cursor, Gemini, Codex, and other coding agents one shared memory for how you build software. Keep your rules, workflows, and engineering taste in `~/.ai/`; sync them into any project with one command.
35
35
 
36
- Every AI coding tool has its own way to store context:
36
+ ```text
37
+ ┌─ CLAUDE.md + native slash commands
38
+ ~/.ai/ ── dotai sync ───┼─ .cursorrules
39
+ ├─ GEMINI.md
40
+ └─ AGENTS.md
41
+ ```
42
+
43
+ No server. No account. No proprietary memory layer. Just portable Markdown that you own.
44
+
45
+ ## Stop reteaching every agent
37
46
 
38
- - Claude Code → `CLAUDE.md`
39
- - Cursor → `.cursorrules`
40
- - Gemini CLI → `GEMINI.md`
41
- - Codex / Copilot → `AGENTS.md`
47
+ You tell one agent “never call `useEffect` directly.” Next week, a different agent does exactly that. Your review checklist lives in one tool, your deployment workflow in another, and the correction you made yesterday disappears with the chat.
42
48
 
43
- Your knowledge about how to write code, review it, ship it, and debug it gets scattered across tool-specific formats — or worse, stays in your head.
49
+ dotai turns those corrections into durable, reusable context:
44
50
 
45
- ## The Solution
51
+ - **Rules are hard constraints.** Capture coding standards and scope them by project or file pattern.
52
+ - **Skills are repeatable workflows.** Plan, investigate, review, verify, and ship the same way every time.
53
+ - **Roles change how the agent thinks.** Review as a security engineer; plan as a product manager.
54
+ - **Preference packs carry your taste.** Share softer choices without weakening hard rules.
55
+ - **Sync speaks each agent's language.** Generate the bootstrap file that Claude, Cursor, Gemini, or Codex already understands.
46
56
 
47
- `dotai` defines a universal `~/.ai/` directory convention that any tool can consume. It ships with:
57
+ The useful part is the feedback loop:
58
+
59
+ ```text
60
+ agent makes a mistake → capture the correction → sync → every agent learns it
61
+ ```
62
+
63
+ ## See it in action
64
+
65
+ ```bash
66
+ # Set up your global knowledge base
67
+ dotai init
48
68
 
49
- - **Roles** — Cognitive modes that shift how the AI thinks (reviewer, architect, founder, QA, etc.)
50
- - **Skills** — Reusable workflows with steps, inputs, gotchas, and role references
51
- - **Rules** — Structured coding standards with per-project toggles and file-pattern scoping (hard constraints)
52
- - **Preference packs** — Soft, borrowable taste (CLI stack, design micro-style); never override hard rules
53
- - **Agent sync** — Generate `CLAUDE.md`, `.cursorrules`, `GEMINI.md`, or `AGENTS.md` from your `~/.ai/`
54
- - **Native slash commands** — For Claude Code, skills become real `/run_*` commands automatically
69
+ # Teach every agent a correction you never want to repeat
70
+ dotai learn "no-print-debugging" \
71
+ --issue "Debug output was left in production code" \
72
+ --correction "Use structured logging and remove temporary debug output" \
73
+ --globs "*.py"
74
+
75
+ # Prepare that knowledge for the current project
76
+ cd ~/my-project
77
+ dotai sync
78
+ ```
79
+
80
+ Now the rule is available to every supported agent, alongside reusable commands such as:
81
+
82
+ ```text
83
+ /run_plan as product-manager
84
+ /run_investigate as debugger
85
+ /run_review as security-engineer
86
+ /run_verify
87
+ /run_ship
88
+ ```
55
89
 
56
90
  ## Installation
57
91
 
@@ -87,32 +121,113 @@ dotai roles
87
121
  dotai skills
88
122
  dotai rules
89
123
 
90
- # Sync agent bootstrap files into a project
124
+ # Prepare agent context for a project
91
125
  cd ~/my-project
92
126
  dotai sync
93
127
  ```
94
128
 
95
- This generates agent config files in your project root — `CLAUDE.md`, `.cursorrules`, `GEMINI.md`, and `AGENTS.md`. Structured rules and freeform conventions are included in full; roles and skills are included as a compact catalog by default. For Claude Code, sync also generates `.claude/skills/` entries so skills appear as native slash commands. Use `dotai sync --full` when an agent needs every role and skill definition inline.
129
+ Inside a Git repository, `dotai sync` defaults to **local mode**. It writes personal context under `~/.config/dotai/contexts/` and leaves team-owned files such as `CLAUDE.md`, `AGENTS.md`, and `.claude/skills/` untouched. Existing repository instructions are copied into the local context as the authoritative layer; personal dotai rules and preferences are explicitly supplemental.
130
+
131
+ Local context storage does not, by itself, make an agent load the context. Until an agent adapter is configured, use `dotai primer --path .` to print context for pasting or piping into your agent. Use `dotai sync --shared` only when your team has intentionally chosen to maintain dotai sections in repository files.
132
+
133
+ dotai uses progressive disclosure to keep prompts small. Synced context contains rule summaries and role/skill catalogs. Expand only what a task needs:
134
+
135
+ ```bash
136
+ # Expand rules matching the affected files
137
+ dotai context --path . --files src/api.py,tests/test_api.py
138
+
139
+ # Expand security-tagged rules and an active CLI preference pack
140
+ dotai context --path . --context security --domain cli
141
+
142
+ # Load one complete skill and its declared role
143
+ dotai context --path . --skill run_review
144
+ ```
145
+
146
+ Selection is deterministic: file globs, explicit context tags, active preference domains, and named skills or roles. dotai does not guess from semantic similarity. Every expanded item includes the reason it was selected.
147
+
148
+ ### Automatic delivery with Claude Code
149
+
150
+ The resolver is infrastructure; you should not have to type `dotai context`
151
+ during normal work. Install dotai's user-level Claude adapter once:
152
+
153
+ ```bash
154
+ # Preview the user-memory change
155
+ dotai agent setup claude
156
+
157
+ # Back up existing memory and install it
158
+ dotai agent setup claude --apply
159
+
160
+ # Confirm activation
161
+ dotai agent status claude
162
+
163
+ # See the most recent context Claude actually resolved
164
+ dotai agent last claude
165
+ ```
166
+
167
+ The adapter adds a small marker-managed block to `~/.claude/CLAUDE.md`, which
168
+ Claude Code loads as user memory across projects. It tells Claude to resolve
169
+ dotai context for substantial development work, after affected files are known,
170
+ and to avoid repeated calls when the task has not changed. Repository and
171
+ organization instructions remain authoritative.
172
+
173
+ For file-sensitive workflows such as review, debugging, verification, scaffolding,
174
+ maintenance, and release work, a resolution without `--files` is explicitly
175
+ marked provisional. Claude must resolve again after discovering the affected
176
+ files. `dotai agent last claude` reports whether the latest resolution is
177
+ `provisional` or `complete`.
178
+
179
+ The adapter does not modify repositories, install a persistent process, or use
180
+ MCP. Existing personal Claude instructions are preserved. To remove only
181
+ dotai's block:
182
+
183
+ ```bash
184
+ dotai agent remove claude
185
+ dotai agent remove claude --apply
186
+ ```
187
+
188
+ Setup and removal preview by default. Applied changes back up the prior Claude
189
+ memory under `~/.config/dotai/backups/agents/claude/`.
190
+
191
+ `dotai agent last claude` reads a local receipt written only when the Claude
192
+ adapter invokes the resolver. It reports selection metadata and reasons, but
193
+ never stores source contents, expanded prompts, credentials, or telemetry.
194
+
195
+ ### Moving an existing repository to local mode
196
+
197
+ If an older dotai version wrote generated context into repository files, use the
198
+ one-off detach command. It previews by default:
199
+
200
+ ```bash
201
+ dotai detach
202
+ dotai detach --apply
203
+ ```
204
+
205
+ Detach removes only complete `<!-- dotai:start -->` blocks and Claude skill
206
+ directories whose `SKILL.md` contains dotai's generated marker. Loader files
207
+ containing team content are preserved and updated in place; files containing
208
+ only generated dotai content are removed. Before applying changes, dotai copies
209
+ every affected artifact to `~/.config/dotai/backups/detach/`. Detach is not part
210
+ of routine sync and does not need to be run again after migration.
96
211
 
97
212
  ## Usage
98
213
 
99
214
  ### Daily workflow
100
215
 
101
216
  ```bash
102
- # Start of day: sync your knowledge into the project you're working on
217
+ # Start of day: refresh local context for the project you're working on
103
218
  cd ~/my-project
104
219
  dotai sync
105
220
 
106
221
  # Or leave it running — auto-resyncs when you edit ~/.ai/ files
107
222
  dotai watch
108
223
 
109
- # Now open your editor — Claude Code, Cursor, Gemini, etc.
110
- # Your roles, skills, and rules are already loaded.
224
+ # Print the context for an agent that does not yet have a dotai adapter
225
+ dotai primer --path .
111
226
  ```
112
227
 
113
228
  ### Using skills in Claude Code
114
229
 
115
- After `dotai sync`, skills appear as native slash commands:
230
+ After an explicit shared Claude sync (`dotai sync --shared --agents claude`), skills appear as native slash commands:
116
231
 
117
232
  ```
118
233
  > /run_plan # Plan before coding
@@ -125,6 +240,7 @@ After `dotai sync`, skills appear as native slash commands:
125
240
  > /run_careful # Enter production-safety mode
126
241
  > /run_verify # Run tests, types, lint, build
127
242
  > /run_learn # Capture a mistake as a permanent rule
243
+ > /run_compress # Draft and review smaller rule definitions
128
244
  ```
129
245
 
130
246
  ### Using skills outside Claude Code
@@ -177,6 +293,41 @@ dotai rules --check
177
293
 
178
294
  The feedback loop: **vibe-code → agent makes mistake → `/run_learn` → structured rule → `dotai sync` → agent never repeats it.**
179
295
 
296
+ ### Keeping rules healthy
297
+
298
+ Knowledge gets noisy as it grows. `dotai audit` reviews the effective ruleset locally and deterministically—nothing is sent to an external model.
299
+
300
+ ```bash
301
+ # Find weak, generic, preference-like, oversized, or overlapping rules
302
+ dotai audit
303
+ dotai audit --project my-app
304
+
305
+ # Machine-readable output or a CI quality gate
306
+ dotai audit --json
307
+ dotai audit --fail-on high
308
+ ```
309
+
310
+ The report includes stable finding codes, evidence, suggested actions, an estimated prompt-token cost, and a context-concentration summary showing which rules dominate the budget. Large-rule findings show the rule's share of total context, change risk, reviewable sections, and a conservative manual-savings range. Security and other high-consequence rules receive preservation-first guidance and are deliberately protected from “the model probably knows this” recommendations.
311
+
312
+ `dotai compress` turns high-confidence findings into a conservative plan. Semantic rewriting is handled by the active coding agent, not a hidden provider inside the CLI:
313
+
314
+ ```bash
315
+ # Inspect candidates
316
+ dotai compress
317
+
318
+ # Ask the current coding agent to draft, diff, and review changes
319
+ > /run_compress
320
+
321
+ # Low-level application boundary for an approved versioned proposal
322
+ dotai compress apply proposal.json
323
+ ```
324
+
325
+ `/run_compress` reads the JSON plan, drafts shorter complete rules, explains what it preserved and consolidated, shows the full diff in conversation, and asks `Apply this compression? [y/N]`. It then passes only approved changes to dotai. Near-duplicates, generic guidance, and rules that may belong in a preference pack remain suggestions unless the developer explicitly approves a concrete proposal.
326
+
327
+ When no exact duplicates exist, compression says there are no **safe automatic** savings while still listing semantic review candidates and their estimated savings. These estimates are directional—they help prioritize review. The CLI never invents a semantic rewrite or calls an external provider.
328
+
329
+ Proposal files are versioned and bound to the original rule with a SHA-256 hash, so stale or renamed rules are rejected. Before applying approved changes, dotai validates every proposed rule and creates a complete timestamped snapshot under the applicable `.ai/backups/<timestamp>-compress/`. After writing, the manifest is finalized with actual before/after hashes, per-rule token savings, total savings, and completion status. Subsequent audits show recently compressed rules and clearly note when a successful reduction remains above the large-rule threshold. Backups are ordinary local files and are never deleted automatically.
330
+
180
331
  ### Migrating existing agent files
181
332
 
182
333
  Already have a `CLAUDE.md`, `.cursorrules`, or `AGENTS.md`? Import user-authored content into `~/.ai/`:
@@ -298,6 +449,7 @@ dotai init ~/other-project
298
449
  ├── preferences/ # Soft taste packs (borrowable style priors)
299
450
  │ └── cli.md # Example: CLI stack / micro-style
300
451
  ├── preferences-active.json # Which preference packs are active
452
+ ├── backups/ # Local snapshots created before compression writes
301
453
  ├── roles/ # Cognitive modes
302
454
  │ ├── reviewer.md # Paranoid staff engineer
303
455
  │ ├── architect.md # Systems thinker
@@ -322,6 +474,7 @@ dotai init ~/other-project
322
474
  │ ├── verify.md # Run tests, types, lint (/run_verify)
323
475
  │ ├── plan.md # Structured planning workflow (/run_plan)
324
476
  │ ├── learn.md # Capture learnings as rules (/run_learn)
477
+ │ ├── compress.md # Review semantic rule compression (/run_compress)
325
478
  │ └── deploy/ # Folder-based skill (with scripts & assets)
326
479
  │ ├── main.md
327
480
  │ ├── scripts/
@@ -529,25 +682,31 @@ dotai toggle no-useeffect --off --project my-legacy-app
529
682
  dotai toggle no-useeffect --on
530
683
  ```
531
684
 
532
- Structured rules are included **inline** in every synced agent file. Freeform `rules.md` is included too. Skills/roles stay as catalogs unless you pass `dotai sync --full`.
685
+ Synced agent files contain a compact bootstrap by default: universal rule summaries plus preference, role, and skill catalogs. Use `dotai context` to expand relevant material on demand, or pass `dotai sync --full` for the legacy complete inline context.
533
686
 
534
687
  ## Agent Sync
535
688
 
536
- `dotai sync` generates tool-specific bootstrap files with:
689
+ `dotai sync` prepares tool-specific context with:
537
690
 
538
- - **Full structured rule bodies** (high-value constraints)
539
- - **Freeform `rules.md` conventions** (previously referenced but not inlined)
540
- - **Role and skill catalogs** (names, triggers, descriptions — not every skill novel)
691
+ - **Universal structured rule summaries** (always visible)
692
+ - **Pointers to freeform `rules.md` conventions**
693
+ - **Role and skill catalogs** (names, triggers, categories — not full workflows)
541
694
  - **Claude Code**: compact pointers + native `.claude/skills/` slash commands
542
695
 
543
696
  Use `--full` only when you need every role persona and skill definition dumped inline (larger context).
544
697
 
545
- These files contain machine-specific context and may include absolute paths. Treat them as generated per-user artifacts unless your team intentionally commits shared agent instructions. dotai-managed sections are marker-delimited, so syncing preserves user-authored content outside those markers.
698
+ In a Git repository, local mode is the default and writes outside the worktree. Team instructions take precedence over personal dotai rules and preferences. dotai does not attempt unreliable keyword-based conflict resolution; the generated context tells the agent to ignore conflicting personal guidance and ask when a disagreement is ambiguous.
546
699
 
547
700
  ```bash
548
- # Generate all (CLAUDE.md + .cursorrules + GEMINI.md + AGENTS.md)
701
+ # Safe default in Git: generate outside the repository
549
702
  dotai sync
550
703
 
704
+ # Preview the resolved mode and target without writing
705
+ dotai sync --check
706
+
707
+ # Explicit team-owned mode: update marked sections in repository files
708
+ dotai sync --shared
709
+
551
710
  # Generate for specific agents
552
711
  dotai sync --agents claude,cursor
553
712
  dotai sync --agents gemini
@@ -557,18 +716,22 @@ dotai sync --full
557
716
 
558
717
  # Print primer to stdout (for piping)
559
718
  dotai primer
560
- dotai primer --compact
719
+ dotai primer --path .
561
720
  dotai primer --full
721
+
722
+ # Resolve task-specific context on demand
723
+ dotai context --path . --files src/app.tsx --context security
724
+ dotai context --path . --skill run_review
562
725
  ```
563
726
 
564
727
  ### Supported Agents
565
728
 
566
729
  | Agent | Output File | Sync Command | Notes |
567
730
  |-------|-------------|--------------|-------|
568
- | Claude Code | `CLAUDE.md` + `.claude/skills/` | `dotai sync --agents claude` | Marker-based merging + native slash commands |
569
- | Cursor | `.cursorrules` | `dotai sync --agents cursor` | Full rules and preferences; role/skill catalog by default |
570
- | Gemini CLI | `GEMINI.md` | `dotai sync --agents gemini` | Auto-discovered in project root and `~/.gemini/GEMINI.md` |
571
- | Generic | `AGENTS.md` | `dotai sync --agents generic` | Works with Codex, Copilot, and any agent that reads it |
731
+ | Claude Code | Local cache; shared: `CLAUDE.md` + `.claude/skills/` | `dotai sync --agents claude` | Team file is authoritative; shared mode uses marker-based merging |
732
+ | Cursor | `.cursorrules` | `dotai sync --agents cursor` | Compact bootstrap by default; full context with `--full` |
733
+ | Gemini CLI | `GEMINI.md` | `dotai sync --agents gemini` | Compact bootstrap; shared files are auto-discovered by Gemini CLI |
734
+ | Generic | `AGENTS.md` | `dotai sync --agents generic` | Compact bootstrap for agents that read `AGENTS.md` |
572
735
 
573
736
  For Claude Code, `dotai sync` also generates `.claude/skills/<trigger>/SKILL.md` files. These register as native slash commands — they appear in autocomplete and work as real `/run_*` commands with role composition support built in.
574
737
 
@@ -696,9 +859,15 @@ dotai roles # List available roles
696
859
  dotai role <name> # Output a role's full prompt to stdout
697
860
  dotai skills [-c category] # List skills (optionally filter by category)
698
861
  dotai prompt <skill> [--role <role>] # Assemble skill + role prompt for any agent
699
- dotai sync [path] [--agents ...] [--full] # Sync ~/.ai/ into agent config files
700
- dotai primer [--project <name>] [--full|--compact] # Print agent context to stdout
862
+ dotai sync [path] [--local|--shared] [--check] [--agents ...] [--full]
863
+ dotai detach [path] [--apply] # One-off removal of old shared-sync artifacts
864
+ dotai agent setup|status|last|remove claude [--apply] # User-level Claude delivery
865
+ dotai primer [--project <name>|--path <path>] [--full]
866
+ dotai context --path <path> [--task ...] [--files ...] [--context ...] [--domain ...] [--skill ...]
701
867
  dotai rules [-p project] [-a] [--check] # List rules (or audit quality)
868
+ dotai audit [-p project] [--json] [--fail-on severity] # Read-only rule audit
869
+ dotai compress [-p project] [--json] # Plan compression candidates
870
+ dotai compress apply <proposal.json> [--yes] # Validate, back up, and apply proposals
702
871
  dotai toggle <rule-id> --on/--off # Enable/disable rules globally or per-project
703
872
  dotai learn "title" -i "..." -c "..." # Create structured rule (default)
704
873
  dotai learn "title" -i "..." -c "..." --dry-run|--sync|--force|--append-md