cc-os/openspec/specs/status-checks/spec.md

80 lines
4.1 KiB
Markdown
Raw Permalink Normal View History

# status-checks — in-process check contract + initial checks
## ADDED Requirements
### Requirement: Uniform in-process check contract
Every status check SHALL be a Python function in the os-status plugin with the signature
`check(ctx) -> CheckResult`, where `ctx` provides the project root (or None outside a git
project) and per-project config, and `CheckResult` carries `status` (`ok` | `note` | `warn`)
and `message` (empty for `ok`). Checks SHALL be registered in a single registry list; adding
a check SHALL require only the function and one registry entry.
#### Scenario: Check returns ok
- **WHEN** a registered check finds its precondition satisfied and has no informational output
- **THEN** it returns `status: ok` and contributes no output to the session
#### Scenario: Check failure is isolated
- **WHEN** a registered check raises an exception or exceeds the per-check time budget
- **THEN** the runner records it as `warn` with a generic message naming the check, continues
running the remaining checks, and never blocks or fails the session
### Requirement: ADR system check preserves os-adr behavior
The `adr_system_present` check SHALL reproduce os-adr's SessionStart behavior: in a git
project with `docs/adr/` present it returns `note` with the existing Eval-B-tuned usage-note
wording verbatim; with `docs/adr/` absent it returns `warn` suggesting init/migrate at most
once per day, permanently silenced by `.os-adr/suppress`; outside a git project it returns
`ok`.
#### Scenario: ADR system present
- **WHEN** the session starts in a git project containing `docs/adr/`
- **THEN** the check returns `note` whose message is byte-identical to os-adr's current
PRESENT_NOTE wording
#### Scenario: ADR system absent, not suppressed
- **WHEN** the session starts in a git project without `docs/adr/` and no `.os-adr/suppress`
exists and no suggestion was emitted today
- **THEN** the check returns `warn` naming `/os-adr:init` and `/os-adr:migrate`
#### Scenario: ADR suggestion suppressed
- **WHEN** `.os-adr/suppress` exists in the project
- **THEN** the check returns `ok`
### Requirement: Vault hub-note check
The `vault_hub_note_present` check SHALL determine whether the current project has a hub note
in the SecondBrain vault, preferring an explicit hub slug from per-project config over
inference by `project/<name>` facet tag. Missing hub note in a git project SHALL yield `warn`
naming the corrective action; present SHALL yield `ok` with no context injection.
#### Scenario: Hub note missing
- **WHEN** the session starts in a git project with no matching hub note in the vault
- **THEN** the check returns `warn` telling the user which skill to run to create one
#### Scenario: Hub note present
- **WHEN** a hub note matching the project exists in the vault
- **THEN** the check returns `ok` and injects nothing
### Requirement: Subagent model env-override check
The `subagent_model_env_override` check SHALL return `warn` when `CLAUDE_CODE_SUBAGENT_MODEL`
is set in the process environment or present in the `env` block of `~/.claude/settings.json`,
identifying where it was found; otherwise `ok`. This check SHALL run regardless of whether the
cwd is a git project.
#### Scenario: Override set in settings.json
- **WHEN** `~/.claude/settings.json` contains `CLAUDE_CODE_SUBAGENT_MODEL` in its `env` block
- **THEN** the check returns `warn` naming the variable, its value, and the file it was found in
#### Scenario: No override
- **WHEN** the variable is absent from both the environment and settings.json
- **THEN** the check returns `ok`
### Requirement: os-adr SessionStart hook removed atomically
In the same change that ships the `adr_system_present` check, os-adr's own SessionStart hook
entry SHALL be removed from `plugins/os-adr/hooks/hooks.json`, and the cutover SHALL be
verified against the refreshed plugin cache (not only source), such that exactly one component
emits the ADR status per session.
#### Scenario: No double emission after cutover
- **WHEN** a fresh session starts after `bin/refresh-plugins` with os-status and os-adr both
installed
- **THEN** the ADR usage note or suggestion appears exactly once