A standardized
.ai/workspace structure for AI assistants β with an extension-only architecture for Claude Code, OpenClaw, Pi, Cursor, and Copilot.
The dot-ai convention provides a universal workspace structure that helps AI assistants understand your project context, manage tasks, route between projects, and maintain consistency across sessions. v7 replaces the provider system with a unified extension-only architecture where everything β identity, memory, skills, routing, tools β is an extension.
- ποΈ Workspace Structure β Standardized
.ai/directory with boot sequence and project routing - π§© Extension-Only Architecture β Everything is an extension: identity, memory, skills, routing, tools
- π― Section-Based Context β Extensions return
Sectionobjects assembled by priority with token-budget trimming - π Token Budget β
formatSections()auto-trims sections to fit context window with BudgetWarning diagnostics - π§ Extension-Registered Tools β Tools defined in extensions, exposed as native agent capabilities
- π Deterministic Labels β Regex-based label extraction from vocabulary (no LLM in pipeline)
- π DotAiRuntime β Single class encapsulating boot, processPrompt, fireToolCall, fire, shutdown
- π 5 Emission Patterns β fire, fireCollectSections, fireFirstResult, fireChainTransform, fireUntilBlocked
- π‘ Boot Caching β Extensions discovered once per session, vocabulary built at boot
# Install the plugin
claude plugin add dot-aiFor programmatic use or custom adapters:
npm install @dot-ai/core @dot-ai/adapter-claudeAvailable packages:
| Package | Description |
|---|---|
@dot-ai/core |
Runtime engine, extension runner, section formatting |
@dot-ai/adapter-claude |
Claude Code adapter |
@dot-ai/adapter-pi |
Pi adapter (full event support) |
@dot-ai/adapter-sync |
Cursor / Copilot / Windsurf sync adapter |
@dot-ai/adapter-openclaw |
OpenClaw adapter |
@dot-ai/ext-sqlite-memory |
SQLite-backed memory extension |
@dot-ai/ext-file-memory |
File-backed memory extension |
@dot-ai/ext-file-skills |
File-based skills extension |
@dot-ai/ext-file-identity |
File-based identity extension |
@dot-ai/ext-file-tools |
File-based tools extension |
@dot-ai/ext-file-tasks |
File-based tasks extension |
@dot-ai/ext-file-prompts |
File-based prompts extension |
@dot-ai/ext-rules-routing |
Rules-based routing extension |
@dot-ai/cli |
CLI for workspace management |
openclaw plugins install dot-ai
openclaw gateway restartUse the adapter-sync package to generate agent-specific configuration:
npx @dot-ai/adapter-syncThis generates:
- Windsurf:
.windsurf/rules/dot-ai.md - Cursor:
.cursor/rules/dot-ai.md - Codex: Injects into root
AGENTS.md - Continue.dev: Manual reference in
.continuerc.json
mkdir -p my-project/.ai/memory/tasks
cd my-project/.aiCreate .ai/AGENTS.md:
# AGENTS.md
This workspace follows the dot-ai convention.
## Project
{Brief description of your project}
## Conventions
- Read `.ai/skills/dot-ai/BOOTSTRAP.md` for workspace rules
- Use `dot-ai-tasks` for task management (not built-in todos)
- Follow model routing guidelinesThe plugin automatically detects any workspace with .ai/AGENTS.md and:
- β Loads workspace context at session start
- β
Discovers and activates extensions from
.ai/extensions/and installed packages - β Enforces task management conventions
- β Optimizes model selection for sub-agents
- β Provides access to all skills and capabilities
No local installation needed β the plugin provides skills globally!
Extensions are the only mechanism for contributing content in v7. Place TypeScript files in .ai/extensions/ or install extension packages β they are loaded automatically at boot.
// .ai/extensions/security-gate.ts
import type { ExtensionAPI } from '@dot-ai/core';
export default function(api: ExtensionAPI) {
// Gate tool calls
api.on('tool_call', async (event) => {
if (event.tool === 'Write' && event.input.file_path?.toString().endsWith('.env')) {
return { decision: 'block', reason: 'Cannot write to .env files' };
}
});
// Enrich context with sections
api.on('context_enrich', async (event) => {
return {
sections: [{
title: 'Security Rules',
content: '> Always write tests for new features.',
priority: 70,
source: 'security-gate',
}],
};
});
// Register skills, identities, labels
api.registerSkill({ name: 'security', description: 'Security rules', labels: ['security'] });
api.contributeLabels(['security', 'auth', 'secrets']);
}| Event | Emission Pattern | Description |
|---|---|---|
context_enrich |
fireCollectSections | Extensions return { sections } for context injection |
label_extract |
fireChainTransform | Extensions modify the labels array |
route |
fireFirstResult | First extension to return a routing result wins |
tool_call |
fireUntilBlocked | Gate or block tool calls before execution |
tool_result |
fireChainTransform | Observe or transform tool results |
agent_end |
fire | React when an agent completes |
input |
fireChainTransform | Rewrite user input before processing |
session_start |
fire | Session lifecycle |
session_end |
fire | Session lifecycle |
session_compact |
fire | Context compaction event |
Extensions receive an ExtensionAPI object with:
| Method | Purpose |
|---|---|
api.on(event, handler) |
Subscribe to events |
api.registerTool(tool) |
Register a tool the agent can invoke |
api.registerCommand(cmd) |
Register a slash command |
api.registerSkill(skill) |
Register a skill for context enrichment |
api.registerIdentity(identity) |
Register an identity document |
api.contributeLabels(labels) |
Add labels to the global vocabulary |
api.events |
Inter-extension event bus |
api.config |
Extension-specific configuration |
api.workspaceRoot |
Workspace root directory |
Not all adapters support every event. The matrix below shows what each adapter can fire:
| Adapter | context_enrich | tool_call | agent_end | tool_result | input |
|---|---|---|---|---|---|
| Pi | β | β | β | β | β |
| Claude Code | β | β | β | β | β |
| OpenClaw | β | β | β | β | β |
| Cursor/Copilot (sync) | β | β | β | β | β |
See docs/extensions.md for the full extension authoring guide.
| Skill | Purpose | Triggers |
|---|---|---|
| dot-ai | Main workspace convention | manual |
| dot-ai-tasks | Task management (use instead of todos) | always |
| model-selection | Smart model routing (Haiku/Sonnet/Opus) | always |
| context-strategy | Context budget management (<50%, >70%, >85%) | always |
| Skill | Purpose | Triggers |
|---|---|---|
| dot-ai-workspace-scan | Scan .ai/ directories, build project index | boot, manual |
| dot-ai-project-init | Create new project with proper structure | manual |
| dot-ai-migrate | Migrate from older convention versions | manual, auto-detect |
| Skill | Purpose | Triggers |
|---|---|---|
| dot-ai-audit | Weekly workspace coherence validation | heartbeat, manual |
| dot-ai-agent-sync | Generate/maintain AGENT.md sections | manual, audit |
| dot-ai-skill-sync | Validate SKILL.md frontmatter | audit |
| dot-ai-backlog-sync | Validate task structure | audit |
| dot-ai-memory-sync | Validate memory/ directory structure | audit |
| dot-ai-tools-sync | Validate TOOLS.md structure | audit |
| Skill | Purpose | Triggers |
|---|---|---|
| dot-ai-export | Export workspace as JSON/YAML/Markdown | manual |
| dot-ai-doctor | Health checks and troubleshooting | manual, on errors |
| dot-ai-security | Security rules and verification | always |
| dot-ai-self-improve | Learning loop and pattern extraction | manual |
my-project/
βββ .ai/ # Root workspace context
β βββ AGENTS.md # Required β AI operating rules
β βββ SOUL.md # Optional β Workspace personality
β βββ USER.md # Optional β User preferences
β βββ IDENTITY.md # Optional β Project identity
β βββ TOOLS.md # Optional β Tool configuration
β β
β βββ extensions/ # User-authored extensions (v7)
β β βββ *.ts # Loaded automatically at boot
β β
β βββ memory/ # Session memory and tasks
β β βββ YYYY-MM-DD.md # Daily session notes
β β βββ tasks/ # Task details (on-demand)
β β β βββ {slug}.md
β β βββ research/ # Research notes
β β
β βββ data/ # Structured data ONLY (no drafts!)
β β βββ exports/ # Generated exports (CSV, JSON)
β β βββ imports/ # External data imports
β β
β βββ skills/
β βββ dot-ai/ # Symlink to plugin skills (auto-created)
β βββ BOOTSTRAP.md # Lightweight startup context
β βββ SKILL.md # Full documentation
β βββ CONVENTIONS.md # Shared conventions
β βββ templates/ # Reusable templates
β
βββ projects/ # Sub-projects (optional)
βββ {project-name}/
βββ .ai/ # Per-project AI context
βββ AGENT.md # Project-specific docs
βββ memory/
βββ tasks/
- Root
.ai/β Workspace-wide context - Project
.ai/β Project-specific context - Extensions β
.ai/extensions/and installed packages loaded at boot - Data Separation β
.ai/data/= structured only, no research/drafts - Memory Organization β Daily notes, tasks, research separated
Always use dot-ai-tasks instead of built-in todos.
Tasks are managed through the task extension. The extension can be backed by:
- File-based (
@dot-ai/ext-file-tasks) β JSON files in.ai/memory/tasks/ - Custom β Any extension implementing the task pattern
Configure in .ai/settings.json:
{
"packages": [
"@dot-ai/ext-file-tasks"
]
}Tasks support standard fields: id, text, status, priority, project, tags.
The plugin automatically injects model routing rules:
Task Type β Model to Use
βββββββββββββββββββββββββββββββββββββββββββββββββ
OCR, extraction, formatting β Haiku (cheap)
Development, refactoring β Sonnet (standard)
Architecture, planning β Opus (strategic only)
Anti-patterns:
- β Never spawn sub-agent without specifying model
- β Never use Opus for execution tasks
- β Never do multiple web_fetch in Opus
The plugin monitors context usage and suggests delegation:
Context Usage β Action
βββββββββββββββββββββββββββββββββββββββ
< 50% β Normal operation
50-70% β Delegate reads to sub-agents
> 70% β Switch to Sonnet if on Opus
> 85% β Stop reading, work from memory
Run workspace diagnostics:
"doctor" or "health check"
Output:
π₯ dot-ai Health Check
Overall Health: 85/100 (Good)
β
Passed (5):
- Structure validation
- Required files
- Extension loading
- Cache fresh (<7 days)
β οΈ Warnings (2):
- 3 orphan tasks without backlog refs
- 1 extension failed to load (syntax error)
π Suggested Fixes:
1. Run backlog-sync to add orphan tasks
2. Check .ai/extensions/ for syntax errors
Agent (Claude Code / OpenClaw / Pi / Cursor / Copilot)
βββ Adapter (hooks into native events)
βββ DotAiRuntime (@dot-ai/core)
βββ boot() β discover extensions, register resources, build vocabulary
βββ processPrompt() β label_extract, context_enrich, route β { sections, labels, routing }
βββ fireToolCall() β extension-based tool gating
βββ fire('agent_end', { response }) β notify extensions
βββ shutdown() β session_end + flush
βββ diagnostics β extension status
Extensions (everything is an extension):
βββ ext-file-identity β registerIdentity(), context_enrich
βββ ext-file-memory β context_enrich, agent_end
βββ ext-file-skills β registerSkill(), context_enrich
βββ ext-rules-routing β route event handler
βββ ext-file-tasks β registerTool(), context_enrich
βββ ext-file-tools β registerTool(), context_enrich
βββ ext-file-prompts β context_enrich
βββ ext-sqlite-memory β context_enrich, agent_end
βββ .ai/extensions/*.ts β user-authored extensions
See ARCHITECTURE.md for the full technical reference.
All large skills (>100 lines) use INDEX/SKILL separation:
-
INDEX.md (~30-40 lines) β Quick reference at startup
- Purpose and triggers
- Quick commands
- Key concepts
- Use cases
- Pointer to SKILL.md
-
SKILL.md (full docs) β Loaded on-demand
- Detailed procedures
- Examples and edge cases
- Templates and validation rules
- Integration points
Benefits:
- β Fast startup (agent sees overview)
- β Complete awareness (knows what exists)
- β Progressive loading (details when needed)
-
CONVENTIONS.md β Single source of truth for:
- Marker patterns
- Frontmatter schema
- Output formats
- Validation workflows
- Directory structure
-
templates/ β Reusable templates:
- BACKLOG.template.md
- AGENT.template.md
- SKILL.template.md
- task-details.template.md
- validation-output.template.md
The central configuration file at .ai/settings.json:
{
"packages": [
"@dot-ai/ext-file-identity",
"@dot-ai/ext-file-memory",
"@dot-ai/ext-file-skills",
"@dot-ai/ext-rules-routing",
"@dot-ai/ext-file-tasks",
"@dot-ai/ext-file-tools"
],
"extensions": [
".ai/extensions/custom.ts"
],
"debug": {
"logPath": ".ai/debug.log"
}
}User-level defaults can be set in ~/.ai/settings.json. These are merged with project-level settings (arrays deduplicated, project scalars win):
{
"packages": [
"@dot-ai/ext-file-identity",
"@dot-ai/ext-file-memory"
]
}Packages listed in settings.json are automatically installed into .ai/packages/ at boot if not already present. No manual npm install needed.
Each adapter resolves the workspace root (the directory containing .ai/) and passes it to DotAiRuntime. The resolution priority varies by adapter:
OpenClaw adapter:
| Priority | Source | Use Case |
|---|---|---|
| 1 | process.cwd() |
CLI / local usage where cwd is the project |
| 2 | pluginConfig.workspace |
Gateway / Discord / TUI where cwd is not the project |
| 3 | ctx.workspaceDir |
OpenClaw fallback |
Claude Code adapter: Uses the hook's cwd (always the project directory).
Pi adapter: Uses the configured workspaceRoot option.
In openclaw.json, configure the workspace path for gateway/Discord/TUI environments under plugins.entries.dot-ai.config:
{
"plugins": {
"entries": {
"dot-ai": {
"enabled": true,
"config": {
"workspace": "/Users/you/dev/my-project"
}
}
}
}
}Uses .claude-plugin/plugin.json for metadata and skill registration.
- ARCHITECTURE.md β Full v7 architecture (runtime, extensions, events, formatting)
- docs/extensions.md β Extension authoring guide (events, custom tools, best practices)
- BOOTSTRAP.md β Lightweight startup context (what agent sees at boot)
- SKILL.md β Full dot-ai convention documentation
- CONVENTIONS.md β Shared conventions across all skills
- Create skill directory:
skills/my-skill/ - Create INDEX.md (~30 lines) with overview
- Create SKILL.md with full documentation
- Add skill to manifests:
openclaw.plugin.jsonβskillsarray.claude-plugin/plugin.jsonβskillsarray
- Update plugin injection in
index.tsif needed
- Create a
.tsfile in.ai/extensions/or a newext-*package - Export a default function that receives
ExtensionAPI - Register resources (
registerSkill,registerIdentity,contributeLabels) - Subscribe to events (
context_enrich,tool_call,agent_end, etc.) - Extensions are loaded automatically at boot β no registration needed
Releases are CI-only β never run the release script locally.
- Trigger: Manual
workflow_dispatchon GitHub Actions (.github/workflows/release.yml) - Versioning: All packages use fixed versioning (same version). Current version is resolved from git tags, not
package.json. - Bump detection: Automatic via conventional commits (
feat:β minor,fix:β patch) - What happens:
- Bumps all
packages/*/package.json - Syncs plugin manifests (
openclaw.plugin.json,.claude-plugin/plugin.json, etc.) - Generates
CHANGELOG.md, creates git commit & tag - Publishes all packages to npm
- Bumps all
- Follow INDEX/SKILL pattern for skills >100 lines
- Reference CONVENTIONS.md for shared patterns
- Use templates from
templates/directory - Include frontmatter with name, description, triggers
- Add cross-references to related skills
- Write clear examples and use cases
# OpenClaw
openclaw plugins list
openclaw gateway restart
# Claude Code
claude plugin list
claude plugin enable dot-aiCheck that .ai/AGENTS.md exists:
ls -la .ai/If missing, create it or run:
"init project {name}"
Check the diagnostics output:
"doctor" or "health check"
Common issues:
- Syntax error in
.tsfile - Missing default export
- Listening to events not supported by current adapter
Run diagnostics and follow suggested fixes from the output.
The plugin provides skills globally. If skills aren't working:
- Verify plugin is enabled
- Restart agent/gateway
- Check workspace has
.ai/AGENTS.md
Startup injection:
- Before optimization: 1582 lines
- After optimization: 620 lines
- Reduction: 61% (962 lines saved)
Strategy:
- INDEX.md files provide overview (520 lines)
- SKILL.md files loaded on-demand (1600+ lines)
- Agent maintains 100% awareness with 61% fewer tokens
Impact:
- β Faster startup across all adapters
- β More context budget for actual work
- β Same functionality, better performance
MIT License β See LICENSE for details.
- Repository: https://github.com/jogelin/dot-ai
- Issues: https://github.com/jogelin/dot-ai/issues
- OpenClaw: https://github.com/openclaw/openclaw
- Claude Code: https://claude.ai/claude-code
dot-ai provides a universal workspace convention for AI assistants:
- β
Standardized
.ai/structure with multi-project support - β Extension-only architecture β everything (identity, memory, skills, routing, tools) is an extension
- β
Section-based context enrichment via
context_enrichevent - β DotAiRuntime with boot, processPrompt, fireToolCall, fire, shutdown
- β 5 emission patterns (fire, fireCollectSections, fireFirstResult, fireChainTransform, fireUntilBlocked)
- β
Token budget with section-aware trimming (
formatSections,trimSections) - β Deterministic label-based matching (no LLM in pipeline)
- β Boot caching for fast per-prompt enrichment
- β Works with Claude Code, OpenClaw, Pi, Cursor, Copilot
Get started: Create .ai/AGENTS.md in your project root and let the plugin handle the rest!
Made with β€οΈ by the dot-ai community
Last updated: 2026-03-07