Skip to content

Atomic-skill refactor + Papyrus memory integration#7

Merged
patdhlk merged 10 commits intomainfrom
refactor/atomic-skills
Apr 20, 2026
Merged

Atomic-skill refactor + Papyrus memory integration#7
patdhlk merged 10 commits intomainfrom
refactor/atomic-skills

Conversation

@bburda
Copy link
Copy Markdown
Contributor

@bburda bburda commented Apr 19, 2026

Summary

Refactor of Pharaoh into atomic single-artefact skills, retirement of the legacy pharaoh-author / pharaoh-verify composite skills, and first-class Papyrus memory integration (semantic retrieval + shared write primitive).

What this adds

  • Atomic authoring primitives: pharaoh-req-{draft,review,regenerate}, pharaoh-arch-{draft,review}, pharaoh-vplan-{draft,review}, pharaoh-fmea — each produces or audits a single artefact against one axis.
  • Memory primitives: pharaoh-context-gather (read via Papyrus semantic recall over all-MiniLM-L6-v2 embeddings), pharaoh-decision-record and pharaoh-finding-record (atomic write with (type, canonical_name) dedup key).
  • Orchestrators: pharaoh-flow chains req→arch→vplan→fmea with per-step reviews; pharaoh-audit-fanout fans out parallel auditors over disjoint artefact ranges; pharaoh-reqs-from-module fans out parallel reverse-engineering subagents over source files.
  • Project-tailoring layer: pharaoh-tailor-{detect,fill,review} plus JSON schemas for .pharaoh/project/ (artefact-catalog, id-conventions, checklists, workflows) — per-project content lives here; domain skills stay generic.
  • Process-audit suite: pharaoh-lifecycle-check, pharaoh-standard-conformance, pharaoh-coverage-gap, pharaoh-process-audit — cross-cutting gap / conformance audits over an existing corpus.
  • Score tailoring pilot: examples/score/.pharaoh/project/ exercises the primitives against a realistic safety-critical layout.
  • Retirement: pharaoh-author and pharaoh-verify removed; cross-references across remaining skills updated; README / CONTRIBUTING / CHANGELOG refreshed for the atomic architecture.

Design notes

  • Every atomic skill satisfies: (a) indivisible; (b) strict typed input/output contract; (c) execution-based reward where the check is deterministic (schema conformance, dedup correctness); (d) reusable across flows; (e) non-interfering with other skills.
  • Papyrus integration assumes the papyrus[semantic] extra is available for pharaoh-context-gather's semantic recall; without it the skill returns [] gracefully (non-blocking for downstream drafts).
  • pharaoh-req-from-code explicitly calls pharaoh-context-gather before naming any type in an emitted requirement, so parallel subagents can reuse canonical vocabulary via the shared workspace instead of re-coining synonyms.
  • Dedup keys across write primitives are case-preserving and artefact-type-aware to avoid cross-type collisions.

Commit layout

8 commits grouped by logical area (core authoring primitives → tailoring → process-audit → pharaoh-flow → retirement of legacy skills → memory retrieval → parallel review → parallel reverse-engineering). Each commit is self-contained and can be reviewed independently.

Test plan

  • Downstream skill invocations on projects that consume pharaoh-author continue to work after retirement (cross-reference check)
  • pharaoh-context-gather against a workspace without the [semantic] extra returns [] without crashing
  • pharaoh-context-gather against a freshly papyrus init-ed (empty) workspace returns []
  • pharaoh-reqs-from-module on a small module with shared Papyrus completes without concurrent-write errors
  • pharaoh-tailor-review passes schema validation on examples/score/.pharaoh/project/
  • Skill-structure/cross-reference tests (in-repo) still pass

bburda added 8 commits April 19, 2026 18:41
Atomic refactor of authoring workflow into single-artefact primitives:

  * pharaoh-req-draft / pharaoh-req-review / pharaoh-req-regenerate
    ISO 26262 Part 6 §7 single-requirement authoring + per-axis
    review + targeted regeneration from review findings.
  * pharaoh-arch-draft / pharaoh-arch-review
    Single architecture element from a parent requirement, with
    per-axis audit.
  * pharaoh-vplan-draft / pharaoh-vplan-review
    Single test-case from a parent requirement, with per-axis audit.
  * pharaoh-fmea
    Single failure-mode entry scored on severity/occurrence/detection.

Each primitive is indivisible, has a strict input/output contract,
execution-based reward where possible, reusable across flows, and
non-interfering.

