wicked-garden-domain-extractor
Skill9 starsChanged 7 months agoMITView on GitHub
Rule-extraction worker for the FOUNDATIONAL domain-model capability. Mines testable business rules from a codebase — each with a numeric confidence and a provenance{source, ref, source_kinds} — and annotates them into the estate store so wicked-core can build the domain-model requirements graph (coverage-gated).
- Installs packages
In this repository142 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- plugin-json-schemaSkill
- readme-style-guideSkill
- releaseSkill
- scaffoldSkill
- wicked-garden-agentic-agentic-patternsSkill
- wicked-garden-agentic-architectSkill
- wicked-garden-agentic-context-engineeringSkill
- wicked-garden-agentic-frameworksSkill
- wicked-garden-agentic-performance-analystSkill
- wicked-garden-agentic-review-methodologySkill
- wicked-garden-agentic-safety-reviewerSkill
- wicked-garden-agenticSkill
- wicked-garden-agentic-trust-and-safetySkill
- wicked-garden-appsSkill
- wicked-garden-archetypeSkill
- wicked-garden-build-guideSkill
- wicked-garden-classifySkill
- wicked-garden-coreSkill
- wicked-garden-data-engineerSkill
- wicked-garden-dataSkill
- wicked-garden-deliberateSkill
- wicked-garden-demoSkill
- wicked-garden-domain-coverageSkill
- wicked-garden-domain-modelerSkill
- wicked-garden-domainSkill
- wicked-garden-draftSkill
- wicked-garden-editor-scaffoldSkill
- wicked-garden-engineering-api-documentarianSkill
- wicked-garden-engineering-architectureSkill
- wicked-garden-engineering-backendSkill
- wicked-garden-engineering-debuggingSkill
- wicked-garden-engineering-docsSkill
- wicked-garden-engineering-frontendSkill
- wicked-garden-engineering-integrationSkill
- wicked-garden-engineering-large-scale-migrationSkill
- wicked-garden-engineering-migration-engineerSkill
- wicked-garden-engineering-patchSkill
- wicked-garden-engineeringSkill
- wicked-garden-engineering-solution-architectSkill
- wicked-garden-engineering-system-designSkill
- wicked-garden-engineering-unit-test-qualitySkill
- wicked-garden-governed-workerSkill
- wicked-garden-groundSkill
- wicked-garden-jam-brainstorm-facilitatorSkill
- wicked-garden-jam-councilSkill
- wicked-garden-jamSkill
- wicked-garden-learnSkill
- wicked-garden-mcp-scaffoldSkill
- wicked-garden-mcpSkill
- wicked-garden-mem-captureSkill
- wicked-garden-mem-ingestSkill
- wicked-garden-memSkill
- wicked-garden-personaSkill
- wicked-garden-platform-auditSkill
- wicked-garden-platform-compliance-officerSkill
- wicked-garden-platform-complianceSkill
- wicked-garden-platform-errorsSkill
- wicked-garden-platform-gate-benchmark-rebaselineSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 2 are distinctive, and 6 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.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
If none of these is available, or Python 3 is missing, skip the script-backed step, say so, and follow the manual alternative where one is …
- Very specific: line 39
When .wicked/domain/worklist.json exists in your working directory, the run's host step extract-prepare wrote it: behaviours that are not …
- Very specific: line 54
Run the harness in file mode (one Bash call.
- Very specific: line 73
Read each unit's source and write each statement yourself: Create and change the file with your file write and edit tools, never with an …
- Distinctive: line 84
Leave a statement empty for pure plumbing too (a re-export, a trivial getter, a pass-through wrapper, formatting), never because the rule …
- Very specific: line 172
Every output is validated — a real SymbolId, numeric confidence ∈ [0,1] (ISS-11 hard-fail), grounded provenance{source,ref,source_kinds} — …
- Very specific: line 186
Every requirement has business_rules with minItems 1.
- Very specific: line 187
Every business rule: numeric confidence ∈ [0,1] and provenance{source, ref, source_kinds}.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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
Domain Extractor
You extract testable business rules from a codebase — what the business
requires, not how the code does it — and annotate them into the estate store,
so wicked-core builds the domain-model requirements graph (coverage-gated,
fail-closed below the configured minimum: by default, 80% of the behaviours in product code
stated as real requirements). You are the Creator role; a seat-distinct evaluator (domain-coverage)
judges coverage, never you.
Runtime
Script-backed steps use the wicked-garden launcher: wicked-garden run <plugin-root-relative path, e.g. scripts/…> [args]. It is on PATH after npm i -g wicked-garden; otherwise use npx wicked-garden run …; inside a wicked-crew run it is "$WICKED_GARDEN_ROOT/scripts/wicked-garden".
If none of these is available, or Python 3 is missing, skip the script-backed step, say so, and follow the manual alternative where one is given next to it — never invent the script's output.
Relative paths in this skill are relative to the directory that contains this SKILL.md.
Inside a crew run: the worklist is in your worktree (file mode)
When .wicked/domain/worklist.json exists in your working directory, the run's host step
extract-prepare wrote it: behaviours that are not real requirements yet (the unmapped ones,
then placeholders an earlier page left empty or under the confidence threshold, then mapped
behaviours whose code changed since the map was built, marked changed_since_build with their
prior_statement), hub-first, each framed with its source slice and neighbours. Your seat cannot write the store and needs no wicked-core or
wicked-estate — the host step extract-apply checks and writes what you produce. Do this,
and only this:
- A worklist with no units (
"units": []): there is nothing to state. Write no file and say so in one line. The host's apply step reads its own record of the page it prepared and finishes it ("map already current … nothing to extract"); it applies no rules file for such a page. It refuses a missing file for a page that had units, so never leave the file out when the worklist has any. A review that sends back a page with no units asks for work the host cannot apply: say so plainly, and the person decides at the step's gate. - Run the harness in file mode (one
Bashcall; it stops inside its budget):
It states each unit's rule with the bounded rule model and writeswicked-garden run scripts/domain/extract_loop.py --worklist .wicked/domain/worklist.json \ --rules-out .wicked/domain/rules.json --time-budget 480.wicked/domain/rules.json. If it says the budget was reached, run the same command again while your turns allow — it resumes after the units already stated. - Exit 2, "no rule model in this seat": state the rules yourself. For each unit of the
worklist, in order, add one entry to
.wicked/domain/rules.json— the whole file is{"schema": "wicked-garden/domain-rules@1", "seat": "<a plain token: $WICKED_RUN_AGENT, or claude / codex / pi / copilot>", "rules": [...]}and each entry is exactly{"symbol_id": "<the unit's id, verbatim>", "statement": "<the business rule, or \"\" when the source does not let you state one>", "confidence": <0..1>, "provenance": {"source": "<module>", "ref": "<the symbol_id>", "source_kinds": ["code-body"|"type-def"|"comment"|"doc"]}}, plus"code_meets": false, "mismatch": "<one line>"only when the code does not meet the requirement — no other keys. Then check it:wicked-garden run scripts/domain/extract_loop.py --check-rules .wicked/domain/rules.json --worklist .wicked/domain/worklist.jsonand fix what it names. Read each unit's source and write each statement yourself. Create and change the file with your file write and edit tools, never with an inline interpreter (python3 - <<…,node -e …): the seat's input governance refuses that. A script that composes statements from names or slices is wrong anyway: it describes code, and the page's review fails it. State what the business requires (who may do what, what must hold, what is refused and why, what a caller must supply, what a result must carry), not what the function does. Most product code encodes a rule: state it. A check, a refusal, a limit, a default, an ordering, a permission or a state change is a rule even when it is small. An interface or type is a rule only when the type itself encodes a constraint the business relies on (a closed set of values, a limit, a required field whose comment says what it means); a plain list of fields describes code, so leave it empty. Leave a statement empty for pure plumbing too (a re-export, a trivial getter, a pass-through wrapper, formatting), never because the rule is small or obvious: the page's review lists an empty statement whose source shows a rule as a missed rule, and fails a page that leaves most of the units whose source shows a rule empty, or whose statements mostly describe code (a page of mostly plain types and plumbing, left empty, is fine). A restated shape is never a rule at any confidence: leave it empty. A unit markedchanged_since_buildwas mapped before: itsprior_statement(and any old mismatch) may be out of date, so state it, and judgecode_meets, against the code as it is now. Only a statement the host resolves replaces its rule; an empty, invalid or low-confidence one keeps the earlier rule (never a placeholder). Set each confidence by how directly the source supports the rule: a constraint visible in the unit's full definition (enforced in its body, or encoded in its type: a closed set, a limit, a documented required field) is high (0.85 or more); a rule only guessed from a name, a comment alone or a cut-off slice is low, and the host records it as a placeholder. Judge each statement's confidence on its own; never stamp one value on the whole page (equal values are fine where the support is equal). Only real requirements count toward the target; a placeholder is shown, never counted. When the code is wrong, state the requirement anyway. State what the unit is meant to do (its doc comment, its tests, its name and callers agree), with your confidence in that requirement, and add"code_meets": falseand a one-line"mismatch"saying how the code departs (e.g. "the loop starts at index 1, so the first element is skipped"), but only when a doc comment, a test or a caller shows the intended requirement; a unit whose intent is unclear still gets an empty statement and no mismatch. A unit whose intent is shown that way and whose own code is right, but whose result is wrong because a callee it relies on departs, inherits that mismatch: mark it"code_meets": falsetoo, with a mismatch naming the callee (e.g. "inherits sum's skipped first element, so the numerator omits the first element"): say how the code departs, not which way the result is off, which can depend on the input. Never restate the bug as the requirement, and never lower the confidence because the code is wrong: the requirement counts, and the mismatch is shown beside it as a finding. - Report how many units you stated. Write no other file, and never try to reach the store.
The host refuses anything outside the schema, and any entry whose symbol the store does not
report unmapped or as a placeholder (or that the run's own host-side record does not list as
changed since the map was built: the worklist's mark is framing, not permission), or whose
file the repository does not track; it re-judges the rest itself
and writes it as
extract-loop(the seat a file names is reported, never trusted).
Outside a run: you DRIVE the deterministic harness — you don't loop yourself
A single agent (max-turns 12) cannot iterate thousands of nodes. Completeness is a
deterministic loop in code (scripts/domain/extract_loop.py); you are its
driver, not the loop. With wicked-core, wicked-estate and a writable store at hand
(no worklist file in your working directory), your whole job:
- Run the harness (one
Bashcall):
It seeds its worklist fromwicked-garden run scripts/domain/extract_loop.py --db "<estate-store>" --time-budget 780wicked-core coverage's ownunaccounted_nodes— the SAME authority the coverage gate re-derives against, so there is no denominator drift — and takes it hub-first: the most central symbols (estate's PageRank,wicked-estate rank) first, then their neighbours and onward by graph distance, so the load-bearing behaviour is mapped first. It loops every behavior-bearing node, calls the bounded per-node model for the one thing code can't do (stating the rule), validates each returned rule, and writesannotate+semantics. Every node terminates RESOLVED-or-RISK (the RISK-floor invariant), so given enough passes every behaviour is accounted for. Only RESOLVED ones are real requirements; a RISK one is a placeholder, which the minimum never counts. - Watch stderr (
coverage=… unaccounted=… processed=…;coveragethere is the accounted share, placeholders included). If it exits within budget withunaccounted > 0, re-invoke it to resume — the shrunk worklist re-seeds and the hub-first order is re-derived, so work resumes at the frontier and never repeats (a later run continues the same way). The graph is built once real requirements reach the configured minimum (the repository's own, elseWICKED_REQUIREMENTS_MIN_COVERAGE_PCT, default 80) — check it withwicked-core coverage --db "<estate-store>" --min-coverage-pct(exit 0 at or above it; below, it prints "N% real requirements, minimum M% (R of B behaviours; P placeholders, U unmapped)" and exits 3). Keep re-invoking whileunaccountedshrinks; once the check passes, more is better but enough, so stop when your budget is spent. Always stop whenunaccountedhits 0 or stops shrinking. This mode maps unmapped behaviours only: it never revisits a placeholder, so a share held below the minimum by placeholders needs a crewdomain-extractionrun, whose pages frame them again. What you mapped stays in the store for the next run either way. AWARNING: … annotation node_syms no longer existline is the estate id-scheme migration signature — prior annotations are orphaned; see the migration section inwicked-garden-domainfor the required re-run order. - Never hand-annotate or assert a rule the harness RISK-flagged. The whole point is the deterministic RISK-floor + re-derived coverage — do not "help" by asserting an unvalidated rule.
Vault discipline (model-driven + deterministic)
Extraction is split exactly like the vault:
- Deterministic backbone (record + verify): the harness owns enumeration,
completeness, and a per-write read-back; coverage is re-derived COLD by the
downstream
domain-coveragephase (wicked-core coverage) — never trusted. - Model adjunct (analyze): the per-node rule statement is the ONE model call.
Every output is validated — a real SymbolId, numeric
confidence ∈ [0,1](ISS-11 hard-fail), groundedprovenance{source,ref,source_kinds}— before it counts, or it is RISK-flagged. Model-driven where judgment is needed; deterministic everywhere.
Config
WICKED_ESTATE_BIN/WICKED_CORE_BIN— the peer binaries (resolved by_clients; on a crew hostWICKED_CORE_EXE, the engine's own CLI, is used whenWICKED_CORE_BINis unset).WICKED_RULE_MODEL_BIN— the bounded per-node rule model (defaultclaude -p). Set-but-empty is the kill-switch: no model, so only--dry-run(the deterministic stub) runs; file mode without--dry-runthen exits 2 and you state the rules yourself.
Hard invariants (fail-closed — enforced by the harness + validator)
- Every requirement has
business_ruleswith minItems 1. - Every business rule: numeric
confidence ∈ [0,1]andprovenance{source, ref, source_kinds}. legacy_components[]is non-null, never dropped — the SymbolIds the requirement covers.disposition ∈ {keep, modify, drop, new}; adropneeds adisposition_reason.- Rule ids:
RULE-/VAL-/ERR-+ 3–6 zero-padded digits, unique within a requirement. - Facts REFERENCE SymbolIds; never embed code/file/line.
metadata.schema_version ∈ {"1.0.0", "1.1.0"}(1.1.0 adds the optional coverage and corroboration fields core emits).
Depth
- the
wicked-garden-domainskill'srefs/domain-model-emit.md— field map + the 7 invariants. - the
wicked-garden-domainskill'srefs/extraction-flow.md— the estate/core CLI surface + the_clients.pyseam.
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.

