AgentSkillsCN

os-tk-baseline

利用 OpenSpec 规范,为既有棕地项目记录其基准(当前)行为。

SKILL.md
--- frontmatter
name: os-tk-baseline
description: Document baseline (current) behavior for a brownfield project using OpenSpec specs.

/os-tk-baseline

Inputs

  • Request text (from $ARGUMENTS)
  • Optional --id <change-id>

Resolve skill dir (for scripts)

bash
SKILL_DIR=".pi/skills/os-tk-baseline"
if [[ ! -d "$SKILL_DIR" ]]; then SKILL_DIR="pi/skills/os-tk-baseline"; fi
PROPOSAL_DIR="${SKILL_DIR%/os-tk-baseline}/os-tk-proposal"

Parse arguments

  • eval "$(bash "$PROPOSAL_DIR/scripts/parse-args.sh" "$@")" to populate CHANGE_ID and REQUEST.

Allocate change id (4 digits)

If CHANGE_ID is empty:

  • eval "$(bash "$PROPOSAL_DIR/scripts/allocate-change-id.sh" "$REQUEST")"

Ensure change folder + metadata

  • bash "$PROPOSAL_DIR/scripts/ensure-change-folder.sh"

Dev notes (mandatory when enabled)

  • bash "$PROPOSAL_DIR/scripts/ensure-dev-notes.sh" (requires CHANGE_ID)

Scaffold baseline artifacts

Run:

  • bash "$PROPOSAL_DIR/scripts/write-proposal.sh"
  • bash "$PROPOSAL_DIR/scripts/write-specs.sh"
  • bash "$PROPOSAL_DIR/scripts/write-design.sh"
  • bash "$PROPOSAL_DIR/scripts/write-tasks.sh"

These create skeleton files which the planner will overwrite with real content.

Parallel scouting + baseline writing (single subagent chain)

Use pi-async-subagents tool subagent with a parallel-in-chain fan-out/fan-in.

Important:

  • The planner must NOT spawn any subagents.
  • This chain is sync (async: false) because it includes a parallel step.
js
subagent({
  "agentScope": "both",
  "async": false,
  "chain": [
    {
      "parallel": [
        {
          "agent": "os-tk-repo-scout",
          "task": "Find existing behavior, conventions, and current patterns relevant to: {task}. Focus on documenting status quo (no changes)."
        },
        {
          "agent": "os-tk-librarian",
          "task": "DOCS mode: Find official docs, existing behavior guarantees, and examples relevant to: {task}."
        }
      ],
      "concurrency": 2,
      "failFast": false
    },
    {
      "agent": "os-tk-planner",
      "task": "Create/update baseline OpenSpec artifacts for ${CHANGE_ID}.\n\nRequest: ${REQUEST}\nChange: ${CHANGE_ID}\n\nScout findings:\n{previous}\n\nDo the following (NO product code changes):\n1) Replace the scaffold content in:\n   - openspec/changes/${CHANGE_ID}/proposal.md\n   - openspec/changes/${CHANGE_ID}/specs/** (document current behavior; use ADDED requirements only)\n   - openspec/changes/${CHANGE_ID}/design.md (note this is documentation-only; no implementation)\n   - openspec/changes/${CHANGE_ID}/tasks.md (review/validation tasks only)\n2) Add explicit exclusions (no code changes, no ticket creation).\n3) Ensure specs include Given/When/Then scenarios for key behaviors.\n4) If dev-notes are enabled, update .os-tk/dev-notes/${CHANGE_ID}.md with decisions + validated snippets + open questions.\n\nDo NOT create tk tickets (baseline only)."
    },
    {
      "agent": "os-tk-gap-analyst",
      "task": "Review the baseline artifacts for gaps. Request: ${REQUEST}. Change: ${CHANGE_ID}.\n\nRead the files under openspec/changes/${CHANGE_ID}/ (proposal.md, specs/**, design.md, tasks.md) and report missing behaviors, edge cases, and verification gaps."
    },
    {
      "agent": "os-tk-planner",
      "task": "Apply the gap analysis below to the baseline artifacts for ${CHANGE_ID}.\n\nGap analysis:\n{previous}\n\nUpdate (in place):\n- openspec/changes/${CHANGE_ID}/proposal.md\n- openspec/changes/${CHANGE_ID}/specs/**\n- openspec/changes/${CHANGE_ID}/design.md\n- openspec/changes/${CHANGE_ID}/tasks.md\n\nIf you change scope/assumptions, reflect them in proposal.md and dev-notes (if enabled)."
    }
  ]
})

Validate

  • bash "$PROPOSAL_DIR/scripts/validate-change.sh"

Stop condition

STOP after writing baseline artifacts and validation. Ask the user to review:

  • openspec/changes/${CHANGE_ID}/proposal.md
  • openspec/changes/${CHANGE_ID}/specs/**
  • openspec/changes/${CHANGE_ID}/design.md
  • openspec/changes/${CHANGE_ID}/tasks.md

When ready, archive to merge baseline specs into openspec/specs/:

  • openspec archive ${CHANGE_ID} --yes

Prohibited

  • No implementation code.
  • No ticket creation (that’s /os-tk-bootstrap).