Companion: hand-authored Score tailoring pilot
(examples/score/.pharaoh/project/{artefact-catalog,id-conventions,
workflows,checklists}) exercises the primitives against a realistic
safety-critical project layout.
Project-tailoring layer: per-project content lives under
.pharaoh/project/ (not in domain skills, which stay generic).

  * pharaoh-tailor-detect  — inspect project, report detected conventions
  * pharaoh-tailor-fill    — author .pharaoh/project/ from detected conventions
  * pharaoh-tailor-review  — schema + cross-file consistency audit

Companion JSON schemas in examples/score/.pharaoh/project/schemas/
(artefact-catalog, checklists-frontmatter, id-conventions, workflows)
anchor deterministic validation for tailor-review.
Cross-cutting gap and conformance auditors over an existing corpus:

  * pharaoh-lifecycle-check       — verify state transitions against workflows.yaml
  * pharaoh-standard-conformance  — per-indicator audit against one regulatory standard
  * pharaoh-coverage-gap          — single-category gap detector with explicit detection rule
  * pharaoh-process-audit         — full-corpus gap audit across 10 categories

Each decomposes into atomic checks; composable with the tailor-review
layer for a standards-ready audit chain.
Chain the req→arch→vplan→fmea primitives with per-step reviews and
explicit handoff contracts. First public orchestrator demonstrating
composition of the atomic skills.
pharaoh-author and pharaoh-verify are replaced by the atomic chain
(pharaoh-req-draft → pharaoh-req-review → pharaoh-req-regenerate, and
similar for arch/vplan/fmea). Cross-references updated in
pharaoh-change/decide/mece/plan/release/setup/spec/trace SKILL.md and
in shared/strictness.md.

CHANGELOG, CONTRIBUTING, README refreshed for the atomic-skills
architecture.
Atomic retrieval skill: reads rationale memories from a Papyrus
workspace and returns a structured list of {memory_id, text,
relevance_score}. Does not draft, review, or modify artefacts.

Uses Papyrus semantic mode (cosine over sentence-transformers
all-MiniLM-L6-v2 via the [semantic] extra) — feature_context is
passed verbatim as the query, scores and memory_ids parsed from
the fenced output. Workspace detection via presence of .papyrus/
directory; missing workspace returns [] (not an error).

Sits upstream of any draft skill; inserts retrieved rationale into
the draft's input context so prior design decisions are respected.
Primitives and orchestrator for parallel audit of an existing corpus,
with shared-memory deduplication of findings across subagents:

  * pharaoh-finding-record      — atomic write+dedup primitive for
                                  audit findings (one finding per call,
                                  dedup on canonical finding signature)
  * pharaoh-review-completeness — per-axis review/approval auditor
                                  (coverage over required review axes)
  * pharaoh-audit-fanout        — orchestrate parallel audit subagents
                                  over disjoint artefact ranges, shared
                                  Papyrus as the findings ledger
Primitives and orchestrator for reverse-engineering an existing code
module into sphinx-needs requirements, with shared-memory canonical
vocabulary across parallel subagents:

  * pharaoh-decision-record  — atomic write+dedup for design decisions
                               (type, canonical_name) dedup key;
                               generalization of finding-record for
                               design-rationale memories
  * pharaoh-req-from-code    — reverse-engineer a single source file
                               into sphinx-needs comp_req directives;
                               calls pharaoh-context-gather before
                               naming types so canonical vocabulary is
                               reused across subagents instead of
                               re-coined
  * pharaoh-reqs-from-module — orchestrate parallel req-from-code
                               subagents over files of a module, with
                               shared Papyrus workspace acting as the
                               cross-agent canonical-naming ledger
Copilot AI review requested due to automatic review settings April 19, 2026 16:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors Pharaoh’s skill set toward atomic, single-artefact skills; retires the legacy composite verification skill; and introduces first-class project tailoring and Papyrus-based memory primitives to support semantic recall + deduplicated shared writes.

Changes:

  • Replaces legacy verification/authoring references with an atomic author/review chain (req/arch/vplan/fmea + reviews).
  • Adds tailoring bootstrap + validation skills (tailor-detect/fill/review) and a Score example tailoring bundle + schemas.
  • Adds new audit/process orchestration skills (coverage gap detection, lifecycle checks, process audit, fan-out orchestrators) and Papyrus memory primitives.

Reviewed changes

