Skip to content

Commit b368730

Browse files
SafetyMPSage Hart
andauthored
Cursor/adversarial harness gates (#36)
* feat(harness): two-tier verify contract and stub canary Wire check-stub-canary into verify.sh and declare integration: null with hermetic_stop_only in profile disclosure. * Migrate CorpOS to factory scripts/harness gate contract. Point site.json and site agents at scripts/harness, archive Cursor Harness v4, and keep human wrappers at scripts/. --------- Co-authored-by: Sage Hart <sagehart@MacBookAir.attlocal.net>
1 parent 058e167 commit b368730

25 files changed

Lines changed: 949 additions & 64 deletions
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"schema": "corporate-site-component-contracts/v1",
3+
"origin": {
4+
"namespace": "project",
5+
"origin_id": "site"
6+
},
7+
"shared_components": {
8+
"operations-excellence": {
9+
"authority": "review-only",
10+
"evidence_source": "root-produced-immutable",
11+
"may_approve": false,
12+
"may_delegate": false,
13+
"may_execute_site_commands": false,
14+
"readonly": true
15+
},
16+
"site-delivery": {
17+
"atomic_rework_snapshot_required": true,
18+
"corporate_rework_authority": "user",
19+
"dispatch_owner": "root-orchestrator",
20+
"maximum_delegation_depth": 1,
21+
"workers_may_delegate": false
22+
},
23+
"site-manager": {
24+
"authority": "decompose-only",
25+
"dispatch_owner": "root-orchestrator",
26+
"may_approve": false,
27+
"may_delegate": false,
28+
"readonly": true
29+
},
30+
"site-specialist": {
31+
"authority": "adr-bounded-write",
32+
"dispatch_owner": "root-orchestrator",
33+
"may_approve": false,
34+
"may_delegate": false,
35+
"readonly": false
36+
}
37+
}
38+
}

.corp-harness/site.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"schema": "corporate-site-site/v1",
3+
"site_id": "corpos",
4+
"corporate_program": null,
5+
"corporate_handoff_sha256": null,
6+
"verify_argv": ["./scripts/harness/verify.sh"],
7+
"adversarial_argv": ["./scripts/harness/adversarial.sh"]
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: operations-excellence
3+
description: Defines site gates and SLOs, runs the current oracle, and independently reviews evidence.
4+
model: inherit
5+
readonly: true
6+
---
7+
8+
Run `scripts/harness/verify.sh` against the current revision. Inspect executable evidence rather
9+
than producer claims. Return PASS or FAIL, linked findings, site SLOs, and the recommended
10+
transition. Do not fix failures or weaken gates.

.cursor/agents/site-manager.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: site-manager
3+
description: Decomposes a verified corporate handoff into ADR work and integrates site evidence.
4+
model: inherit
5+
readonly: true
6+
---
7+
8+
Verify the handoff digest, create only consequential ADRs, and dispatch bounded packets to
9+
the root orchestrator. The root launches `site-specialist` in isolated worktrees and
10+
integrates results. Return assignments, evidence requirements, risks, and the recommended
11+
transition; never implement, launch workers, integrate, or self-approve.

.cursor/agents/site-specialist.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: site-specialist
3+
description: Implements one ADR-scoped packet and returns exact command evidence.
4+
model: inherit
5+
readonly: false
6+
---
7+
8+
Stay inside the assigned site root, ADR, and write set. Implement the smallest compliant
9+
change, run the supplied verification command, and return changed paths plus exit codes.
10+
Worker subagents may not delegate further. Do not edit corporate approval state or
11+
approve your own output.

.cursor/rules/site-contract.mdc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
description: Keep site work within the approved corporate handoff and evidence gates
3+
alwaysApply: true
4+
---
5+
6+
For an active site program, read the corporate handoff before editing. Site specialists
7+
implement; operations excellence reviews current evidence. Use isolated workspaces for
8+
independent writers. Do not alter corporate approvals, weaken tests, infer gate success,
9+
or grant user approval.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: site-delivery
3+
description: Delivers an approved corporate handoff through ADR-scoped implementation and independent site verification.
4+
---
5+
6+
# Site delivery
7+
8+
1. Verify the handoff digest.
9+
2. Have the readonly site manager return bounded ADR packets.
10+
3. The root orchestrator launches site specialists in isolated roots.
11+
4. Integrate and run `scripts/harness/verify.sh`.
12+
5. Record `verification_scripts` as site-relative `scripts/harness` (only
13+
`verify.sh` and `adversarial.sh`). Do not bind the whole `scripts/` tree.
14+
6. Ask operations excellence to review fresh evidence.
15+
7. Return failures to the owning ADR; never bypass retries or self-approve.

