Odf init

From antoniodavid/odf-agent-team · View interactive version

Odf init is an AI agent skill from the GitHub repository antoniodavid/odf-agent-team. Use when initializing an ODF project: detect the Odoo version, modules, runner, lint, and conventions, and persist partial context.

How to use this skill

Skill file

Activation Contract

Use at project entry or when Odoo tooling changes, before phases that consume

project context. Detect locally and persist the result; do not guess missing

values.

When to Use

Use when entering a new Odoo project, or when project tooling changes (new test runner, new dependencies). Persist to Engram under odf-init/{project} so all ODF phases reuse the config without re-detecting.

Hard Rules

| Rule | Requirement |

|------|-------------|

| Never ask what can be detected | Try all detection methods before asking the user |

| Never guess | If detection fails for a field, set it to null — don't invent |

| Never invent context | project_context.principles and project_context.glossary only contain detected or explicitly confirmed entries; leave them empty when absent |

| Partial is better than none | Persist even partial detection |

| Upsert | Running /odf-init again updates the existing config |

Decision Gates

| Condition | Action |

|-----------|--------|

| Version in prompt | Use it directly |

| No version in prompt | Try: manifest.py → odoo-bin --version → Dockerfile → ask user |

| Test runner found via detection | Use detected command template with {module} placeholder |

| Docker Compose present (docker-compose.yml / compose.yml / compose.yaml with an odoo service) | Build template docker compose run --rm <service> odoo -d {test_db} -i {module} --test-enable --stop-after-init; disposable {test_db} is preferred |

| Local odoo-bin found with a named database | Build template odoo-bin -d {test_db} -i {module} --test-enable --stop-after-init; a non-isolated development database is allowed only for this run when the current user-approved scope names that exact {test_db} and authorizes its use |

| No exact database or current authorization for a non-isolated database | Block and ask the user; never guess a database or use a developer/production database without current authorization |

| No test runner detected | Flag WARNING, set runner: none |

| Doodba odoo/custom/src/addons.yaml present | Parse sources (active/commented), classify declared-absent and undeclared repos, and resolve project module dependencies against active sources |

| CodeGraph CLI available and <repo>/.codegraph/ missing | Initialize the project index (default) or the active sources (--deep, opt-in, with a cost warning) |

Execution Steps

  1. Deterministic scan (preferred): run the CLI once instead of hand-scanning:

```

PACK="${ODF_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}"

node "$PACK/scripts/odf-project-scan.js" --root <doodba-workspace-root> --repo <repo-dir> --persist --format json

```

The pack path is deterministic: $ODF_CONFIG_DIR when set, else the pack the running module ships in, else ${XDG_CONFIG_HOME:-$HOME/.config}/opencode. Never search the filesystem for the script. If $PACK/scripts/odf-project-scan.js does not exist, reinstall the pack (install.sh from the repo or /odf-registry-refresh) or fall back to the manual steps below; for a project-local pack prefer the project launcher, which exports ODF_CONFIG_DIR. The CLI assembles the full config (sources, compose, linting, git, CodeGraph, dependency matrix), persists it to Engram under odf-init/{project}, verifies the readback with an explicit --project {project} scope (never the invocation cwd), and exits 0 (ok), 1 (warnings), or 2 (blocked). On verified persistence it prints artifact_ref: {"store":"engram","ref":"odf-init/{project}"}. Use --diff on re-detection to show changes vs the persisted config, --fresh to bypass the checksum cache, and flags for overrides (--odoo-version, --docker-container, --codegraph for CodeGraph init opt-in). The orchestrator relays the summary and interprets warnings only; it never re-derives the config. If the CLI cannot run (no node/script), fall back to the manual steps below — never guess.

  1. Detect version: manifest.py → odoo-bin → Dockerfile → ask
  2. Detect modules: Find all manifest.py, classify as custom/oca/core-override
  3. Environment Context (Doodba): When the workspace is a Doodba layout, detect the source manifest and resolve project module dependencies:

```

PACK="${ODF_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}"

node "$PACK/scripts/odf-env-detect.js" --root <root> --repo <repo> --json

```

($PACK is deterministic — $ODF_CONFIG_DIR when set, else ${XDG_CONFIG_HOME:-$HOME/.config}/opencode; never search the filesystem.)

  1. CodeGraph Index:
  1. Detect test runner: Priority: Docker Compose → local odoo-bin → pytest-odoo

```

docker compose run --rm odoo odoo -d {test_db} -i {module} --test-enable --stop-after-init

```

Replace {module} with the module under test and odoo with the real service name if it differs. This is the test_command to persist — do NOT persist a bare odoo-bin invocation for a Docker Compose project.

  1. Detect linting: pre-commit config, pylint-odoo availability, OCA compliance flags
  2. Detect conventions + project context: Module prefix patterns, git workflow, CI platform, README conventions. Also detect project context when present: principles (engineering rules stated by the repo — CONTRIBUTING, README, pre-commit/OCA config; never invented) and glossary (existing CONTEXT.md or domain docs mapping business terms ↔ Odoo models/fields). Persist as project_context: { principles: [], glossary: {} }; leave both empty when absent — never invent entries
  3. Build config: Assemble YAML with project_name, odoo_version, modules[], environment{}, testing{}, linting{}, flags{}, conventions{}, project_context{}
  4. Persist the config to Engram under odf-init/{project} (project context is Engram-canonical; the preflight-selected store applies to change artifacts) and return artifact_ref: { store: engram, ref: odf-init/{project} }.

Output Contract

Return the complete shared ODF Result envelope, including every required common field (especially strategy and skill_resolution), with executive_summary ("{project}: Odoo {ver}, {N} modules, {env}, {runner} tests"). Include risks for missing tooling warnings. For a non-isolated database, include its exact name, database_isolation: non-isolated, database_authorization: current-user-approved, and the warning that tests may mutate module, schema, and test data. Use blocked when the exact database or required current authorization is missing.

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.