Copilot reviewed 46 out of 46 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
skills/shared/strictness.md Updates workflow gate docs to refer to “any authoring/review skill” instead of legacy monoliths.
skills/pharaoh-vplan-review/SKILL.md Adds atomic test-case review spec (per-axis JSON findings).
skills/pharaoh-vplan-draft/SKILL.md Adds atomic test-case drafting spec for a single parent.
skills/pharaoh-verify/SKILL.md Removes the legacy monolithic verification skill.
skills/pharaoh-trace/SKILL.md Updates guidance text to point to appropriate authoring skills post-refactor.
skills/pharaoh-tailor-review/SKILL.md Adds tailoring validator spec (schema + cross-file checks).
skills/pharaoh-tailor-fill/SKILL.md Adds tailoring authoring spec (writes .pharaoh/project/ files).
skills/pharaoh-tailor-detect/SKILL.md Adds tailoring detection spec (derives conventions from needs.json).
skills/pharaoh-spec/SKILL.md Updates spec-generation plan table examples to the new skill naming.
skills/pharaoh-setup/SKILL.md Updates setup docs to list the new atomic skills instead of legacy monoliths.
skills/pharaoh-review-completeness/SKILL.md Adds an audit primitive to detect missing review/approval chain fields.
skills/pharaoh-reqs-from-module/SKILL.md Adds orchestrator for parallel reverse-engineering from source files with shared Papyrus workspace.
skills/pharaoh-req-review/SKILL.md Adds atomic requirement review spec (per-axis JSON findings).
skills/pharaoh-req-regenerate/SKILL.md Adds atomic requirement regeneration spec consuming req-review findings.
skills/pharaoh-req-from-code/SKILL.md Adds atomic reverse-engineering skill with Papyrus terminology coordination.
skills/pharaoh-req-draft/SKILL.md Adds atomic requirement drafting spec (single directive emitted).
skills/pharaoh-release/SKILL.md Updates release gating/tips to reference “review skills” rather than legacy verify.
skills/pharaoh-process-audit/SKILL.md Adds full-corpus audit orchestrator aggregating coverage-gap categories.
skills/pharaoh-plan/SKILL.md Updates planning docs/examples to the new author/review chain terminology.
skills/pharaoh-mece/SKILL.md Updates MECE vs verification wording to align with new review skills.
skills/pharaoh-lifecycle-check/SKILL.md Adds deterministic lifecycle legality checker against workflows.yaml.
skills/pharaoh-fmea/SKILL.md Adds atomic FMEA row derivation spec (JSON output).
skills/pharaoh-flow/SKILL.md Adds V-model orchestrator chaining req→arch→vplan→fmea plus reviews.
skills/pharaoh-finding-record/SKILL.md Adds Papyrus-backed deterministic dedup write primitive for audit findings.
skills/pharaoh-decision-record/SKILL.md Adds Papyrus-backed deterministic dedup write primitive for canonical decisions/facts/preferences.
skills/pharaoh-decide/SKILL.md Removes delegation to legacy author skill and updates “next step” guidance to req-review.
skills/pharaoh-coverage-gap/SKILL.md Adds single-category gap detector returning structured matches.
skills/pharaoh-context-gather/SKILL.md Adds Papyrus semantic recall primitive for pre-draft context retrieval.
skills/pharaoh-change/SKILL.md Updates change-analysis gating language to apply to all authoring skills.
skills/pharaoh-audit-fanout/SKILL.md Adds orchestrator running multiple audit skills in parallel with Papyrus dedup.
skills/pharaoh-arch-review/SKILL.md Adds atomic architecture-element review spec (per-axis JSON findings).
skills/pharaoh-arch-draft/SKILL.md Adds atomic architecture-element drafting spec.
examples/score/.pharaoh/project/workflows.yaml Adds Score example workflows configuration.
examples/score/.pharaoh/project/schemas/workflows.schema.json Adds JSON schema for workflows.yaml.
examples/score/.pharaoh/project/schemas/id-conventions.schema.json Adds JSON schema for id-conventions.yaml.
examples/score/.pharaoh/project/schemas/checklists-frontmatter.schema.json Adds JSON schema for checklist frontmatter.
examples/score/.pharaoh/project/schemas/artefact-catalog.schema.json Adds JSON schema for artefact-catalog.yaml.
examples/score/.pharaoh/project/id-conventions.yaml Adds Score example ID conventions.
examples/score/.pharaoh/project/checklists/requirement.md Adds Score example requirement checklist.
examples/score/.pharaoh/project/artefact-catalog.yaml Adds Score example artefact catalog.
README.md Updates public docs to describe the atomic skill architecture and new skill taxonomy.
CONTRIBUTING.md Updates repository structure listing to include new skills.
CHANGELOG.md Documents removal of legacy monoliths and addition of atomic skills.
.github/ISSUE_TEMPLATE/feature_request.md Updates template hint to reference new skill names.

