sense-env-scaffold
Discover repository facts as structured JSON or evaluate a contract with the sense_env.py CLI.
SKILL.mdskills/sense-env-scaffold/SKILL.md
GitHubPurpose
Invoke .github/skills/sense-env-scaffold/scripts/sense_env.py to produce a structured, machine-readable manifest of
the repository environment, or to evaluate sensing assertions defined in a contract
document.
The canonical source lives under skills/sense-env-scaffold/...; any
.<platform>/skills/sense-env-scaffold/... path is a platform projection of that
canonical source.
Trigger / When to use
Use this skill when:
- you need a structured JSON record of environment facts (Python version, Git state, key file presence) before beginning implementation work
- you need to verify that the repository satisfies a set of
sensing-assertionsdefined in ablueprint.mdorretrofit-plan.md - you want a portable, secret-free snapshot of the current environment for handoff or archival purposes
Do not use this skill when:
- the task only needs a single shell command such as
python --versionorgit status - you need deep static analysis, linting, or architecture commentary
- you need to install dependencies, create virtual environments, or start services
- the repository does not have
.github/skills/sense-env-scaffold/scripts/sense_env.pypresent
Inputs
- the run mode:
discovery(fact collection) oracceptance(contract assertion) - optionally, a contract file path containing a
yaml [sensing-assertions]fenced block - optionally, a custom output path for the live manifest
- whether a snapshot export is required (
--snapshotflag)
Process
- Confirm
.github/skills/sense-env-scaffold/scripts/sense_env.pyis present in the skill folder. - Choose the mode:
discoveryfor a harmless fact-collection run; no contract requiredacceptanceto evaluate assertions from a contract file
- Construct the command using the locked CLI contract (see
references/sense-env-cli-contract.md). - Run the command from the repository working directory.
- Read the exit code:
0— success; manifest written10— operational error (I/O failure); check the JSON for details20— acceptance failure; assertions failed; readgapsin the manifest30— contract error; contract file missing or fenced block absent
- If the run succeeds and a snapshot is needed, re-run with
--snapshotor confirm it was included in the original invocation. - Interpret the manifest structure using
references/env-manifest-schema.md.
Examples
- Positive: Run
python3 .github/skills/sense-env-scaffold/scripts/sense_env.py --mode discoveryto collect environment facts before a retrofit; read the resulting.github/env-manifest.jsonto understand what is present. - Negative: Run
python3 .github/skills/sense-env-scaffold/scripts/sense_env.py --mode acceptancewithout a contract file and expect it to succeed — acceptance mode always requires a readable contract with ayaml [sensing-assertions]block; exit30is returned when none is found.
Outputs
.github/env-manifest.json— live manifest with five top-level modules:meta,fingerprint,facts,assertions,gaps.github/env-manifest.snapshot.json— filtered, secret-free snapshot (when--snapshotis used and the run exits0)- non-zero exit code and a JSON manifest describing the failure when errors occur
Boundaries
- Do not modify
.github/skills/sense-env-scaffold/scripts/sense_env.pyor its local runtime package as part of invoking this skill; treat them as fixed prototype tooling. - If related documentation elsewhere uses
.<platform>as an abstract compatibility label, do not copy it into runnable CLI paths; this scaffold's executable defaults remain.github/env-manifest.jsonand.github/env-manifest.snapshot.jsonunless--outputoverrides them. - Do not interpret exit
20as a fatal environment error; it means assertions failed and thegapssection describes what is missing. - Do not promote a snapshot unless the run exited
0; the script enforces this but callers should also respect it. - Do not broaden the assertion kinds beyond the v1 supported subset
(
path_exists,path_type,command_available) without a separate planning topic. - Do not claim this prototype represents a stable repository-wide tool policy.
Validation
Required Checks
- PASS:
.github/skills/sense-env-scaffold/scripts/sense_env.pyis present before any invocation - PASS for discovery mode: no contract file required; proceed directly
- BLOCKED for acceptance mode: contract file must exist and contain a
yaml [sensing-assertions]block; if absent, exit30is expected — do not retry without a valid contract
On Soft Fail
- exit
20is a soft fail, not a fatal error; acceptance assertions failed; readgapsand report what must change - exit
10is an operational error; read the JSON manifest for I/O failure details before retrying - do not promote or share a snapshot unless the run exited
0
Failure Handling
Missing Context
- BLOCKED — if
sense_env.pyis not present in the skill folder, stop and report the missing file before any invocation attempt
Ambiguous Requirement
- if the run mode is not specified, default to
discoveryrather than guessing; do not invokeacceptancewithout explicit intent to evaluate assertions - if the contract file path is provided but the file does not contain a
yaml [sensing-assertions]block, report exit30as expected behavior rather than an error
Execution Limitation
- if exit code
10(operational error) is returned, read the manifest for I/O details and report them; do not retry without understanding the root cause - if exit code
20(assertion failure) is returned, report allgapsfrom the manifest; do not reinterpret the result as a pass - do not broaden assertion kinds or modify
sense_env.pyas part of invoking this skill
Local references
references/env-manifest-schema.md: stable top-level manifest schema, module definitions, gap and assertion record shapes, and snapshot filtering rulesreferences/sense-env-cli-contract.md: CLI synopsis, flag semantics, mode semantics, exit-code table, path-resolution rules, and invocation examplesscripts/sense_env.py: thin CLI entrypoint for discovery and acceptance sensing runsscripts/sense_env_runtime/: local internal package that holds the manifest models, contract parsing, assertion evaluation, snapshot shaping, and run-mode logic used by the CLI entrypoint