You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Artifacts written by skills (reviews, devlogs, plans, change summaries, response files, run summaries, deferred-findings, and orchestrated subagent outputs) record metadata in inconsistent shapes:
Inline pseudo-header (review-branch, summarize-change, respond-to-review): markdown lines below the H1 — e.g., Commit: abc123. Not machine-readable without bespoke parsing.
Partial YAML frontmatter (create-devlog, save-plan, wrap-up deferred-findings): a provenance: block plus a varying subset of identity fields.
No frontmatter at all (plan, orchestrated subagent outputs from reviewers/planners/architects/savings-analyzer): nothing.
Readers must hunt for the metadata they need, and when a ticket spans multiple branches and PRs, determining which branch/PR an artifact applies to requires git archaeology. The data is locally derivable at write time but isn't captured.
Concrete prior incident: ticket COMPPLAN-800 had three sequential branches and three sequential PRs (#279, #280, #283). Answering "which branch does this saved review apply to?" required git cat-file archaeology because the original commits had since been squash-and-force-pushed.
Context
Three structural facts shape this work:
get-session-context already returns branch_name and platform in its manifest — branch is free at write time.
The codebase already uses YAML frontmatter in three artifact types (create-devlog, save-plan, wrap-up). This is the established pattern; the inline-header artifacts are outliers.
PR is resolvable at write time via gh pr list --head <branch> --state all (GitHub) or the existing Bitbucket query pattern.
Affected artifact-writing surfaces:
Bucket A — inline-header artifacts (migrate to YAML frontmatter):
Add a new "Universal artifact frontmatter" section to _data/artifact-conventions.md defining the canonical schema once:
---
provenance:
skill: <skill-name> # required — the skill that wrote this artifacttimestamp: <ISO 8601 UTC> # required — write timebaseSha: <short SHA> # optional — omit if origin/main unresolvableisInteractive: true|false # requiredrefinedBy: <skill-name> # optional — existing conventionmodel: <model id> # optional — present when an AI model authored the bodyticket_id: <id> # optional — omit when nullticket_ref: <display ref> # optional — omit when ticket_id is nullbranch: <branch name> # requiredcommit: <short SHA of HEAD> # required — HEAD at write timepr: <full URL> # optional — omit when no PR or lookup failsauthor: <name(s)> # optional — used by review artifactscommits: [<sha>, ...] # optional — used by devlogsrun_id: <run id> # optional — present in orchestrated runs
---
Field naming conventions: keys inside provenance: use camelCase (preserves existing convention; 544+ historical artifacts use this spelling and refine-plan reads them). All other top-level keys use snake_case. This split is documented explicitly in the new section.
Existing per-artifact sections (## Plan provenance, ## Devlog frontmatter, ## Deferred-findings frontmatter) refactor to inherit from the universal section and document only artifact-specific extensions.
2. Specify shared PR resolution
Add _data/pr-resolution.md:
GitHub:gh pr list --head "$BRANCH" --state all --json url --jq '.[0].url // empty'
Bitbucket: existing bitbucketPullRequest list query, extract links.html.href
URL format: GitHub PR is https://github.com/{owner}/{repo}/pull/{n} (not /issues/); Bitbucket is https://bitbucket.org/{workspace}/{repo}/pull-requests/{n}. The CLI returns the correct URL — no interpolation.
--state all (GitHub) so closed/merged PRs are still resolvable for post-merge artifacts.
Failure mode: on CLI unavailable, auth error, network error, or >5s timeout — omit pr: line, emit one brief warning in the agent's text output, proceed with the write. Never block.
3. Migrate all affected artifact-writing skills
For each skill in Buckets A, B, and C:
Update ## Output format to reference the universal schema and declare artifact-specific extensions.
Bucket A: remove inline pseudo-header from the artifact template; H1 remains.
Bucket C: introduce YAML frontmatter at the top.
All buckets: saving step writes branch + commit from session context + git rev-parse, and invokes shared PR resolution.
4. No backfill
Historical artifacts are not modified. The 544 existing artifacts with camelCase provenance.* keys remain valid under the preserved convention.
_data/artifact-conventions.md has a new "Universal artifact frontmatter" section defining the canonical schema, with the camelCase/snake_case rule documented explicitly.
Existing per-artifact sections in _data/artifact-conventions.md (## Plan provenance, ## Devlog frontmatter, ## Deferred-findings frontmatter) inherit from the universal section and document only extensions.
_data/pr-resolution.md exists and documents GitHub and Bitbucket dispatch, URL formats, --state all rationale, and the failure-handling rule.
Every skill in Buckets A, B, and C writes artifacts whose frontmatter conforms to the universal schema, with artifact-specific extensions where applicable.
Bucket A artifacts no longer contain the inline Commit: / Timestamp: / Author: / Generated by: lines below the H1; equivalent data is in YAML frontmatter.
When the current branch has an open or merged PR, pr: contains the full URL (GitHub: /pull/{n}, Bitbucket: /pull-requests/{n}).
When the branch has no PR, the pr: line is omitted entirely (not written as null or none).
When PR resolution fails (CLI unavailable, auth error, network error, timeout > 5s), the artifact is still written, pr: is omitted, and one brief warning is surfaced in the agent's text output.
branch: is always present in every new artifact, with the raw branch_name from session context (no sanitization).
commit: is always present in every new artifact, with the short HEAD SHA at write time.
No existing artifacts are modified (no backfill).
refine-plan and orchestrator trust evaluation continue to work unmodified — provenance.* camelCase convention is preserved.
End-to-end verification: invoke a representative skill from each bucket (a) on a branch with a PR, (b) on a branch without a PR, (c) with PR lookup forced to fail; verify the expected frontmatter shape in each case.
Problem
Artifacts written by skills (reviews, devlogs, plans, change summaries, response files, run summaries, deferred-findings, and orchestrated subagent outputs) record metadata in inconsistent shapes:
review-branch,summarize-change,respond-to-review): markdown lines below the H1 — e.g.,Commit: abc123. Not machine-readable without bespoke parsing.create-devlog,save-plan,wrap-updeferred-findings): aprovenance:block plus a varying subset of identity fields.plan, orchestrated subagent outputs from reviewers/planners/architects/savings-analyzer): nothing.Readers must hunt for the metadata they need, and when a ticket spans multiple branches and PRs, determining which branch/PR an artifact applies to requires git archaeology. The data is locally derivable at write time but isn't captured.
Concrete prior incident: ticket
COMPPLAN-800had three sequential branches and three sequential PRs (#279, #280, #283). Answering "which branch does this saved review apply to?" requiredgit cat-filearchaeology because the original commits had since been squash-and-force-pushed.Context
Three structural facts shape this work:
get-session-contextalready returnsbranch_nameandplatformin its manifest —branchis free at write time.create-devlog,save-plan,wrap-up). This is the established pattern; the inline-header artifacts are outliers.gh pr list --head <branch> --state all(GitHub) or the existing Bitbucket query pattern.Affected artifact-writing surfaces:
Bucket A — inline-header artifacts (migrate to YAML frontmatter):
review-branch,summarize-change,respond-to-reviewBucket B — partial-frontmatter artifacts (extend with missing fields):
create-devlog,save-plan,wrap-up(deferred-findings)Bucket C — no-frontmatter artifacts (introduce frontmatter):
plan(interactive)orchestrated-reviewer,aspect-code-reviewer,aspect-test-reviewer,aspect-silent-failure-reviewer,code-simplification-reviewerorchestrated-planner(orchestration-plan.md; sibling.jsonunaffected)orchestrated-architect,orchestrated-coder(the latter inherits viasummarize-change)planner,plan-reviewer,plan-reviser,savings-analyzer,refine-planSolution
1. Define a universal artifact frontmatter schema
Add a new "Universal artifact frontmatter" section to
_data/artifact-conventions.mddefining the canonical schema once:Field naming conventions: keys inside
provenance:usecamelCase(preserves existing convention; 544+ historical artifacts use this spelling andrefine-planreads them). All other top-level keys usesnake_case. This split is documented explicitly in the new section.Existing per-artifact sections (
## Plan provenance,## Devlog frontmatter,## Deferred-findings frontmatter) refactor to inherit from the universal section and document only artifact-specific extensions.2. Specify shared PR resolution
Add
_data/pr-resolution.md:gh pr list --head "$BRANCH" --state all --json url --jq '.[0].url // empty'bitbucketPullRequest listquery, extractlinks.html.hrefhttps://github.com/{owner}/{repo}/pull/{n}(not/issues/); Bitbucket ishttps://bitbucket.org/{workspace}/{repo}/pull-requests/{n}. The CLI returns the correct URL — no interpolation.--state all(GitHub) so closed/merged PRs are still resolvable for post-merge artifacts.pr:line, emit one brief warning in the agent's text output, proceed with the write. Never block.3. Migrate all affected artifact-writing skills
For each skill in Buckets A, B, and C:
## Output formatto reference the universal schema and declare artifact-specific extensions.branch+commitfrom session context +git rev-parse, and invokes shared PR resolution.4. No backfill
Historical artifacts are not modified. The 544 existing artifacts with camelCase
provenance.*keys remain valid under the preserved convention.5. Consumer compatibility
refine-plancontinues to read existingprovenanceblocks as-is (camelCase preserved). Orchestrator trust evaluation (CHANGELOG #317, "refinement-elevated" classification) readsprovenance.refinedBy— unchanged.Acceptance criteria
_data/artifact-conventions.mdhas a new "Universal artifact frontmatter" section defining the canonical schema, with the camelCase/snake_case rule documented explicitly._data/artifact-conventions.md(## Plan provenance,## Devlog frontmatter,## Deferred-findings frontmatter) inherit from the universal section and document only extensions._data/pr-resolution.mdexists and documents GitHub and Bitbucket dispatch, URL formats,--state allrationale, and the failure-handling rule.Commit:/Timestamp:/Author:/Generated by:lines below the H1; equivalent data is in YAML frontmatter.pr:contains the full URL (GitHub:/pull/{n}, Bitbucket:/pull-requests/{n}).pr:line is omitted entirely (not written asnullornone).pr:is omitted, and one brief warning is surfaced in the agent's text output.branch:is always present in every new artifact, with the rawbranch_namefrom session context (no sanitization).commit:is always present in every new artifact, with the short HEAD SHA at write time.refine-planand orchestrator trust evaluation continue to work unmodified —provenance.*camelCase convention is preserved.