feat: doctrine stack, agent profiles, and mission template repository (specs 046-058)#348
Conversation
|
PR #348 is the continuation of #305 after rebasing onto the newer What from #305 is applied in #3481. Architectural boundary correctionThe most important actionable review item on #305 was the doctrine boundary: That is now materially addressed in this branch:
This is the main architectural improvement over #305: the doctrine work is no 2. Constitution as pass-through / local routerThe branch also moves closer to the intended constitution role as the
That is the important alignment point: constitution is becoming the local 3. Doctrine asset expansion and repository encapsulationThe PR still carries forward the core #305 and mission 058 asset work:
This also preserves the March 26-27 review direction: doctrine owns the shipped 4. CI and verification improvementsThe #305 concern that doctrine work was not properly exercised in CI is also
This is a meaningful improvement over #305 because the new package boundaries 5. Mission type vs mission run splitThe rename work is also more explicit in #348, and this is the practical
This is a useful clarification over older What from #305 is still relevantTwo architectural comments from #305 remain valid follow-on guidance rather
There is also still constitution-routing work left beyond the current mission Issue #241 is also not "fully done everywhere" yet. The conceptual split is the Open tasks this PR does not pretend to close
Net assessment#348 should be read as:
So the important #305 review comments were not ignored. The concrete ones were |
6375aa8 to
9951989
Compare
Add the kernel peer package — zero-dependency shared utilities used by constitution, doctrine, and specify_cli. Modules: - kernel.paths: package asset root resolution and kittify home discovery - kernel.atomic: atomic file write helper - kernel.glossary_types: canonical glossary data types and enums - kernel.glossary_runner: protocol for glossary-aware primitive runners Part of mission 057 (doctrine stack and agent profile infrastructure). Co-authored-by: Copilot <[email protected]>
Add the doctrine and constitution peer packages with full governance infrastructure for agent-driven workflows. Doctrine additions: - agent_profiles/: agent profile definitions, repository, validation, and weighted matching (DDR-011) - mission_step_contracts/: structured step contracts for mission workflows - curation/: doctrine artifact curation pipeline - Shipped YAML artifacts: directives, tactics, paradigms, styleguides, toolguides, procedures (~50 files) - Schema definitions for all artifact types - Updated skill references for git-workflow, mission-system, orchestrator-api, runtime-next, runtime-review, setup-doctor Constitution package (new peer package): - Compiler, extractor, generator for constitution documents - Interview system for guided constitution creation - Reference resolver with transitive doctrine resolution - Schema validation (Pydantic models) - Sync system for detecting stale governance artifacts - Template resolver bridging to MissionTemplateRepository Both packages depend on kernel (commit 1). Constitution additionally depends on doctrine for artifact resolution and reference traversal. Part of mission 057 (doctrine stack and agent profile infrastructure). Co-authored-by: Copilot <[email protected]>
Add doctrine initialization during project setup and agent profile suggestion infrastructure for work packages. Init-time doctrine: - _run_doctrine_stack_init(): interactive or default constitution setup - _apply_doctrine_defaults(): generate constitution from shipped defaults - _run_inline_interview(): guided interactive constitution creation - _maybe_generate_structure_templates(): REPO_MAP.md and SURFACES.md Profile infrastructure: - task_profile.py: suggest agent profiles based on WP task types (ROLE_TO_PROFILE mapping, display helpers) - m_2_2_0_profile_context_deployment.py: migration for profile context Tests: - test_init_doctrine.py: init-time doctrine integration tests - test_profile_context_migration.py: migration tests - test_task_profile_suggestion.py: profile suggestion tests Part of mission 057 (WP07-WP09). Co-authored-by: Copilot <[email protected]>
Resolves the namespace collision identified in Priivacy-ai#241: the "mission" subcommand (which lists available mission types like software-dev, research) is renamed to "mission-type", freeing the "mission" namespace for the upcoming feature→mission-run terminology rename. Changes: - Rename cli/commands/mission.py → cli/commands/mission_type.py - Update subcommand registration: name="mission" → name="mission-type" - Update help text: "per-feature" → "per mission run" Co-authored-by: Copilot <[email protected]>
Complete the terminology unification across the codebase per issue Priivacy-ai#241: - "mission type" = abstract workflow methodology (software-dev, research) - "mission run" = concrete work item (was "feature") CLI-facing changes: - --feature flag → --mission-run across all commands - "agent feature" subcommand → "agent mission-run" - Help text updated to use "mission run" terminology Internal code changes (266 files): - feature_slug → mission_slug, feature_dir → mission_dir - feature_metadata.py → mission_metadata.py - upgrade/feature_meta.py → upgrade/mission_meta.py - dashboard/handlers/features.py → dashboard/handlers/missions.py - cli/commands/agent/feature.py → cli/commands/agent/mission_run.py - core/feature_detection.py → core/mission_detection.py (restored) New modules added from feature branch: - identity.py (structured 4-part agent identity) - cli/commands/_flag_utils.py (mission-type flag resolver) - cli/commands/agent/profile.py (agent profile management) - core/tool_config.py (renamed from agent_config) Co-authored-by: Copilot <[email protected]>
Replace the full implementation in specify_cli/runtime/home.py with a thin re-export shim that delegates to kernel.paths. This makes the 5-tier template resolver PACKAGE tier automatically point to doctrine/missions/ instead of specify_cli/missions/. The resolver chain is now: resolver.py → home.get_package_asset_root() → kernel.paths → doctrine/missions/ No call sites need to change — the shim preserves all existing imports. Co-authored-by: Copilot <[email protected]>
Wire remaining integration points from the feature branch: CI workflows: - ci-quality.yml: add kernel-tests job (90% coverage floor), expand coverage to constitution/doctrine/kernel packages, add contextive checks for constitution sources, mypy scans doctrine+constitution - release-readiness.yml: Python 3.11 → 3.12 - release.yml: Python 3.11 → 3.12 pyproject.toml: - Add python-ulid, chardet, pytestarch dependencies - Add kernel + constitution to wheel packages - Switch to explicit artifact file-type globs (md/yaml/json/csv) - Fix stale mypy overrides (feature→mission_run, legacy_bridge removed) - Add kernel/constitution to mutmut also_copy - spec-kitty-runtime via git URL New source modules: - __main__.py: python -m specify_cli entry point - doctrine.py: CLI adapter for doctrine curation workflow - m_2_0_1: tool config key rename migration - m_2_0_2: constitution context bootstrap migration Test suite additions (24 files): - Profile CLI, init, interview tests - Doctrine reconstruction e2e - Feature detection, tool config tests - Mission flag rename, bare feature flag tests - Identity parsing, frontmatter agent tests - Workflow profile injection, constitution context - Dual-write integration, structured identity e2e Skipped 5 test files that test deleted modules (legacy_bridge, forecast, status_resolver) — consistent with prior decision. Co-authored-by: Copilot <[email protected]>
…ent docs Add mission planning artifacts from the feature branch: Mission specs: - 045-agent-profile-system (spec, plan, tasks, 11 WPs) - 046-doctrine-artifact-domain-models (spec, plan, tasks, 11 WPs) - 048-structured-agent-identity-and-constitution-profile-integration (spec, plan, tasks, contracts, 8 WPs) - 054-constitution-interview-compiler-and-bootstrap (spec, plan, tasks, contracts, 12 WPs) - 057-doctrine-stack-init-and-profile-integration (spec, plan, tasks, 9 WPs) - 058-mission-template-repository-refactor (spec, plan, tasks, contracts, 11 WPs) Architecture: - ADR: glossary type ownership (2026-03-25-1) - ADR: pytestarch architectural dependency testing (2026-03-27-1) - Initiative: doctrine execution integration - Initiative: 054 postmortem Development docs: - Code review, constitution path resolution, doctrine migration - Model-first schema generation, PR305 review plans - Ad-hoc specialist session how-to Supporting files: - generate_schemas.py script - .kittify memory and curation state Co-authored-by: Copilot <[email protected]>
Replace 21 bare `except Exception` handlers across src/doctrine/ with specific exception tuples matching actual failure modes: - YAML loading loops: (YAMLError, ValidationError, OSError) - importlib.resources fallback: (ModuleNotFoundError, TypeError) - Config file loading: (OSError, UnicodeDecodeError, YAMLError) Addresses PR Priivacy-ai#305 review finding M1. Co-Authored-By: Claude Opus 4.6 <[email protected]>
workflow.py and tasks.py use Optional[str] in Typer-annotated function parameters but only imported Annotated from typing. With `from __future__ import annotations`, Typer eval()s annotation strings at app construction time, causing NameError on `spec-kitty --help`. Co-Authored-By: Claude Opus 4.6 <[email protected]>
The {SCRIPT} placeholder required a scripts: frontmatter key that no
template provided, causing render failures during upgrade for analyze
and checklist (prompt-driven commands). Replace all 6 occurrences with
the actual spec-kitty agent mission-run commands, matching how main
branch hardcodes spec-kitty agent feature check-prerequisites.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
b668f0e to
80c7a23
Compare
Summary
Supersedes #305 — rebased, exception-hardened, extended with mission 057+058.
src/doctrine/): 8 artifact types with consistent repository pattern,DoctrineServicefacade, Pydantic v2 frozen models,ArtifactKindStrEnumConstitutionInterview,compile_constitution(),MissionStepContractdomain modelTemplateResult,ConfigResult), 5-tier resolver integration,ProjectPathscentralization--featureflagsChanges since #305
except Exceptionhandlers insrc/doctrine/narrowed to specific exception tuples (M1 from feat: doctrine artifact domain models, agent profiles, and constitution bootstrap (specs 046, 048, 054) #305 review)doctrineno longer importsspecify_cli(glossary imports moved tokernel.*)--cov=src/doctrineacross all test suitesTest plan
pytest tests/doctrine/ --timeout=30— 1110 passedruff check src/doctrine/ src/constitution/— cleangrep -r "except Exception" src/doctrine/ --include="*.py"— zero resultspytest -m fast --timeout=30— full fast suite passes🤖 Generated with Claude Code