AGENTS.md

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,18 @@
1-
# AGENTS.md
1+
# Site contract
22

3-
CorpOS harness. Profile: **solo**.
3+
## Gates
44

5-
## Purpose
5+
| Command | Purpose |
6+
| ---------------------------------- | ----------------------------------- |
7+
| `./scripts/harness/verify.sh` | Functional and static acceptance |
8+
| `./scripts/harness/adversarial.sh` | Authorized local adversarial probes |
69

7-
TypeScript multi-agent runtime with policy, approval, and audit control plane. Simulation-first demo; optional live LLM via OpenRouter.
10+
Record `verification_scripts` as the site directory `scripts/harness` (exactly those
11+
two scripts). Optional wrappers may remain at `scripts/verify.sh` /
12+
`scripts/adversarial.sh` for humans; they are outside the digest boundary.
813

9-
## Prerequisites
14+
The corporate handoff fixes scope. The site manager assigns ADRs; site specialists write;
15+
operations excellence reviews current evidence. Work in isolated roots, never edit
16+
corporate approval state, and never self-approve.
1017

11-
- Node.js ≥20 (`package.json` engines)
12-
- `npm install` (builds `better-sqlite3` native module)
13-
14-
## Commands
15-
16-
| Command | Purpose |
17-
| --------------------- | ------------------------------- |
18-
| `./scripts/verify.sh` | Definition of Done |
19-
| `npm install` | Install dependencies |
20-
| `npm run dev` | API + dashboard with hot reload |
21-
| `npm run start` | Run without watch |
22-
| `npm run test` | Vitest suite |
23-
| `npm run typecheck` | `tsc --noEmit` |
24-
| `npm run lint` | ESLint |
25-
| `npm run build` | Compile to `dist/` |
26-
27-
## Layout
28-
29-
| Path | Role |
30-
| ---------------- | --------------------------------------------------------- |
31-
| `src/core/` | Orchestrator, policy, store (SQLite at `data/company.db`) |
32-
| `src/agents/` | Department agents |
33-
| `src/tools/` | Permissioned tool registry |
34-
| `src/api/` | Express REST + WebSocket |
35-
| `src/dashboard/` | Control-plane UI |
36-
37-
## Definition of Done
38-
39-
```bash
40-
npx npm@10.9.2 ci
41-
./scripts/verify.sh
42-
```
43-
44-
## Review focus
45-
46-
Block on P0/P1: policy chokepoint bypass, approval gate skips, secret exposure, broken simulation determinism.
18+
Site id: `corpos`. Prior Cursor Harness v4 is under `_archives/harness-v4/`.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"version": 1,
3+
"hooks": {
4+
"beforeShellExecution": [
5+
{
6+
"command": "python3 .cursor/hooks/guard-shell.py",
7+
"failClosed": false
8+
},
9+
{
10+
"command": "python3 .cursor/hooks/guard-network.py",
11+
"matcher": "curl|wget|scp|nc ",
12+
"failClosed": false
13+
}
14+
],
15+
"beforeMCPExecution": [
16+
{
17+
"command": "python3 .cursor/hooks/guard-mcp.py",
18+
"failClosed": false
19+
}
20+
],
21+
"beforeReadFile": [
22+
{
23+
"command": "python3 .cursor/hooks/protect-secrets.py",
24+
"failClosed": true
25+
}
26+
],
27+
"beforeSubmitPrompt": [
28+
{
29+
"command": "python3 .cursor/hooks/scan-prompt.py",
30+
"failClosed": true
31+
}
32+
],
33+
"stop": [
34+
{
35+
"command": "python3 .cursor/hooks/verify-on-stop.py",
36+
"loop_limit": 3
37+
}
38+
]
39+
}
40+
}

0 commit comments

Comments
 (0)