diff --git a/AGENTS.md b/AGENTS.md index cb0c1a9..eed0593 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -7,9 +7,9 @@ its domain-agnostic processing, CLI, and glossary format. Keep D&D recipe decisi here and general capabilities in Audita. Link upstream contracts rather than copying their reference documentation. -The production/testing input contract, exact stages, and profile selections are -still being discussed. Do not treat illustrative fixtures as accepted recipe -contracts. Testing means a cheaper, shorter development run. +README.md owns the accepted production/testing contracts. Both overlays use the +full stage sequence; testing selects a cheaper model for development. Preserve +the shared input roles and native profile inheritance when changing recipes. Keep changes proportionate. Use native Audita, ConfigKit, and PromptKit behavior; do not add a local loader or merge system. Do not introduce extra requirements @@ -17,9 +17,9 @@ or guarantees without an agreed need. Keep real session data, personal settings, and credentials in ignored local files. Use synthetic committed fixtures. Validate configuration changes with scripts/check.sh and a compatible Audita -binary. It checks configuration and normalization without calling a model; it -does not establish recipe quality or model readiness. Add behavioral checks as -recipes land, avoiding assertions about incidental prompt wording. +binary and Python 3. It checks effective recipe contracts and normalization +without calling a model; it does not establish recipe quality or model readiness. +Keep checks behavioral, avoiding assertions about incidental prompt wording. Keep commits scoped to this repository and review staged changes before committing. Commit completed, validated work locally by default. Do not push or publish without diff --git a/README.md b/README.md index d513874..3fd5f0b 100644 --- a/README.md +++ b/README.md @@ -1,81 +1,130 @@ # audita-pipelines-dnd D&D processing recipes for [Audita](https://forge.maximumdirect.net/eric/audita). -Audita provides domain-agnostic transcript processing; this repository owns the -D&D overlays and the public input contracts followed by Narratio and other callers. +This repository owns the overlays and their public recipe contracts. Audita owns +its domain-agnostic processing, configuration, CLI, and glossary format. -## Status +## Requirements and recipes -Development scaffolding is available. The planned overlays are -`overlays/dnd-production.yml` and `overlays/dnd-testing.yml`; they have not yet been -implemented. Production will be the normal polishing recipe. Testing will be a -cheaper, shorter development run. Glossary roles, stage sequences, and model-profile -requirements remain open. There is no released recipe contract yet. +Use an Audita build containing runtime glossary inputs and collection instructions. +These recipes were checked against Audita source commit +[`33d9e04`](https://forge.maximumdirect.net/eric/audita/src/commit/33d9e0428d95e9f391441d0349f266552d2a9861). +The published v4.1.0 release predates `--glossary-file`; a release including this +feature has not yet been selected. Recipe revisions can be selected independently +of Audita releases; callers such as Narratio can pin a recipe tag or commit. -As the overlays land, this README will define their supported Audita versions, -logical glossary roles, required/default inputs, profile requirements, and -installation and invocation. Both should accept the same prepared input dataset -where practical. Recipe revisions can be selected independently of Audita releases. +| Overlay/profile | Inherited bundled profile | Reasoning effort | Intended use | +| --- | --- | --- | --- | +| `dnd-production` | `gpt-terra-latest` | `low` | Normal transcript polishing | +| `dnd-testing` | `gpt-luna-latest` | `medium` | Lower-cost development | -Audita's planned `--glossary-file` interface is not implemented in the current -v4.1 baseline. Existing configured glossary collections work in the meantime. +Both overlays run the full sequence: glossary, homophones, glossary, spoken_word, +grammar. Testing changes model selection and retains ordinary validation. Cost, +turnaround, and editorial quality depend on the input, model and provider; the +recipes promise no fixed cost, duration, or equivalent quality. Initial sequencing +can be revised based on observed results, keeping testing aligned with production. + +The overlays define native PromptKit profile aliases and inherit backend/model +settings from Audita's bundled OpenRouter catalog. Operators supply the usual +OpenRouter credential or customize native profiles/backends for their deployment. +Validation and correction repair keep Audita's normal proposal-profile fallback +unless the operator configures their own role profiles. Protection likewise uses +Audita's existing defaults unless explicitly configured by the operator. See Audita's [configuration reference](https://forge.maximumdirect.net/eric/audita/src/branch/main/docs/config.md) and [CLI reference](https://forge.maximumdirect.net/eric/audita/src/branch/main/docs/cli.md) -for native formats and implemented behavior. +for application integration, and the +[PromptKit format reference](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md) +for native profile and backend behavior. + +## Input contract + +Both overlays select these four logical collections at the root: + +| Collection | Content | +| --- | --- | +| `party` | Player characters and aliases | +| `campaign` | Campaign-specific entities and terminology | +| `setting` | Reusable world vocabulary | +| `spells` | Spell vocabulary | + +Their empty entry defaults preserve configured vocabulary through native +composition. Each collection may be empty, but glossary stages require at least +one entry across the selected collections. Extra collections are permitted and +can be selected through operator configuration. The overlays supply short +collection instructions describing these roles. + +Roles are independent of filenames. Operators may configure reusable references +beside the selected main configuration while Narratio supplies prepared session +collections, or callers may supply every collection at runtime. Both overlays +accept the same prepared dataset. Narratio owns projections such as converting +its party roster into native glossary entries; it selects an operator configuration +and overlay instead of generating the processing sequence. + +The synthetic [session input](examples/development/session-glossaries.yml) supplies +`party` and `campaign`; the companion [reference file](examples/development/glossary.yml) +supplies `setting` and `spells`. Follow Audita's +[input contract](https://forge.maximumdirect.net/eric/audita/src/branch/main/docs/integrations/transcript-glossary-files.md) +for the wrapperless format and its configuration reference for replacement, +inheritance, and collection-instruction behavior. + +## Install and invoke + +Copy `overlays/dnd-production.yml` and `overlays/dnd-testing.yml` into the +`overlays/` directory beside the operator's selected Audita main configuration. +No installer, submodule, Go workspace, or custom loader is required. Keep the +operator's existing main configuration and companions; supply prepared inputs +using the supported runtime interface: + +```sh +audita config validate --scope app --config /path/to/audita.yml \ + --overlay dnd-testing --glossary-file /path/to/session-glossaries.yml + +audita process --config /path/to/audita.yml --overlay dnd-testing \ + --glossary-file /path/to/session-glossaries.yml \ + --output /path/to/polished.json /path/to/transcript.json +``` + +Use `dnd-production` for the production recipe. Configuration validation does not +contact a model or establish processing readiness; `process` additionally checks +usable glossary selections and processing profiles. Configured secrets bootstrap +can run during either command. ## Develop alongside Audita -A convenient checkout layout is: - -```text -Workspace/ - audita/ - audita-pipelines-dnd/ -``` - -Build from the Audita checkout: +A sibling checkout is convenient. From the Audita checkout, build the current +source with its documented Go toolchain: ```sh -cd ../audita go build -o ./bin/audita ./cmd/audita ``` -From this repository, run the offline development checks: +From this repository, run the offline checks with Python 3 available: ```sh ./scripts/check.sh ../audita/bin/audita ``` -The script also accepts `AUDITA_BIN`, or defaults to `audita` on PATH. The sibling -layout is a convenience, not a dependency. Checks validate the synthetic main -configuration and any implemented overlays, then process a tiny transcript with -normalization only. They make no model calls and do not establish model readiness -or editorial quality. The fixture's empty stage list is for this check only; it -does not define either D&D pipeline. +The script also accepts `AUDITA_BIN`, or defaults to `audita` on PATH. It validates +both overlays and their effective stage selections, inherited profiles, empty +defaults, configured references, runtime inputs, and operator role/protection +choices. It also runs normalization with an empty pipeline. Checks use synthetic +inputs and make no model calls; they do not establish editorial quality or provider +availability. -For personal development, copy the fixture to a main file at the repository root: +For a new local setup, copy the development main and references beside the overlays: ```sh cp examples/development/config.yml audita.local.yml +cp examples/development/glossary.yml glossary.yml +mkdir -p .local +../audita/bin/audita process --config audita.local.yml --overlay dnd-testing \ + --glossary-file examples/development/session-glossaries.yml \ + --output .local/polished.json examples/development/transcript.json ``` -`audita.local.yml` is ignored. Edit it to configure your processing pipeline and -profiles. Root `prompts.yml`, `prompts/`, `glossary.yml`, and `glossary/` are also -ignored for personal companions, and `.local/` is available for private inputs, -credentials, and outputs. Keep real session material out of committed examples. - -Once implemented, overlays in this repository's root `overlays/` directory will -be discovered beside that main file. A target invocation is: - -```sh -../audita/bin/audita process --config audita.local.yml \ - --overlay dnd-testing --output .local/polished.json .local/transcript.json -``` - -This command is for the future overlay, and requires configured profiles and -usable glossary inputs. For deployment, copy the chosen overlay files into the -`overlays/` directory beside the deployment's main Audita configuration. No -submodule, Go workspace, or custom overlay installer is required. +Processing requires configured credentials. Local main files, root glossary/prompt +companions, `.local/`, and environment files are ignored. Keep real session data +and credentials there; committed examples must remain synthetic. ## License diff --git a/examples/development/glossary.yml b/examples/development/glossary.yml new file mode 100644 index 0000000..a4bf84f --- /dev/null +++ b/examples/development/glossary.yml @@ -0,0 +1,7 @@ +# Synthetic reusable reference collections, loaded as a main-relative companion. +setting: + entries: + - {id: bridge, name: Old Stone Bridge, category: place} +spells: + entries: + - {id: light, name: Light, category: spell} diff --git a/examples/development/session-glossaries.yml b/examples/development/session-glossaries.yml new file mode 100644 index 0000000..434efa4 --- /dev/null +++ b/examples/development/session-glossaries.yml @@ -0,0 +1,10 @@ +# Synthetic prepared session inputs; reference collections can remain configured. +party: + entries: + - id: mira + name: Mira Brightwater + category: character + aliases: [Mira] +campaign: + entries: + - {id: lantern-guild, name: Lantern Guild, category: organization} diff --git a/overlays/.gitkeep b/overlays/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/overlays/dnd-production.yml b/overlays/dnd-production.yml new file mode 100644 index 0000000..49927cf --- /dev/null +++ b/overlays/dnd-production.yml @@ -0,0 +1,28 @@ +glossaries: [party, campaign, setting, spells] +glossary_collections: + party: + instruction: Player character names and aliases from this campaign. + entries: [] + campaign: + instruction: Campaign-specific people, places, organizations, and terminology. + entries: [] + setting: + instruction: Reference vocabulary for the campaign's world and setting. + entries: [] + spells: + instruction: Spell names that may occur in the transcript. + entries: [] +pipeline: + stages: + - module: glossary + - module: homophones + - module: glossary + - module: spoken_word + - module: grammar +llm: + proposal_profile: dnd-production +promptkit: + profiles: + - id: dnd-production + extends: {id: gpt-terra-latest} + reasoning_effort: low diff --git a/overlays/dnd-testing.yml b/overlays/dnd-testing.yml new file mode 100644 index 0000000..9dd0682 --- /dev/null +++ b/overlays/dnd-testing.yml @@ -0,0 +1,28 @@ +glossaries: [party, campaign, setting, spells] +glossary_collections: + party: + instruction: Player character names and aliases from this campaign. + entries: [] + campaign: + instruction: Campaign-specific people, places, organizations, and terminology. + entries: [] + setting: + instruction: Reference vocabulary for the campaign's world and setting. + entries: [] + spells: + instruction: Spell names that may occur in the transcript. + entries: [] +pipeline: + stages: + - module: glossary + - module: homophones + - module: glossary + - module: spoken_word + - module: grammar +llm: + proposal_profile: dnd-testing +promptkit: + profiles: + - id: dnd-testing + extends: {id: gpt-luna-latest} + reasoning_effort: medium diff --git a/scripts/check-recipes.py b/scripts/check-recipes.py new file mode 100644 index 0000000..678a94e --- /dev/null +++ b/scripts/check-recipes.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +"""Check effective recipe contracts through Audita; no inference calls.""" + +import json +from pathlib import Path +import shutil +import subprocess +import sys +import tempfile + + +audita, main, session = sys.argv[1:] +roles = ["party", "campaign", "setting", "spells"] +stages = ["glossary", "homophones", "glossary", "spoken_word", "grammar"] + + +def effective(recipe, config=main, glossary=None): + args = [audita, "config", "show", "--scope=app", "--format=json", + "--config", str(config), "--overlay", recipe] + if glossary: + args += ["--glossary-file", str(glossary)] + return json.loads(subprocess.check_output(args, text=True)) + + +for recipe, parent, effort in [ + ("dnd-production", "gpt-terra-latest", "low"), + ("dnd-testing", "gpt-luna-latest", "medium"), +]: + configured = effective(recipe) + assert configured["glossaries"] == roles + assert configured["protected_terms"] == roles + assert [s["module"] for s in configured["pipeline"]["stages"]] == stages + for stage in configured["pipeline"]["stages"]: + assert stage["glossaries"] == roles + for role in ["proposal_profile", "validation_profile", "correction_repair_profile"]: + assert stage["llm"][role] == recipe + profiles = {p["id"]: p for p in configured["promptkit"]["profiles"]} + assert profiles[recipe]["model"] == profiles[parent]["model"] + assert profiles[recipe]["backend"] == profiles[parent]["backend"] + assert profiles[recipe]["reasoning_effort"] == effort + collections = configured["glossary_collections"] + assert collections["party"]["entries"] == [] + assert collections["campaign"]["entries"] == [] + assert collections["setting"]["entries"][0]["name"] == "Old Stone Bridge" + assert collections["spells"]["entries"][0]["name"] == "Light" + + supplied = effective(recipe, glossary=session) + assert supplied["glossary_collections"]["party"]["entries"][0]["name"] == "Mira Brightwater" + assert supplied["glossary_collections"]["campaign"]["entries"][0]["name"] == "Lantern Guild" + for role in ["setting", "spells"]: + assert supplied["glossary_collections"][role] == collections[role] + + # Exercise a caller supplying every role, and operator role/protection choices. + # Give the isolated main its own native overlay context, without companions. + with tempfile.TemporaryDirectory(dir=Path(main).parent) as temp: + shutil.copytree(Path(main).parent / "overlays", Path(temp) / "overlays") + complete = Path(temp) / "all-glossaries.yml" + complete.write_text(json.dumps(supplied["glossary_collections"])) + alternate = Path(temp) / "config.yml" + alternate.write_text(json.dumps({"version": 3})) + empty_run = subprocess.run([ + audita, "process", "--config", str(alternate), "--overlay", recipe, + "--output", str(Path(temp) / "unused.json"), + str(Path(session).with_name("transcript.json")), + ], capture_output=True, text=True) + assert empty_run.returncode == 2 and "no glossary entries" in empty_run.stderr, empty_run.stderr + assert not (Path(temp) / "unused.json").exists() + all_supplied = effective(recipe, config=alternate, glossary=complete) + for role in roles: + assert all_supplied["glossary_collections"][role] == supplied["glossary_collections"][role] + alternate.write_text(json.dumps({ + "version": 3, + "protected_terms": ["setting"], + "llm": {"validation_profile": "reviewer", "correction_repair_profile": "repairer"}, + })) + customized = effective(recipe, config=alternate, glossary=session) + for stage in customized["pipeline"]["stages"]: + assert stage["protected_terms"] == ["setting"] + assert stage["llm"]["validation_profile"] == "reviewer" + assert stage["llm"]["correction_repair_profile"] == "repairer" + +print("Recipe composition, profile inheritance, and operator overrides passed.") diff --git a/scripts/check.sh b/scripts/check.sh index ae94ff7..d5fae92 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -14,6 +14,7 @@ check_dir=$(mktemp -d) trap 'rm -rf "$check_dir"' EXIT trap 'exit 1' HUP INT TERM cp "$fixture" "$check_dir/config.yml" +cp "$repo_dir/examples/development/glossary.yml" "$check_dir/glossary.yml" mkdir "$check_dir/overlays" for overlay in "$repo_dir"/overlays/*.yml; do [ -f "$overlay" ] || continue @@ -22,6 +23,9 @@ for overlay in "$repo_dir"/overlays/*.yml; do "$audita_bin" config validate --config "$check_dir/config.yml" --overlay "$overlay_name" done +python3 "$repo_dir/scripts/check-recipes.py" "$audita_bin" "$check_dir/config.yml" \ + "$repo_dir/examples/development/session-glossaries.yml" + "$audita_bin" process --config "$fixture" \ --output "$check_dir/normalized.json" \ "$repo_dir/examples/development/transcript.json"