okfreq-gardening
Audit and improve an okfreq requirements bundle by finding missing traceability, stale requirements, broken hierarchy links, coverage gaps, and configuration drift while preserving authored content and generated-field ownership.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 6
- Forks
- 0
01 前言 Front Matter
- name
- okfreq-gardening
- metadata
- { "url": "https://github.com/gsemet/okf-schema", "keywords": [ "okfreq", "requirements", "traceability", "gardening", "audit", "coverage", "StRS", "SwRS" ] }
- description
- Audit and improve an okfreq requirements bundle by finding missing traceability, stale requirements, broken hierarchy links, coverage gaps, and configuration drift while preserving authored content and generated-field ownership.
03 SKILL.md 正文
okfreq gardening
<!-- @implements_req SwRS-OKFSCHEMA-OKFREQ-008 -->
This specialized workflow extends the foundational okfreq skill. Load the
okfreq skill first so the requirements goal, StRS-to-SwRS model,
project-guideline precedence, and traceability semantics remain in force
throughout gardening. Do not assume that installed skills share a directory.
Read the bundle's guidelines/requirements.guidelines.md during Phase 1, after
checking the project's own AGENTS.md, then any project guideline in the same
folder (by convention project.guidelines.md), which wins where it specializes
the shared text. okfreq init installs the shared file; if it is missing or
outdated, run okfreq init <bundle> --force, which replaces it with the
packaged text and never touches the project files.
Perform an explicit, evidence-based maintenance pass over an okfreq bundle.
The primary users are coding agents working on brownfield projects where source
code, tests, and requirements have drifted apart. The workflow discovers gaps,
proposes safe changes, and validates the result. It does not silently invent
requirements, evidence, IDs, UUIDs, lifecycle transitions, or coverage.
Invoke this skill only when the user asks to audit, garden, refresh, reconcile,
or maintain an okfreq requirements base. Do not run it proactively during an
unrelated implementation task.
Non-negotiable boundaries
- Resolve the bundle root before anything else: it is the directory that owns
config.yml. Prefer a top-levelrequirements/; otherwise resolve the agent configuration directory, using.agents/when it exists and.github/only as a fallback. Never prefer.github/over an existing.agents/directory, and do not create both locations for the same configuration. - Treat the bundle as split. The bundle root owns
config.yml,guidelines/, and generated reports;<bundle>/tiers/owns_schema/,index.md,log.md, and the tier folders. Readconfig.ymland every file in<bundle>/tiers/_schema/before editing anything. - Preserve requirement IDs, UUIDs, authored frontmatter, unknown properties, YAML comments, and Markdown bodies.
- Never hand-edit
derived_by,supersedes,implemented_in_files,tested_in_files,default_owner_email, indexes or reports. Use explicitokfreqcommands for generated data. - Never claim implementation or test coverage without source evidence and markers. Markers are links, not proof that tests pass.
- Never change lifecycle or approval state as an incidental edit.
- Never renumber existing IDs. New IDs must be collision-safe and stable.
- Imported requirements remain read-only by default; change them only through an explicit migration or import operation.
- Preserve unrelated user work and inspect the worktree before writing.
For CLI syntax, configuration, skipped link checks and report destinations, read
the installed okfreq skill's references/operations.md; it is packaged and
requires no access to the tool's source repository or documentation site.
Phase 1 — Discover project rules and scope
- Resolve the bundle root. Prefer an explicit path; otherwise look for
requirements/, then<agent-config>/requirements/, where<agent-config>is.agents/when it exists and.github/otherwise. Confirm the choice by the presence ofconfig.yml. Stop if no unique bundle exists. - Read the nearest
AGENTS.md, the bundle's ownguidelines/requirements.guidelines.md, any other applicable guidelines,config.yml, and every schema intiers/_schema/. If the bundle guideline is absent, use theokfreqskill's bundled reference guideline as the fallback; a project-local guideline always takes precedence. - Confirm the bundle resolves as expected before auditing content. Run
okfreq validate <bundle> --prose; a traceback or a missing-schema error means the layout and the tool disagree, and that drift is the first finding to fix. - Read the project task runner and CI configuration to identify validation and test commands. Do not assume a universal runner.
- Record configured tiers, parent relationships, ID policy, lifecycle values, owners and approval locks, marker keywords, generated-field ownership, and scope mappings.
- Inspect
git statusso pre-existing changes are not attributed to gardening.
Phase 2 — Establish a read-only baseline
Run the project-prescribed validation and test checks before changing files. Then inspect requirements frontmatter before bodies and inventory:
- every requirement by ID, UUID, tier, scope, origin, and lifecycle;
- authored
derives_from,depends_on,superseded_byandrelates_torelationships; - generated
derived_by,supersedes, implementation, and test fields; - verification methods and criteria;
- unknown producer metadata and preservation-sensitive comments;
- source and test files covered by each configured scope.
Use the following commands as appropriate:
okfreq status .
okfreq validate . --prose
okfreq lint . --prose --check
okfreq index .
okfreq graph . --json
okfreq trace . --json
Keep schema errors, graph errors, marker errors, missing IDs, lifecycle counts, and scan warnings as separate findings.
Phase 3 — Repair structural and graph issues
- Identify malformed frontmatter, missing required fields, invalid UUIDs, invalid tiers, invalid lifecycle values, and unknown hierarchy targets.
- Detect orphaned upper-level requirements and requirements whose parent tier violates the configured hierarchy.
- Use
okfreq graphto inspect reverse derivation. Rebuild generatedderived_byandsupersedesonly throughokfreq update-coverageafter previewing it. Everysupersededrequirement must name its replacements insuperseded_by; report one that does not instead of guessing a replacement. - Never repair an uncertain relationship by guessing. Report it as an open discrepancy and ask for a decision.
- Preserve all authored and unknown metadata while making approved repairs.
Phase 4 — Audit source and test traceability
Run okfreq trace . --json and classify results:
implemented— source files containing implementation markers;tested— test files containing test markers;missing_ids— markers that reference no known requirement;duplicates— always empty: the same ID may be marked several times in one file, and in several files; the key is kept for report compatibility;non_leaf— markers on an upper-level requirement, normally a warning;warnings— missing or otherwise incomplete scan locations.
For each requirement, determine whether it has credible implementation and test links. Distinguish these cases:
- Existing behavior, missing marker: propose adding the correct marker near the relevant function, class, module, or test.
- New behavior with no requirement: propose a new configured-tier
requirement through
okfreq new, link it withderives_from, and do not repurpose an existing ID. - Requirement with no matching behavior: report
req_not_in_code; do not delete or silently deprecate it. - Behavior delivered by shipped non-code content: when a requirement is
satisfied by packaged prompt, skill, or data files, add that location to the
relevant scope in
config.ymland place the marker in the file itself, using a comment form the format allows. Do not attribute it to unrelated code. - Infrastructure or generated code: record an explicit exemption rationale instead of forcing a misleading marker.
Ask for confirmation before modifying source, tests, authored requirement content, or scope mappings. Add markers in comments appropriate for the language and keep them close to the behavior they identify.
Tier-specific authoring contract
When an approved gap requires okfreq new, preserve the distinct generated
formats instead of applying one generic requirement template:
- StRS — stakeholder intent: provide one stakeholder-observable
SHALLstatement as--descriptionand the stakeholder's underlying outcome as--user-need. Use the frontmatter title as the first heading. CompleteNormative behavior,User Need, andRationale and constraints. Do not add SwRS scenarios, verification notes, or implementation markers to an StRS. Add a direct validation-test marker only for a real stakeholder test, as required by the configured mode. - SwRS — software behavior: provide one observable, bounded
SHALLresponse as--descriptionand at least one valid StRS parent with--derives-from. Complete nominal and boundary/failure GIVEN-WHEN-THEN scenarios plus objective verification notes. Do not add aUser Needor stakeholder-constraints section to an SwRS.
Treat every angle-bracket item emitted by the scaffold as an explicit authoring
gap. Replace it with evidence-based content or leave it visible and report the
requirement as incomplete; never delete a placeholder merely to silence prose
validation. Use the generated frontmatter as-is: user_need belongs to StRS,
while annotation exemption intent belongs to SwRS.
Phase 5 — Update generated coverage safely
After markers are reviewed, preview generated updates:
okfreq update-coverage . --check
okfreq update-coverage . --diff
okfreq update-coverage .
The command may update only fields owned by okfreq: reverse derivation and
coverage fields. Verify that bodies, comments, quotes, IDs, UUIDs, unknown
properties, authored derivations, dependencies, and verification criteria are
unchanged. If a generated update would overwrite external ownership, stop and
report the conflict.
After reviewed requirement changes, run okfreq lint <bundle> --diff, then
okfreq lint <bundle> to refresh tier/scope navigation. Keep authored text
outside generated blocks. Append a dated summary to <bundle>/tiers/log.md
with affected IDs, rationale, decisions and real validation evidence; never
regenerate the log or invent entries for a no-op pass.
Phase 6 — Lifecycle and verification audit
Treat draft, proposed, approved, deprecated, and superseded as distinct.
An approved requirement needs configured verification information and successful
structural validation; a marker alone is insufficient. It also records its
owner's agreement (approved_by, approved_on) on a tier and scope whose
approval_lock is true; report a gap, never fill these fields yourself during an
audit. Implemented drafts are reported as candidates for proposed; the change
itself follows the user's decision. Lifecycle changes are
explicit and confirmed:
okfreq archive REQUIREMENT-ID --yes
okfreq supersede OLD-ID REPLACEMENT-ID [REPLACEMENT-ID...] --yes
Archive never deletes. Supersession requires at least one real replacement
target and records them all in the superseded_by list. A draft
that was never published may be discarded with okfreq retire ID --yes, which
records the ID in retired_ids so the number is never reused; do not delete
requirement files by hand. Do not
mutate lifecycle state merely because prose, coverage, or indexes changed.
Phase 6b — Simplify and restructure
Measure whether the bundle has grown too fine or repetitive for the local guideline's granularity rule: several SwRS that are scenarios of one behaviour, the same rule repeated per feature, near-duplicates across scopes, or SwRS that describe internals rather than observable behaviour. Report the counts with example IDs and a proposed mapping from old to new requirements.
Restructuring (merging, superseding or archiving requirements) changes the
contract: do it only after the user approves the proposed mapping. Without
approval, report the proposal and stop this phase. Never delete a published
requirement; supersede or archive it. Use okfreq retire only for drafts that
were never published.
Phase 7 — Reports and final validation
Generate separate metrics rather than a composite score:
Write generated reports to the project's dist/ directory, never into the
requirements bundle or tiers/:
okfreq generate-report <bundle> --output-json <project>/dist/requirements-report.json \
--output-summary-md <project>/dist/requirements-report.md
Report at least:
- schema and structural health;
- hierarchy and graph errors;
- implementation marker coverage;
- test marker coverage;
- missing, duplicate, and non-leaf references;
- lifecycle counts;
- unresolved discrepancies and exemptions.
Run the project-prescribed preflight after all approved changes. At minimum,
run okfreq validate --prose, okfreq lint --prose, and the normal project
tests. Prose findings remain advisory, but unresolved scaffold placeholders must
be reported as authoring gaps.
Final report
Return a concise summary containing:
- baseline errors and warnings;
- requirements inspected and discrepancies by category;
- markers added or proposed in source and tests;
- generated fields updated and preview commands used;
- lifecycle changes explicitly confirmed;
- files changed and files intentionally preserved;
- validation and test commands with results; and
- unresolved questions requiring human decisions.
Do not claim that traceability is complete when evidence is missing or tests did not run successfully.
04 同仓库更多 Skills
Local tooling guide
Documents nested YAML and list metadata for the editor preview.
writing-for-markdown-okf-schema-studio
Write or generate a Markdown document (implementation plan, report, design note, README, spec, runbook) that renders well in Markdown OKF Schema Studio, the VS Code Markdown preview. Use when asked to write, draft or generate a .md file for Markdown OKF Schema Studio, to make a document look good in it, or to choose diagrams, charts, cards, tabs or admonitions for it.
okfreq
Understand, set up, author, implement, and maintain an okfreq requirements base that connects stakeholder intent to observable software behavior, source code, tests, and traceability reports. Use when the user mentions okfreq, living requirements, StRS or SwRS authoring, requirement derivation, implementation or test markers, requirement coverage, or requirements lifecycle; route explicit brownfield audits to okfreq-gardening.
markdown-studio-exploratory-qa
This skill runs exploratory QA campaigns for Markdown OKF-Schema Studio when requested.
markdown-studio-exploratory-qa-claude
This skill should be used when asked to run, resume, or re-validate an exploratory QA campaign on the Markdown OKF-Schema Studio VS Code extension in a real VS Code window (real mouse and keyboard through CDP), and to write one bug sheet per finding under .agents/changes/3-requests/. A Foreman picks charters from a coverage map and the PRs merged since the last campaign, hands groups of charters to QA Driver sub-agents, and each Driver runs charter agents that drive their own window with scenario files and automatic checks. It ships the driver, scenario engine, no-op sweep, a read-only spy extension, synthetic fixtures, a use-case catalogue, and the harness pitfalls learned in previous campaigns.
change-requests-factory
A 4 layers software factory able to chains and parallelize Change Requests implementation