Comment thread skills/shared/strictness.md
Comment thread skills/pharaoh-req-draft/SKILL.md
Comment thread examples/score/.pharaoh/project/id-conventions.yaml
Comment thread examples/score/.pharaoh/project/checklists/requirement.md Outdated
Comment thread skills/pharaoh-spec/SKILL.md Outdated
Comment thread skills/pharaoh-arch-draft/SKILL.md
Comment thread skills/pharaoh-vplan-draft/SKILL.md Outdated
Comment thread skills/pharaoh-vplan-review/SKILL.md Outdated
Comment thread skills/pharaoh-tailor-review/SKILL.md Outdated
Comment thread skills/pharaoh-plan/SKILL.md Outdated
@bburda bburda self-assigned this Apr 19, 2026
@bburda bburda marked this pull request as draft April 19, 2026 17:07
@bburda bburda marked this pull request as ready for review April 19, 2026 17:12
  * 23 skill SKILL.md descriptions rewritten to begin with
    "Use when ..." per the repo's frontmatter convention
    (CI step "Validate skill frontmatter").

  * 23 matching agent files created in .github/agents/ for the skills
    added in this branch (CI step "Cross-reference skills and
    agents" requires pharaoh-X/ <-> pharaoh.X.agent.md). Agent files
    are minimal stubs pointing to the SKILL.md for full behavior;
    handoffs left empty since atomic primitives are invoked by
    orchestrator skills, not as user-facing entry agents.

  * .github/agents/pharaoh.author.agent.md and
    .github/agents/pharaoh.verify.agent.md removed, since the
    corresponding skills were retired in this branch.

No behavior change in the skills themselves — only frontmatter /
accompanying metadata to satisfy the CI validator.
@bburda bburda force-pushed the refactor/atomic-skills branch from a14250f to dcdc68d Compare April 19, 2026 18:44
  * shared/strictness.md — generalize "Skills with no gates" to cover
    all review/audit skills, read-only memory skills, and tailor-
    authoring skills; previous list only named pharaoh:req-review and
    implied the other review skills had prerequisites.

  * shared/strictness.md — add Section 0 clarifying that session-state
    gating is an orchestrator concern. Atomic primitives do not read
    pharaoh.toml or .pharaoh/session.json, do not block on gates, and
    do not write session state. Orchestrators (pharaoh:flow,
    audit-fanout, reqs-from-module, plan, change, release, and the
    legacy top-level skills) own the gating lifecycle. This preserves
    atomicity of the primitives (criterion a).

  * examples/score id-conventions.yaml — add arch and tc prefix
    entries; without them the example tailoring fails pharaoh-tailor-
    review cross-file check C1 (every artefact-catalog key must be
    declared in id-conventions.prefixes).

  * examples/score checklists/requirement.md — add schema-compliant
    YAML frontmatter (name / applies_to / axes per checklists-
    frontmatter.schema.json) and use the canonical axis keys
    (unambiguity_prose, internal_consistency, no_duplication) that
    pharaoh-req-review emits.

  * pharaoh-spec, pharaoh-plan — example plan tables no longer
    misdirect users to pharaoh:req-draft for spec/impl/tc updates.
    Spec and impl entries now point to pharaoh:arch-draft; tc entries
    to pharaoh:vplan-draft; review step enumerates per-type review
    skills.

  * pharaoh-tailor-review — align the skill spec with the authoritative
    JSON schemas and example tailoring. Fixes: workflows.yaml
    lifecycle_states is an array (not a map); id_regex_exceptions is
    optional (not required); checklist frontmatter is optional and
    uses schema keys (name / applies_to / axes);
    artefact-catalog.required_body_sections added to the structural
    table; C2/C3 rule wording updated for array semantics.

  * pharaoh-vplan-draft, pharaoh-vplan-review — separate directive-
    option keys (required_fields) from body-prose section headings
    (required_body_sections). Previous spec treated inputs / steps /
    expected as directive options, which contradicted the Score
    tailoring and the artefact-catalog schema. Defaults now align:
    required_fields = [id, status, verifies],
    required_body_sections = [Inputs, Steps, Expected].
@patdhlk patdhlk requested review from danwos and patdhlk April 20, 2026 08:54
@patdhlk patdhlk merged commit 5917cfa into main Apr 20, 2026
1 check passed
@patdhlk patdhlk deleted the refactor/atomic-skills branch April 20, 2026 09:19
@patdhlk patdhlk restored the refactor/atomic-skills branch April 20, 2026 20:19
@patdhlk patdhlk deleted the refactor/atomic-skills branch April 20, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants