@miller-tech/uap 1.40.1 → 1.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/bin/cli.js +17 -0
- package/dist/bin/cli.js.map +1 -1
- package/dist/cli/deliver-defaults.d.ts +23 -0
- package/dist/cli/deliver-defaults.d.ts.map +1 -0
- package/dist/cli/deliver-defaults.js +121 -0
- package/dist/cli/deliver-defaults.js.map +1 -0
- package/dist/cli/hooks.d.ts.map +1 -1
- package/dist/cli/hooks.js +50 -2
- package/dist/cli/hooks.js.map +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +29 -0
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/react.d.ts +25 -0
- package/dist/cli/react.d.ts.map +1 -0
- package/dist/cli/react.js +59 -0
- package/dist/cli/react.js.map +1 -0
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +19 -0
- package/dist/cli/setup.js.map +1 -1
- package/dist/coordination/reactor.d.ts +38 -0
- package/dist/coordination/reactor.d.ts.map +1 -0
- package/dist/coordination/reactor.js +124 -0
- package/dist/coordination/reactor.js.map +1 -0
- package/dist/mcp-router/server.d.ts +2 -1
- package/dist/mcp-router/server.d.ts.map +1 -1
- package/dist/mcp-router/server.js +5 -2
- package/dist/mcp-router/server.js.map +1 -1
- package/dist/mcp-router/tools/react.d.ts +58 -0
- package/dist/mcp-router/tools/react.d.ts.map +1 -0
- package/dist/mcp-router/tools/react.js +57 -0
- package/dist/mcp-router/tools/react.js.map +1 -0
- package/dist/memory/model-router.d.ts +1 -1
- package/dist/memory/model-router.d.ts.map +1 -1
- package/dist/memory/model-router.js +27 -1
- package/dist/memory/model-router.js.map +1 -1
- package/dist/models/openai-compat-client.d.ts.map +1 -1
- package/dist/models/openai-compat-client.js +5 -0
- package/dist/models/openai-compat-client.js.map +1 -1
- package/dist/models/types.d.ts +8 -0
- package/dist/models/types.d.ts.map +1 -1
- package/dist/models/types.js +22 -0
- package/dist/models/types.js.map +1 -1
- package/dist/policies/policy-tools.d.ts +7 -0
- package/dist/policies/policy-tools.d.ts.map +1 -1
- package/dist/policies/policy-tools.js +24 -2
- package/dist/policies/policy-tools.js.map +1 -1
- package/dist/types/config.d.ts +12 -0
- package/dist/types/config.d.ts.map +1 -1
- package/docs/design/UAP_REACTOR.md +170 -0
- package/package.json +3 -1
- package/src/policies/enforcers/7ebbc721-7540-4e9f-879a-770e0213a09b_architecture_review.py +101 -0
- package/src/policies/enforcers/__pycache__/_common.cpython-312.pyc +0 -0
- package/src/policies/enforcers/_common.py +100 -0
- package/src/policies/enforcers/artifact_hygiene.py +52 -0
- package/src/policies/enforcers/cluster_routing.py +63 -0
- package/src/policies/enforcers/codebase_read_before_plan.py +52 -0
- package/src/policies/enforcers/coord_overlap.py +81 -0
- package/src/policies/enforcers/delivery_enforcement.py +97 -0
- package/src/policies/enforcers/doc_live_over_report.py +50 -0
- package/src/policies/enforcers/expert_review_required.py +135 -0
- package/src/policies/enforcers/iac_parity.py +53 -0
- package/src/policies/enforcers/mcp_router_first.py +37 -0
- package/src/policies/enforcers/memory_before_plan.py +61 -0
- package/src/policies/enforcers/parallel_reads.py +50 -0
- package/src/policies/enforcers/rtk_wrap.py +44 -0
- package/src/policies/enforcers/schema_diff_gate.py +80 -0
- package/src/policies/enforcers/session_memory_write.py +52 -0
- package/src/policies/enforcers/task_required.py +131 -0
- package/src/policies/enforcers/test_gate.py +58 -0
- package/src/policies/enforcers/validate_plan_before_build.py +75 -0
- package/src/policies/enforcers/worktree_required.py +57 -0
- package/src/policies/schemas/policies/architecture-review.md +51 -0
- package/src/policies/schemas/policies/artifact-hygiene.md +29 -0
- package/src/policies/schemas/policies/cluster-routing.md +31 -0
- package/src/policies/schemas/policies/codebase-read-before-plan.md +30 -0
- package/src/policies/schemas/policies/coord-overlap.md +24 -0
- package/src/policies/schemas/policies/delivery-enforcement.md +45 -0
- package/src/policies/schemas/policies/doc-live-over-report.md +32 -0
- package/src/policies/schemas/policies/expert-review-required.md +60 -0
- package/src/policies/schemas/policies/iac-parity.md +31 -0
- package/src/policies/schemas/policies/mandatory-testing-deployment.md +147 -0
- package/src/policies/schemas/policies/mcp-router-first.md +24 -0
- package/src/policies/schemas/policies/memory-before-plan.md +24 -0
- package/src/policies/schemas/policies/merge-deploy-monitor-verify.md +145 -0
- package/src/policies/schemas/policies/parallel-reads.md +24 -0
- package/src/policies/schemas/policies/rtk-wrap.md +26 -0
- package/src/policies/schemas/policies/schema-diff-gate.md +30 -0
- package/src/policies/schemas/policies/session-memory-write.md +24 -0
- package/src/policies/schemas/policies/task-required.md +49 -0
- package/src/policies/schemas/policies/test-gate.md +24 -0
- package/src/policies/schemas/policies/validate-plan-before-build.md +28 -0
- package/src/policies/schemas/policies/worktree-required.md +28 -0
- package/templates/hooks/uap-policy-gate.sh +5 -0
- package/templates/hooks/uap-reactor-prompt.sh +44 -0
- package/templates/hooks/uap-schema-post.sh +26 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# architecture-review
|
|
2
|
+
|
|
3
|
+
**Category**: quality
|
|
4
|
+
**Level**: REQUIRED
|
|
5
|
+
**Enforcement Stage**: review
|
|
6
|
+
**Tags**: uap, architecture, review, adr, enforcement
|
|
7
|
+
|
|
8
|
+
## Rule
|
|
9
|
+
|
|
10
|
+
When a PR-ready / merge operation is attempted and the diff vs. upstream touches
|
|
11
|
+
architecturally significant paths, the change MUST be accompanied by either an
|
|
12
|
+
ADR or an active waiver. Qualifying ("trigger") paths:
|
|
13
|
+
|
|
14
|
+
- `src/types/**`
|
|
15
|
+
- `**/schemas/**`
|
|
16
|
+
- `src/index.ts`
|
|
17
|
+
- `docs/architecture/**` (excluding `docs/architecture/adr/`)
|
|
18
|
+
- `src/coordination/capability-router.ts`, `src/coordination/pattern-router.ts`
|
|
19
|
+
|
|
20
|
+
The requirement is satisfied by either:
|
|
21
|
+
|
|
22
|
+
- an ADR under `docs/architecture/adr/*.md` added or modified in the same diff, or
|
|
23
|
+
- an active waiver `policies/waivers/*architecture-review*.md`.
|
|
24
|
+
|
|
25
|
+
Otherwise the ship/merge op is blocked.
|
|
26
|
+
|
|
27
|
+
## Why
|
|
28
|
+
|
|
29
|
+
This policy backs the `architect-reviewer` droid's stated authority. The
|
|
30
|
+
enforcer already existed and ran, but had **no policy document** describing it —
|
|
31
|
+
agents and reviewers had no canonical reference for when architecture review is
|
|
32
|
+
required or how to satisfy it. Significant decisions (public types, schemas,
|
|
33
|
+
top-level exports, routing logic) carry high blast radius and cost of reversal;
|
|
34
|
+
requiring an ADR (or an explicit waiver) ensures they are recorded and reviewed
|
|
35
|
+
rather than slipping through in an unrelated change.
|
|
36
|
+
|
|
37
|
+
## Enforcement
|
|
38
|
+
|
|
39
|
+
Python enforcer `architecture_review.py` fires on PR-ready/merge operations,
|
|
40
|
+
computes `git diff --name-only origin/master...HEAD` (falling back to
|
|
41
|
+
`origin/main`), matches the trigger paths, and blocks unless an ADR is present
|
|
42
|
+
in the diff or a matching waiver exists.
|
|
43
|
+
|
|
44
|
+
Fail-open: if the upstream diff cannot be computed, the operation is allowed.
|
|
45
|
+
Waivers are granted by `compliance-officer`.
|
|
46
|
+
|
|
47
|
+
```rules
|
|
48
|
+
- title: "Architecturally significant diffs require an ADR or waiver before merge"
|
|
49
|
+
keywords: [merge, pr-ready, gh pr create, signoff, ready-for-review, src/types, schemas, src/index.ts]
|
|
50
|
+
antiPatterns: [no-adr, unreviewed-architecture, skip-architecture-review]
|
|
51
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# artifact-hygiene
|
|
2
|
+
|
|
3
|
+
**Category**: quality
|
|
4
|
+
**Level**: REQUIRED
|
|
5
|
+
**Enforcement Stage**: pre-exec
|
|
6
|
+
**Tags**: git, hygiene, artifacts
|
|
7
|
+
|
|
8
|
+
## Rule
|
|
9
|
+
|
|
10
|
+
Binary artifacts (`*.png`, `*.jpg`, `*.pdf`, `*.zip`, `*.tar.gz`, `*.db`, `*.sqlite*`) MUST NOT be committed outside:
|
|
11
|
+
|
|
12
|
+
- `docs/**`
|
|
13
|
+
- `tests/**/__screenshots__/**`
|
|
14
|
+
- `apps/**/public/**`, `apps/**/static/**`, `apps/**/assets/**`
|
|
15
|
+
- `agents/data/memory/**` (scoped state)
|
|
16
|
+
|
|
17
|
+
## Why
|
|
18
|
+
|
|
19
|
+
Repo root currently has 80+ loose audit PNGs, screenshots, and stale DBs — bloats the repo, confuses reviewers, breaks shallow clones. Keeping artifacts in curated subdirs preserves git performance.
|
|
20
|
+
|
|
21
|
+
## Enforcement
|
|
22
|
+
|
|
23
|
+
Python enforcer `artifact_hygiene.py` inspects `git status` / new Write targets and rejects blocked paths.
|
|
24
|
+
|
|
25
|
+
```rules
|
|
26
|
+
- title: "Binary artifacts belong in curated dirs"
|
|
27
|
+
keywords: [write, create-file, commit, git-add]
|
|
28
|
+
antiPatterns: [.png, .jpg, .zip, .tar.gz, .sqlite]
|
|
29
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# cluster-routing
|
|
2
|
+
|
|
3
|
+
**Category**: infrastructure
|
|
4
|
+
**Level**: REQUIRED
|
|
5
|
+
**Enforcement Stage**: pre-exec
|
|
6
|
+
**Tags**: kubernetes, istio, multi-cluster, iac
|
|
7
|
+
|
|
8
|
+
## Rule
|
|
9
|
+
|
|
10
|
+
`kubectl apply|patch|create|edit|delete` and `helm install|upgrade|uninstall` MUST target the cluster context matching the component's domain:
|
|
11
|
+
|
|
12
|
+
- **Observability** (Grafana, Prometheus, OpenObserve, Fluent Bit, ServiceMonitor, alerts, dashboards) → `do-syd1-pay2u-openobserve`
|
|
13
|
+
- **Authentication / Identity** (Zitadel, OIDC, IAM CRDs) → `do-syd1-zitadel`
|
|
14
|
+
- **Everything else** (apps, APIs, CMS, web, ML services, PgDog, Redis, Postgres/CNPG) → `do-syd1-pay2u`
|
|
15
|
+
|
|
16
|
+
## Why
|
|
17
|
+
|
|
18
|
+
AGENTS.md codifies the 3-cluster split. Cross-cluster mistakes cost 10–30 min per rollback plus reconciliation. Cross-cluster traffic MUST use public HTTPS URLs, never cluster-internal DNS.
|
|
19
|
+
|
|
20
|
+
## Enforcement
|
|
21
|
+
|
|
22
|
+
Python enforcer `cluster_routing.py` checks `kubectl config current-context` against the manifest's domain before allowing the command.
|
|
23
|
+
|
|
24
|
+
```rules
|
|
25
|
+
- title: "kubectl context must match component domain"
|
|
26
|
+
keywords: [kubectl, helm, apply, patch, install, upgrade]
|
|
27
|
+
antiPatterns: [wrong-context, cross-cluster-dns]
|
|
28
|
+
- title: "Cross-cluster calls must use public HTTPS"
|
|
29
|
+
keywords: [cross-cluster, service-mesh]
|
|
30
|
+
antiPatterns: [svc.cluster.local, internal-dns]
|
|
31
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# codebase-read-before-plan
|
|
2
|
+
|
|
3
|
+
**Category**: workflow
|
|
4
|
+
**Level**: REQUIRED
|
|
5
|
+
**Enforcement Stage**: pre-exec
|
|
6
|
+
**Tags**: planning, exploration, accuracy
|
|
7
|
+
|
|
8
|
+
## Rule
|
|
9
|
+
|
|
10
|
+
Before emitting any implementation plan (plans with ≥2 steps or touching any code path), the agent MUST have read the relevant existing codebase in the same session:
|
|
11
|
+
|
|
12
|
+
- At least one `Read` of a file in the target service/app, OR
|
|
13
|
+
- At least one `Grep` / `Glob` over the target paths, OR
|
|
14
|
+
- A completed `Agent(subagent_type=Explore)` for the target domain
|
|
15
|
+
|
|
16
|
+
Plans produced without this evidence are rejected.
|
|
17
|
+
|
|
18
|
+
## Why
|
|
19
|
+
|
|
20
|
+
Planning without reading generates drift-prone, hallucinated plans that conflict with existing conventions. User's directive: ground plans in the actual codebase first.
|
|
21
|
+
|
|
22
|
+
## Enforcement
|
|
23
|
+
|
|
24
|
+
Python enforcer `codebase_read_before_plan.py` scans the recent tool-call log for read operations against files within the plan's declared scope; blocks plan emission if none found.
|
|
25
|
+
|
|
26
|
+
```rules
|
|
27
|
+
- title: "Plans must follow codebase reads"
|
|
28
|
+
keywords: [plan, design, propose, architect, implement]
|
|
29
|
+
antiPatterns: [plan-without-read, unread-scope, blind-plan]
|
|
30
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# coord-overlap
|
|
2
|
+
|
|
3
|
+
**Category**: workflow
|
|
4
|
+
**Level**: RECOMMENDED
|
|
5
|
+
**Enforcement Stage**: pre-exec
|
|
6
|
+
**Tags**: agents, coordination, parallelism
|
|
7
|
+
|
|
8
|
+
## Rule
|
|
9
|
+
|
|
10
|
+
Before spawning a second or subsequent Agent/sub-agent that will write files, call `uap coordination check <paths>` to detect overlap with in-flight agents.
|
|
11
|
+
|
|
12
|
+
## Why
|
|
13
|
+
|
|
14
|
+
Multi-harness setup (.claude, .cursor, .opencode, .codex, .forge all present) creates collision risk. Overlap causes lost work and merge pain. `uap coordination check` is already available — unused.
|
|
15
|
+
|
|
16
|
+
## Enforcement
|
|
17
|
+
|
|
18
|
+
Python enforcer `coord_overlap.py` queries `agents/data/coordination/coordination.db` for active reservations on the target paths and blocks if conflicts exist.
|
|
19
|
+
|
|
20
|
+
```rules
|
|
21
|
+
- title: "Parallel agents require overlap check"
|
|
22
|
+
keywords: [agent, spawn, subagent, parallel, delegate]
|
|
23
|
+
antiPatterns: [skip-coord, no-reservation, overlap-ignore]
|
|
24
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# delivery-enforcement
|
|
2
|
+
|
|
3
|
+
**Category**: safety
|
|
4
|
+
**Level**: RECOMMENDED
|
|
5
|
+
**Enforcement Stage**: pre-exec
|
|
6
|
+
**Tags**: uap, delivery, deliver, convergence, enforcement
|
|
7
|
+
|
|
8
|
+
## Rule
|
|
9
|
+
|
|
10
|
+
Substantive coding work SHOULD go through the `uap deliver` convergence loop,
|
|
11
|
+
which drives a model to verified completion against the project's real gates
|
|
12
|
+
(build, type-check, tests) rather than ad-hoc hand edits.
|
|
13
|
+
|
|
14
|
+
The enforcer fires on `Edit` / `Write` / `MultiEdit` operations targeting
|
|
15
|
+
source-code files. It is satisfied when any of the following holds:
|
|
16
|
+
|
|
17
|
+
- the edit runs inside a deliver-driven context (`UAP_DELIVER_ACTIVE=1`),
|
|
18
|
+
- an explicit operator override is set (`UAP_DELIVER_BYPASS=1`),
|
|
19
|
+
- the target is not source code, or is a docs/config/script/policy/test path.
|
|
20
|
+
|
|
21
|
+
Otherwise the policy applies.
|
|
22
|
+
|
|
23
|
+
## Why
|
|
24
|
+
|
|
25
|
+
`uap deliver` exists and is auto-routable (CLI + MCP `deliver` tool), and it
|
|
26
|
+
classifies task complexity to enable the right convergence aids automatically.
|
|
27
|
+
But nothing previously *encouraged or required* coding agents to use it — the
|
|
28
|
+
capability was available, not enforced. This policy closes that gap: it makes
|
|
29
|
+
the expectation explicit and, when a team opts in, enforces it.
|
|
30
|
+
|
|
31
|
+
## Enforcement
|
|
32
|
+
|
|
33
|
+
Python enforcer `delivery_enforcement.py`.
|
|
34
|
+
|
|
35
|
+
**Default mode is ADVISORY** — it always allows the edit and logs a one-line
|
|
36
|
+
nudge toward `uap deliver`. Installing the policy therefore never breaks normal
|
|
37
|
+
editing.
|
|
38
|
+
|
|
39
|
+
**Strict mode is opt-in** via `UAP_ENFORCE_DELIVERY=block`: a direct source
|
|
40
|
+
edit outside a deliver context is then blocked (exit 2) until the work is routed
|
|
41
|
+
through `uap deliver` or `UAP_DELIVER_BYPASS=1` is set.
|
|
42
|
+
|
|
43
|
+
Exempt by construction: non-source files; `docs/`, `scripts/`, `policies/`,
|
|
44
|
+
`src/policies/`, test files (deliver protects those itself); and tooling
|
|
45
|
+
dot-dirs (`.claude/`, `.uap/`, `.worktrees/`, …).
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# doc-live-over-report
|
|
2
|
+
|
|
3
|
+
**Category**: quality
|
|
4
|
+
**Level**: REQUIRED
|
|
5
|
+
**Enforcement Stage**: pre-exec
|
|
6
|
+
**Tags**: docs, hygiene, debt
|
|
7
|
+
|
|
8
|
+
## Rule
|
|
9
|
+
|
|
10
|
+
New files matching these patterns under `infra/**`, `docs/**`, or repo root are BLOCKED:
|
|
11
|
+
|
|
12
|
+
- `*_REPORT.md`
|
|
13
|
+
- `*_COMPLETE.md`
|
|
14
|
+
- `*_SUMMARY.md`
|
|
15
|
+
- `*_FIX_<date>.md`, `*_<YYYY-MM-DD>.md`
|
|
16
|
+
- `*_PLAN.md` (use tasks, not doc files)
|
|
17
|
+
|
|
18
|
+
Agents MUST update canonical README.md / runbooks instead.
|
|
19
|
+
|
|
20
|
+
## Why
|
|
21
|
+
|
|
22
|
+
The repo contains ~30 retrospective markdown reports under `infra/` — they rot, nobody reads them, and they bury live docs. The user's global rule: truth lives in code + canonical docs, not dated reports.
|
|
23
|
+
|
|
24
|
+
## Enforcement
|
|
25
|
+
|
|
26
|
+
Python enforcer `doc_live_over_report.py` inspects the target path of `Write` operations and rejects matching filenames.
|
|
27
|
+
|
|
28
|
+
```rules
|
|
29
|
+
- title: "No dated retrospective doc files"
|
|
30
|
+
keywords: [write, create-file, markdown]
|
|
31
|
+
antiPatterns: [_REPORT.md, _COMPLETE.md, _SUMMARY.md, _PLAN.md, _FIX_]
|
|
32
|
+
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# expert-review-required
|
|
2
|
+
|
|
3
|
+
**Category**: quality
|
|
4
|
+
**Level**: REQUIRED
|
|
5
|
+
**Enforcement Stage**: review
|
|
6
|
+
**Tags**: uap, review, quality, enforcement, parallel-expert-review
|
|
7
|
+
|
|
8
|
+
## Rule
|
|
9
|
+
|
|
10
|
+
A parallel expert review MUST precede shipping a non-trivial change. When no
|
|
11
|
+
review artifact exists for the current branch (or the artifact is stale relative
|
|
12
|
+
to `HEAD`), the enforcer blocks the ship actions:
|
|
13
|
+
|
|
14
|
+
- `git commit`, `git push`
|
|
15
|
+
- `gh pr create`
|
|
16
|
+
- merge / pr-ready / signoff / ready-for-review operations
|
|
17
|
+
|
|
18
|
+
Review artifact: `.uap/reviews/<branch-slug>.json`, written by the
|
|
19
|
+
`parallel-expert-review` skill on consolidation. The slug is an **injective
|
|
20
|
+
percent-encoding** of the branch name (`%`→`%25`, `/`→`%2F`) so distinct refs
|
|
21
|
+
like `feature/foo` and `feature-foo` never collide on one artifact. Recognised
|
|
22
|
+
shape:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{ "branch": "<name>", "head": "<sha>", "verdict": "approve", "reviewers": ["code-quality-reviewer", "security-code-reviewer", "..."] }
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
If the artifact records a `branch` that differs from the current branch, or a
|
|
29
|
+
`head` that differs from the current `HEAD`, the review is rejected (mismatch /
|
|
30
|
+
stale) and the op is blocked until a fresh review is recorded. Including
|
|
31
|
+
`branch` and `head` is strongly recommended so the artifact unambiguously
|
|
32
|
+
identifies what it covers.
|
|
33
|
+
|
|
34
|
+
## Why
|
|
35
|
+
|
|
36
|
+
The `parallel-expert-review` skill (and the `architect-reviewer` droid) claim
|
|
37
|
+
review is "REQUIRED by policy", but no enforcer ever checked that a review
|
|
38
|
+
actually ran — the requirement was advisory and silently skippable. This policy
|
|
39
|
+
makes review a hard, artifact-backed gate: ship actions fail until the review
|
|
40
|
+
fan-out (code-quality, security, performance, documentation, test-coverage) has
|
|
41
|
+
run and its consolidated verdict is recorded for the current HEAD.
|
|
42
|
+
|
|
43
|
+
This is the review analogue of `task-required` and `worktree-required`: convert
|
|
44
|
+
a protocol step that was best-effort into an enforced precondition.
|
|
45
|
+
|
|
46
|
+
## Enforcement
|
|
47
|
+
|
|
48
|
+
Python enforcer `expert_review_required.py` resolves the current branch and
|
|
49
|
+
HEAD via git, then checks `.uap/reviews/<branch-slug>.json` (slug = branch name
|
|
50
|
+
with `/` → `-`). Missing artifact → block; present but `head` mismatch → block
|
|
51
|
+
(stale); present and current → allow.
|
|
52
|
+
|
|
53
|
+
Fail-open: if the branch/HEAD cannot be resolved (detached HEAD, non-git tree),
|
|
54
|
+
the operation is allowed. Override for one-off meta-work: `UAP_NO_REVIEW=1`.
|
|
55
|
+
|
|
56
|
+
```rules
|
|
57
|
+
- title: "A parallel expert review must precede ship"
|
|
58
|
+
keywords: [git commit, git push, gh pr create, merge, pr-ready, signoff, ready-for-review]
|
|
59
|
+
antiPatterns: [no-review, unreviewed-ship, skip-review]
|
|
60
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# iac-parity
|
|
2
|
+
|
|
3
|
+
**Category**: infrastructure
|
|
4
|
+
**Level**: REQUIRED
|
|
5
|
+
**Enforcement Stage**: pre-exec
|
|
6
|
+
**Tags**: terraform, helm, iac, drift, reproducibility
|
|
7
|
+
|
|
8
|
+
## Rule
|
|
9
|
+
|
|
10
|
+
Any live-state change MUST be paired with an IaC change in the same worktree:
|
|
11
|
+
|
|
12
|
+
- `kubectl patch|apply|edit|create|delete` → must also modify `infra/terraform/**`, `infra/helm_charts/**`, or `infra/kubernetes/**`
|
|
13
|
+
- Helm `--set` overrides → must also update `values.yaml`
|
|
14
|
+
- DigitalOcean / cloud console changes are forbidden; use Terraform
|
|
15
|
+
|
|
16
|
+
## Why
|
|
17
|
+
|
|
18
|
+
User's global rule: "always apply state changes to IaC to ensure reproducibility." The repo has ~30 `IAC_PARITY_*`/`DRIFT_ANALYSIS_*` retrospectives — each a drift incident. Catching at author-time eliminates the loop.
|
|
19
|
+
|
|
20
|
+
## Enforcement
|
|
21
|
+
|
|
22
|
+
Python enforcer `iac_parity.py` verifies the worktree has staged/unstaged diffs under the IaC paths when a mutating cluster command is issued.
|
|
23
|
+
|
|
24
|
+
```rules
|
|
25
|
+
- title: "Live state changes require IaC diff"
|
|
26
|
+
keywords: [kubectl, helm, doctl, terraform, aws, gcloud, apply, patch, create, delete, edit]
|
|
27
|
+
antiPatterns: [--force, --no-iac, manual-console]
|
|
28
|
+
- title: "No ad-hoc cloud console changes"
|
|
29
|
+
keywords: [doctl, aws, gcloud, console]
|
|
30
|
+
antiPatterns: [click-ops, manual-edit]
|
|
31
|
+
```
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Policy: Mandatory Testing & Deployment Verification
|
|
2
|
+
|
|
3
|
+
**ID**: `policy-mandatory-testing-deployment`
|
|
4
|
+
**Name**: Mandatory Testing and Deployment Verification
|
|
5
|
+
**Category**: testing
|
|
6
|
+
**Level**: REQUIRED
|
|
7
|
+
**Enforcement Stage**: review
|
|
8
|
+
**Version**: 1.0
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
This policy enforces that all code changes MUST complete testing, deployment verification, and quality checks before a task can be marked as DONE or closed. This prevents incomplete work from being considered finished.
|
|
13
|
+
|
|
14
|
+
## Rules
|
|
15
|
+
|
|
16
|
+
```rules
|
|
17
|
+
- title: "Mandatory Test Creation"
|
|
18
|
+
keywords: ["done", "complete", "finish", "close", "resolve", "merge"]
|
|
19
|
+
antiPatterns: ["no new tests", "zero tests added", "skip test creation", "tests not written"]
|
|
20
|
+
|
|
21
|
+
- title: "Testing Requirement"
|
|
22
|
+
keywords: ["done", "complete", "finish", "close", "resolve", "merge"]
|
|
23
|
+
antiPatterns: ["incomplete test", "no test coverage", "untested code", "skip test"]
|
|
24
|
+
|
|
25
|
+
- title: "Version Bump Required"
|
|
26
|
+
keywords: ["done", "complete", "finish", "close", "resolve", "merge", "push"]
|
|
27
|
+
antiPatterns: ["manual version edit", "no version bump", "skip version", "version not bumped"]
|
|
28
|
+
|
|
29
|
+
- title: "Deployment Verification Required"
|
|
30
|
+
keywords: ["deploy", "production", "release", "push", "merge"]
|
|
31
|
+
antiPatterns: ["unverified deployment", "no smoke test", "deployment failed"]
|
|
32
|
+
|
|
33
|
+
- title: "Quality Gate Enforcement"
|
|
34
|
+
keywords: ["quality", "lint", "type-check", "coverage", "security"]
|
|
35
|
+
antiPatterns: ["disable lint", "bypass type check", "low coverage", "security warning"]
|
|
36
|
+
|
|
37
|
+
- title: "Documentation Requirement"
|
|
38
|
+
keywords: ["document", "readme", "api", "changelog", "migration"]
|
|
39
|
+
antiPatterns: ["no documentation", "missing changelog", "undocumented change"]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Enforcement Behavior
|
|
43
|
+
|
|
44
|
+
### When Triggered
|
|
45
|
+
|
|
46
|
+
This policy is enforced during the **review stage** when:
|
|
47
|
+
|
|
48
|
+
- Task status is being changed to DONE, COMPLETE, or CLOSED
|
|
49
|
+
- Pull request is being merged
|
|
50
|
+
- Deployment is being finalized
|
|
51
|
+
- Release is being published
|
|
52
|
+
|
|
53
|
+
### Required Actions Before Completion
|
|
54
|
+
|
|
55
|
+
1. **Mandatory Test Creation**
|
|
56
|
+
- At least 2 new test cases MUST be written for every code change
|
|
57
|
+
- Tests must cover the new or changed behavior (not unrelated code)
|
|
58
|
+
- Tests must follow existing patterns: `test/<feature>.test.ts` using vitest (`describe`/`it`/`expect`)
|
|
59
|
+
- Tests must assert correctness (not just "it doesn't throw")
|
|
60
|
+
- Bug fixes: at least one test must reproduce the bug scenario
|
|
61
|
+
- New features: tests must cover the happy path and at least one edge case
|
|
62
|
+
|
|
63
|
+
2. **Testing Verification**
|
|
64
|
+
- All unit tests must pass including the new ones
|
|
65
|
+
- Test coverage maintained or improved (no regression)
|
|
66
|
+
- Integration tests must pass
|
|
67
|
+
- E2E tests must pass for critical paths
|
|
68
|
+
- No new test failures introduced
|
|
69
|
+
|
|
70
|
+
3. **Version Bump**
|
|
71
|
+
- Version must be bumped via `npm run version:patch`, `version:minor`, or `version:major`
|
|
72
|
+
- Manual edits to `package.json` version field are prohibited
|
|
73
|
+
- Commit type determines bump level: fix->patch, feat->minor, breaking->major
|
|
74
|
+
- CHANGELOG.md is updated automatically by the version script
|
|
75
|
+
- Git tag is created automatically
|
|
76
|
+
|
|
77
|
+
4. **Deployment Verification**
|
|
78
|
+
- Deployment to staging/preview environment successful
|
|
79
|
+
- Smoke tests passed in target environment
|
|
80
|
+
- Rollback plan verified (if applicable)
|
|
81
|
+
- No deployment warnings/errors
|
|
82
|
+
|
|
83
|
+
5. **Quality Checks**
|
|
84
|
+
- Linting passes without errors
|
|
85
|
+
- Type checking passes (for TypeScript projects)
|
|
86
|
+
- Security scan shows no critical/high vulnerabilities
|
|
87
|
+
- Performance benchmarks within acceptable range
|
|
88
|
+
|
|
89
|
+
6. **Documentation**
|
|
90
|
+
- Code comments updated for public APIs
|
|
91
|
+
- README.md updated if CLI/tools changed
|
|
92
|
+
- Changelog entry added (automated via version bump script)
|
|
93
|
+
- Breaking changes documented
|
|
94
|
+
|
|
95
|
+
### Verification Checklist
|
|
96
|
+
|
|
97
|
+
Before marking work as DONE, verify:
|
|
98
|
+
|
|
99
|
+
- [ ] At least 2 new tests written for changed code
|
|
100
|
+
- [ ] New tests assert correctness (not just "doesn't throw")
|
|
101
|
+
- [ ] All tests passing (`npm test`)
|
|
102
|
+
- [ ] Test coverage maintained or improved
|
|
103
|
+
- [ ] Code linting passes (`npm run lint`)
|
|
104
|
+
- [ ] Type checking passes (`tsc --noEmit`)
|
|
105
|
+
- [ ] Version bumped via `npm run version:patch/minor/major`
|
|
106
|
+
- [ ] CHANGELOG.md updated (automated via version script)
|
|
107
|
+
- [ ] Git tag created (automated via version script)
|
|
108
|
+
- [ ] Deployment to staging successful (if applicable)
|
|
109
|
+
- [ ] Smoke tests passed in staging (if applicable)
|
|
110
|
+
- [ ] No new security vulnerabilities
|
|
111
|
+
- [ ] Documentation updated
|
|
112
|
+
- [ ] Reviewers approved
|
|
113
|
+
- [ ] No unresolved TODOs or FIXMEs
|
|
114
|
+
|
|
115
|
+
### Anti-Patterns to Avoid
|
|
116
|
+
|
|
117
|
+
❌ **DO NOT** mark tasks as DONE when:
|
|
118
|
+
|
|
119
|
+
- No new tests were written for code changes
|
|
120
|
+
- Tests are failing or skipped
|
|
121
|
+
- Version was not bumped or was bumped manually
|
|
122
|
+
- Deployment hasn't been verified
|
|
123
|
+
- Code quality gates are bypassed
|
|
124
|
+
- Documentation is missing or outdated
|
|
125
|
+
- Critical bugs remain open
|
|
126
|
+
- Security warnings are ignored
|
|
127
|
+
- Rollback plan doesn't exist for breaking changes
|
|
128
|
+
|
|
129
|
+
## Implementation Notes
|
|
130
|
+
|
|
131
|
+
This policy should be enforced by:
|
|
132
|
+
|
|
133
|
+
1. **CI/CD pipelines** - Block merges if tests fail
|
|
134
|
+
2. **Code review tools** - Require passing quality checks
|
|
135
|
+
3. **Task management systems** - Block status changes without verification
|
|
136
|
+
4. **Policy gate system** - Validate before allowing completion commands
|
|
137
|
+
|
|
138
|
+
## Related Policies
|
|
139
|
+
|
|
140
|
+
- `policy-code-quality` - General code quality requirements
|
|
141
|
+
- `policy-security-gate` - Security scanning requirements
|
|
142
|
+
- `policy-deployment-safety` - Deployment safety checks
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
_Last Updated: 2026-03-18_
|
|
147
|
+
_Author: Miller Tech UAP System_
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# mcp-router-first
|
|
2
|
+
|
|
3
|
+
**Category**: custom
|
|
4
|
+
**Level**: RECOMMENDED
|
|
5
|
+
**Enforcement Stage**: pre-exec
|
|
6
|
+
**Tags**: mcp, router, tokens, context
|
|
7
|
+
|
|
8
|
+
## Rule
|
|
9
|
+
|
|
10
|
+
When the session lists MCP tools as deferred (loaded on demand), agents MUST use `ToolSearch` / `uap mcp-router` to pull individual tool schemas on need rather than eagerly loading full MCP tool catalogs.
|
|
11
|
+
|
|
12
|
+
## Why
|
|
13
|
+
|
|
14
|
+
The session has 150+ deferred MCP tools (Playwright, Pay2U API, Terraform, Drive, etc.). Loading the full schema set burns ~30k+ tokens. UAP's MCP Router provides 98% token reduction (per CLI docs).
|
|
15
|
+
|
|
16
|
+
## Enforcement
|
|
17
|
+
|
|
18
|
+
Python enforcer `mcp_router_first.py` blocks bulk-load patterns and requires the specific tool name in the ToolSearch query.
|
|
19
|
+
|
|
20
|
+
```rules
|
|
21
|
+
- title: "Load MCP tools on demand"
|
|
22
|
+
keywords: [mcp, tool-schema, load-tools]
|
|
23
|
+
antiPatterns: [load-all, bulk-load, eager-schema]
|
|
24
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# memory-before-plan
|
|
2
|
+
|
|
3
|
+
**Category**: workflow
|
|
4
|
+
**Level**: REQUIRED
|
|
5
|
+
**Enforcement Stage**: pre-exec
|
|
6
|
+
**Tags**: memory, uap, planning
|
|
7
|
+
|
|
8
|
+
## Rule
|
|
9
|
+
|
|
10
|
+
Before producing any implementation plan that spans 3+ steps or touches 3+ files, the agent MUST have queried `uap memory query <topic>` within the last 5 minutes. The UAP compliance protocol already mandates this; this policy enforces it.
|
|
11
|
+
|
|
12
|
+
## Why
|
|
13
|
+
|
|
14
|
+
Avoids re-deriving context already captured in prior sessions. Reduces duplicate work and keeps guidance coherent across agent runs.
|
|
15
|
+
|
|
16
|
+
## Enforcement
|
|
17
|
+
|
|
18
|
+
Python enforcer `memory_before_plan.py` checks `agents/data/memory/short_term.db` for a recent `uap memory query` action tagged with a relevant topic.
|
|
19
|
+
|
|
20
|
+
```rules
|
|
21
|
+
- title: "Plans must be preceded by memory query"
|
|
22
|
+
keywords: [plan, implement, build, design, architect]
|
|
23
|
+
antiPatterns: [no-memory-check, skip-history]
|
|
24
|
+
```
|