levelup-publish
Compile accepted Context Directive Records (CDRs) into team-ai-directives artifacts and create a draft PR. Builds context modules, evals goldensets, and/or skills based on CDR context types.
tikalk · AI review on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add tikalk/adlc-team-skills --skill levelup-publishAbout this skill
name: levelup-publish description: Compile accepted Context Directive Records (CDRs) into team-ai-directives artifacts and create a draft PR. Builds context modules, evals goldensets, and/or skills based on CDR context types. disable-model-invocation: true
levelup-publish
What this skill does
Compile accepted CDRs into actual artifacts in the team-ai-directives team AI directives and create a draft PR.
It is the implementation phase of the CDR lifecycle:
- Validate accepted CDRs against the signal gate
- Detect cross-CDR conflicts before publishing
- Generate context module files (rules, personas, examples, constitution)
- Generate eval goldenset files (
goldset.md+goldset.json) for eval-type CDRs - Generate skill artifacts (
SKILL.md+.skills-entry.json) - Update
.skills.jsonmanifest - Update
CDR.mdindex in team-ai-directives - Create a branch, commit, and open a draft PR
This skill does not run until CDRs have been accepted via /levelup-clarify.
When to use
- After
/levelup-clarify: Accepted CDRs need to be published - Single skill build: Use
--skill <name|CDR-id>to build one skill - Context modules only: Use
--context-onlyto skip skill generation
When NOT to use
- No accepted CDRs: Run
/levelup-clarifyfirst - Uncommitted changes in team-ai-directives: Clean working tree first
- Discovering patterns: Use
/levelup-initor/levelup-specify - Reviewing CDRs: Use
/levelup-clarify
Process
User Input
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty).
Examples of User Input:
"--ready"— Create ready PR instead of draft"--skip-skills"— Don't include skill CDRs"--context-only"— Only build context modules"--skill CDR-005"— Build only the skill from CDR-005"CDR-001 CDR-003"— Only implement specific CDRs- Empty input: Implement all accepted CDRs as draft PR
Flags
--ready: Create ready PR instead of draft--skip-skills: Skip skill-type CDRs--context-only: Build only context modules (skip all skills)--skill <name|CDR-id>: Build only one skill from a specific accepted skill CDR
Role & Context
You are acting as a Context Publisher — moving accepted CDRs from local drafts to team-ai-directives.
Your role involves:
- Validating that CDRs are accepted and ready
- Creating context module files from CDR content
- Creating skill artifacts from skill-type CDRs
- Managing Git operations (branch, commit, push, PR)
Outline
- Environment Setup (Phase 0): Resolve paths and list accepted CDRs
- Prerequisites Check (Phase 1): Ensure team-ai-directives is configured and clean
- Signal Gate Validation (Phase 2): Filter CDRs without concrete evidence
- Cross-CDR Conflict Check (Phase 3): Detect duplicate targets and rule conflicts
- Branch Preparation (Phase 4): Create branch in team-ai-directives
- Context Module Generation (Phase 5): Build rules/personas/examples/constitution
- Eval Goldenset Generation (Phase 6): Build goldset.md + goldset.json for eval CDRs
- Skill Generation (Phase 7): Build SKILL.md + .skills-entry.json
- log.md Update (Phase 8): Append OKF §9 entries to per-dir log.md
- AGENTS.md Check (Phase 9): Create if missing
- Commit and PR (Phase 10): Publish changes
- Summary (Phase 11): Report results
Execution Steps
Phase 0: Environment Setup
Run:
scripts/bash/setup-levelup-publish.sh
Parse JSON for REPO_ROOT, TEAM_AI_DIRECTIVES, CDR_DRAFTS_DIR, ACCEPTED_CDRS, TD_CONFIGURED, TD_IS_GIT, TD_CLEAN.
If the setup script is unavailable or fails, resolve manually:
REPO_ROOT— walk up from cwd to find.adlc/, orgit rev-parse --show-toplevel, or usepwd.TEAM_AI_DIRECTIVES—TEAM_AI_DIRECTIVESenv var, then.adlc/init-options.json→team_ai_directives, thenREPO_ROOT/team-ai-directives.CDR_DRAFTS_DIR—REPO_ROOT/.adlc/drafts/cdrACCEPTED_CDRS—grep -l '^### Status: \*\*Accepted\*\*' CDR_DRAFTS_DIR/CDR-*.mdand extract IDs.TD_IS_GIT—git -C "$TEAM_AI_DIRECTIVES" rev-parse --is-inside-work-tree(exit 0 = true).TD_CLEAN—git -C "$TEAM_AI_DIRECTIVES" status --porcelain(empty = clean).
If TD_IS_GIT is false, Phase 10 (branch/commit/PR) cannot run. Offer to git init the team AI directives or write files directly without git.
Phase 1: Prerequisites Check
Verify Team Directives configured:
Team AI directives repository not configured.
Run: team-setup
Or set: export TEAM_AI_DIRECTIVES=/path/to/team-ai-directives
Check Working Tree:
If TD_CLEAN is false:
team-ai-directives has uncommitted changes.
Please commit or stash changes before running /levelup-publish.
Check Accepted CDRs:
If ACCEPTED_CDRS is empty:
No accepted CDRs found.
Run /levelup-clarify to accept CDRs first.
Phase 2: Signal Gate Validation
For each accepted CDR, evaluate it against these four criteria:
-
Team-wide applicability: Does this pattern apply to multiple projects/teams, or is it specific to one project? If the CDR's context or evidence only references a single project's internals with no generalizable lesson → SKIP (reason: "project-specific").
-
Evidence quality: Does the CDR reference concrete file paths, commit SHAs, or test cases? If the evidence section is empty or vague ("various files", "general practice") → SKIP (reason: "no evidence").
-
Uniqueness: Does this duplicate an existing directive in team-ai-directives? Check
context_modules/rules/,context_modules/examples/, andCDR.mdfor overlapping content. If it overlaps → SKIP (reason: "duplicate"). -
High value: Is this a genuinely useful pattern, or a nice-to-have minor convenience? If the CDR explicitly states "low value" or "minor convenience", or the pattern is trivial (e.g., "u