@dombaras/agent-harness 0.1.0 → 0.1.1
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/LICENSE +21 -0
- package/README.md +48 -13
- package/bin/agent-harness.js +272 -68
- package/package.json +7 -2
- package/templates/.agents/AGENTS.md +93 -91
- package/templates/.agents/memory/domain-map.md +2 -2
- package/templates/.agents/memory/history.md +7 -0
- package/templates/.agents/memory/model-routing.md +22 -6
- package/templates/.agents/memory/stack-versions.md +25 -2
- package/templates/.agents/rules/00-operating.md +29 -85
- package/templates/.agents/skills/data-engineer/SKILL.md +2 -2
- package/templates/.agents/skills/devops-engineer/SKILL.md +1 -1
- package/templates/.agents/skills/diagnostics-expert/SKILL.md +8 -9
- package/templates/.agents/skills/handoff/SKILL.md +2 -2
- package/templates/.agents/skills/mobile-engineer/SKILL.md +2 -2
- package/templates/.agents/skills/product-manager/SKILL.md +8 -8
- package/templates/.agents/skills/qa-architect/SKILL.md +5 -0
- package/templates/.agents/skills/security-engineer/SKILL.md +5 -5
- package/templates/.agents/skills/system-architect/SKILL.md +4 -4
- package/templates/.opencode/agents/data-engineer.md +1 -0
- package/templates/.opencode/agents/devops-engineer.md +1 -0
- package/templates/.opencode/agents/diagnostics-expert.md +2 -0
- package/templates/.opencode/agents/frontend-engineer.md +1 -0
- package/templates/.opencode/agents/handoff.md +5 -0
- package/templates/.opencode/agents/mobile-engineer.md +1 -0
- package/templates/.opencode/agents/planner.md +6 -0
- package/templates/.opencode/agents/product-manager.md +4 -0
- package/templates/.opencode/agents/qa-architect.md +4 -0
- package/templates/.opencode/agents/qa-runner.md +2 -0
- package/templates/.opencode/agents/security-engineer.md +1 -0
- package/templates/.opencode/agents/system-architect.md +1 -0
- package/templates/.opencode/agents/ui-designer.md +1 -0
- package/templates/AGENTS.md +6 -13
- package/templates/opencode.json +2 -1
- package/templates/scripts/qa/check-qa-scripts.js +75 -0
|
@@ -1,103 +1,105 @@
|
|
|
1
1
|
# Project Rules & Operating Guidelines
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
- **Zero-Speculation Rule**: NEVER guess, hypothesize without evidence, or assume the root cause of an error, performance lag, or system behavior. Speculation is strictly forbidden across all personas and workflow stages.
|
|
5
|
-
- **Evidence-First Engineering**: Every diagnostic conclusion, bug fix, architectural decision, and feature enhancement MUST be grounded in observable facts: live server logs, telemetry traces (`/api/debug/logs`, `scratch/mobile-debug.log`), database records (`ExternalServiceLog`, Prisma queries), or verified runtime execution.
|
|
6
|
-
- **Mandatory Telemetry Before Fixes**: If logs or telemetry are absent or insufficient to isolate the root cause, you MUST FIRST add structured logging/instrumentation, execute or have the user reproduce, inspect the resulting log file, and ONLY THEN implement the solution based on the captured data.
|
|
7
|
-
- **Authentic Runtime Execution**: NEVER substitute real application runtime calls with ad-hoc external test scripts that might bypass actual configurations, environment variables, middleware, or request pipelines. Always test and verify behavior using the actual APIs and functions the application uses.
|
|
8
|
-
- **Scientific Progression Gate**: A fix is NEVER complete until live logs or automated runtime tests explicitly demonstrate the bug is eliminated and that the failure mode no longer occurs in real runtime conditions.
|
|
3
|
+
The canonical rulebook. The always-loaded summary is `.agents/rules/00-operating.md`.
|
|
9
4
|
|
|
10
|
-
##
|
|
11
|
-
|
|
5
|
+
## 1. Fact-Based, Zero-Guessing SDLC
|
|
6
|
+
|
|
7
|
+
- **Zero-Speculation Rule**: NEVER guess, hypothesize without evidence, or assume the root cause of an error, performance lag, or system behavior. Speculation is forbidden across all personas and workflow stages.
|
|
8
|
+
- **Evidence-First Engineering**: Every diagnostic conclusion, fix, architectural decision, and enhancement MUST be grounded in observable facts: live server logs, telemetry traces, database records, or verified runtime execution. Know the project's debug/log endpoints — they are (or should be) recorded in `.agents/memory/locations.md`.
|
|
9
|
+
- **Mandatory Telemetry Before Fixes**: If logs or telemetry are absent or insufficient, FIRST add structured instrumentation, execute or have the user reproduce, inspect the captured output, and ONLY THEN implement based on that data.
|
|
10
|
+
- **Authentic Runtime Execution**: Never substitute real runtime calls with ad-hoc scripts that bypass actual config, env vars, middleware, or request pipelines. Verify through the real APIs/functions the app uses.
|
|
11
|
+
- **Scientific Progression Gate**: A fix is not complete until live logs or automated runtime tests demonstrate the failure mode no longer occurs in real runtime conditions.
|
|
12
|
+
|
|
13
|
+
## 2. Dynamic Data & Business-Logic Integrity
|
|
14
|
+
|
|
15
|
+
- **No Hardcoded Mock Lists**: Never create hardcoded lists (fake records, mock reviews, static fallback arrays) without explicit user approval. Prefer dynamic queries and database-backed settings.
|
|
12
16
|
|
|
13
17
|
## 3. UI, Mobile Ergonomics & RTL Support
|
|
14
|
-
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- **Reference pattern** (use this exact structure in every async action handler):
|
|
23
|
-
```typescript
|
|
24
|
-
try {
|
|
25
|
-
await api.someAction(userId, ...args);
|
|
26
|
-
await Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
|
|
27
|
-
await refreshSync();
|
|
28
|
-
} catch (err: any) {
|
|
29
|
-
await Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error);
|
|
30
|
-
setActionError(err?.message || t('errors.genericRetry'));
|
|
31
|
-
// Error banner auto-renders via actionError state
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
- **Cross-Screen Consistency Rule**: Whenever you implement a UX pattern in one screen (error handling shape, haptic feedback, loading skeleton, animation style, empty state CTA), you MUST:
|
|
35
|
-
1. Grep for all other screens that have analogous patterns (e.g., all `catch` blocks, all `isLoading` states, all empty-list branches).
|
|
36
|
-
2. Apply the same pattern globally if it's missing or inconsistent.
|
|
37
|
-
3. If the scope is too large for the current session, explicitly log it as a deferred item in the handoff with the exact files and patterns that need alignment.
|
|
38
|
-
- **The "Fix One, Fix All" mandate**: A local fix applied to one screen but not others is a regression-in-waiting. If you fix an error handler in `transactions.tsx`, check `shelf.tsx`, `index.tsx`, `discover.tsx`, `community.tsx`, and `scan.tsx` for the same issue.
|
|
39
|
-
- **Bidirectional & RTL Support**:
|
|
40
|
-
- Always use logical Tailwind / CSS properties (`ps-*`, `pe-*`, `ms-*`, `me-*`, `text-start`, `text-end`) instead of physical ones (`pl-*`, `pr-*`, `ml-*`, `mr-*`, `left-*`, `right-*`).
|
|
41
|
-
- In React Native RTL mode, use inverted horizontal lists (`inverted={isRTL}`) or direction-aware flex layouts so items begin on the right in Hebrew and left in English.
|
|
42
|
-
- Pass dynamic `dir={isRTL ? "rtl" : "ltr"}` to all Radix UI and shadcn primitives.
|
|
43
|
-
- **Physical Paradigm Alignment & Legacy Pruning Rule**:
|
|
44
|
-
- Whenever introducing or refactoring a flow, model, or paradigm (e.g. async drop-off vs in-person handoff, neighbor trust vs stranger marketplace), you MUST explicitly audit existing steps and PRUNE legacy mechanisms that create contradictory friction with the new flow. Never bolt new features on top of obsolete verification steps without removing what they replace.
|
|
45
|
-
- Every transaction or physical interaction flow MUST be traced step-by-step through a literal physical walkthrough from both actors' perspectives to ensure zero unnecessary friction gates (such as PINs, redundant codes, or mandatory face-to-face requirements).
|
|
18
|
+
|
|
19
|
+
- **Zero Native Popups**: Never use `Alert.alert()`, `alert()`, `confirm()`, or `prompt()`. Use inline toasts, bottom sheets, inline state transitions, or haptics.
|
|
20
|
+
- **Progressive Hydration & Cold-Start**: Never render empty states while waiting on async auth/sync. Hydrate from local cache so the UI renders immediately.
|
|
21
|
+
- **The 5 Essential UI States**: Every screen/list component must handle Ideal, Empty (with CTA), Loading (skeleton), Error (retry), and Partial/single-item states.
|
|
22
|
+
- **Error-Handling Contract (Mobile)**: Every `catch` block in a native screen must (1) fire an error haptic, (2) set a user-visible error state that renders inline — never `console.warn` alone, and (3) provide a retry or dismissal path. Follow the reference pattern in `.agents/skills/mobile-engineer/SKILL.md`.
|
|
23
|
+
- **Cross-Screen Consistency ("Fix One, Fix All")**: When you implement a UX pattern in one screen, grep for analogous screens and apply it globally; if scope is too large, log a deferred item in the handoff with exact files/patterns. A local-only fix is a regression-in-waiting.
|
|
24
|
+
- **Bidirectional & RTL**: Use logical properties (`ps-*`, `pe-*`, `ms-*`, `me-*`, `text-start`, `text-end`) never physical ones (`pl-*`, `left-*`); use inverted horizontal lists / direction-aware layout in native RTL; pass dynamic `dir` to UI primitives.
|
|
25
|
+
- **Legacy Pruning & Physical Walkthrough**: When introducing a new flow/paradigm, explicitly audit and PRUNE obsolete mechanisms that contradict it — never bolt new steps on top of removed ones. Trace every physical/interaction flow step-by-step from each actor's perspective to eliminate unnecessary friction.
|
|
46
26
|
|
|
47
27
|
## 4. Framework & Backend Architecture
|
|
48
|
-
|
|
49
|
-
- **
|
|
50
|
-
- **
|
|
51
|
-
- **Privacy & Visibility Tiers**: Enforce the project's
|
|
28
|
+
|
|
29
|
+
- **Verify Stack Versions First**: Confirm versions against `.agents/memory/stack-versions.md` before writing framework-specific code. Never assume a newer/older convention.
|
|
30
|
+
- **Stack-Specific Gotchas**: Framework/library gotchas (async route params, strict-typing quirks, ORM generator/config layout, native runtime caveats) live in `.agents/memory/stack-versions.md` — read the relevant section before coding against that layer.
|
|
31
|
+
- **Privacy & Visibility Tiers**: Enforce the project's tier model (`.agents/memory/domain-map.md` §Visibility tiers) across all data-access endpoints.
|
|
52
32
|
|
|
53
33
|
## 5. Token Efficiency & Workflow Discipline
|
|
54
|
-
|
|
55
|
-
- **
|
|
56
|
-
- **
|
|
57
|
-
- **Don't Re-read Unchanged Files**:
|
|
58
|
-
- **Delegate Big Searches**:
|
|
59
|
-
- **Prefer Memory over Re-derivation**: Persist non-obvious facts to `.agents/memory
|
|
60
|
-
- **Locations Map
|
|
61
|
-
- **Subagent & Model Routing (
|
|
62
|
-
- **
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
34
|
+
|
|
35
|
+
- **When NOT to Plan**: No heavy planning docs for simple fixes, CSS/layout tweaks, or single-file changes — execute directly.
|
|
36
|
+
- **Precise File Inspections**: Search first (`grep`), then read targeted line ranges — never whole 800+ line files blind. Batch independent searches/reads in parallel.
|
|
37
|
+
- **Don't Re-read Unchanged Files**: Edit files already in context directly.
|
|
38
|
+
- **Delegate Big Searches**: Use the `explore` subagent for broad multi-file exploration.
|
|
39
|
+
- **Prefer Memory over Re-derivation**: Persist non-obvious facts to `.agents/memory/`; read the relevant memory files before starting.
|
|
40
|
+
- **Locations Map**: Read `.agents/memory/locations.md` first — it is the canonical index of sessions, logs, docs, and data. Never re-hunt for a path.
|
|
41
|
+
- **Step Zero — Subagent & Model Routing (non-negotiable)**: Before touching code, satisfy the dispatch gate (`.agents/rules/00-operating.md` §Step Zero). Personas: `planner`, `frontend-engineer`, `mobile-engineer`, `ui-designer`, `qa-architect`, `qa-runner`, `security-engineer`, `product-manager`, `system-architect`, `diagnostics-expert`, `data-engineer`, `devops-engineer`, `handoff`. Dispatch via the `task` tool — each runs its own `model:`. Do NOT inline persona-owned work on the main model. Read `.agents/memory/model-routing.md` at session start. Dispatch independent subagents in parallel.
|
|
42
|
+
- **Persona map**:
|
|
43
|
+
| Work area | Persona |
|
|
44
|
+
|---|---|
|
|
45
|
+
| Task decomposition → dispatch plan | `planner` |
|
|
46
|
+
| Web app (React/Next.js/Tailwind/shadcn) | `frontend-engineer` |
|
|
47
|
+
| Mobile native (Expo/React Native) | `mobile-engineer` |
|
|
48
|
+
| Design system / tokens / shared components | `ui-designer` |
|
|
49
|
+
| QA strategy (risk + tier + progression tests) | `qa-architect` |
|
|
50
|
+
| QA execution (run tiers, data cleanup) | `qa-runner` |
|
|
51
|
+
| DB schema / data model / tenancy / sync | `system-architect` |
|
|
52
|
+
| Auth, secrets, input validation, deps | `security-engineer` |
|
|
53
|
+
| Error / performance / API debugging | `diagnostics-expert` |
|
|
54
|
+
| Features, gamification, product journeys | `product-manager` |
|
|
55
|
+
| Data ingestion / entity resolution | `data-engineer` |
|
|
56
|
+
| Deployment / cron / secrets / build+release | `devops-engineer` |
|
|
57
|
+
| Session wrap-up / handoff | `handoff` |
|
|
58
|
+
- **Waivers** (the only way to skip a persona): a persona may be skipped only when (a) the change is fully covered by an automated gate on push or in the QA tiers, AND (b) the skip is pre-audited in `.agents/memory/` with a cited pointer. Log every waiver as `waived: <persona>` with `reason: <gate|pointer>`.
|
|
59
|
+
- **Dispatch failure ladder** (never silent): retry once (resume the same `task_id`); if it still fails, do the work inline and log `degraded: <persona> model: <reason>`; never silently skip.
|
|
60
|
+
- **Synchronous Terminal Commands**: Prefer sync one-shot commands (build/test/lint) that return inline, over background servers/watchers.
|
|
61
|
+
- **No Output Bloat**: Never paste large files/diffs into chat; apply edits with the edit tool, never print a code block of a change.
|
|
62
|
+
- **Right-Size the QA Tier**: Never run the full regression suite for a CSS/copy tweak.
|
|
63
|
+
|
|
64
|
+
## 6. Smart Tiered Testing & Progression Protocol
|
|
65
|
+
|
|
66
|
+
- Never run heavy regression suites blindly for small changes.
|
|
67
|
+
- Split QA personas: `qa-architect` (thinks — inspects the diff, audits gaps, selects the minimal tier, authors progression tests) vs `qa-runner` (does — executes the chosen tier, reports pass/fail verbatim). The thinker never runs; the doer never designs.
|
|
68
|
+
- **Static ≠ Runtime rule**: never declare UI/mobile/API changes verified from static typing alone — execute a real runtime path.
|
|
69
|
+
- **Tiers** (commands are **project-provided** — the target project must define them; the harness ships only `test:dispatch` and `test:governance`):
|
|
70
|
+
| Tier | Scope | Command |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| 1 | UI/CSS/mobile/copy | `npm run test:quick` |
|
|
73
|
+
| 2 | Routes / page layout | `npm run test:routes` |
|
|
74
|
+
| 3 | API / ORM / transactions | `npm run test:api` |
|
|
75
|
+
| 4 | Data ingestion | the project's data E2E script |
|
|
76
|
+
| 5 | Major release / breaking refactor | `npm run test:verify` |
|
|
77
|
+
| 6 | Security / deps | `npm run test:security` |
|
|
78
|
+
- **Progression Workflow**: for new routes/endpoints/states, (1) author a dedicated assertion path, (2) run the targeted progression test, (3) graduate it into the permanent regression suite.
|
|
79
|
+
|
|
80
|
+
## 7. Definition of Done & Continuous Backup
|
|
81
|
+
|
|
82
|
+
Every completed task passes this gate, in order:
|
|
83
|
+
|
|
84
|
+
0. **Feature Completeness Gate**:
|
|
85
|
+
- [ ] 5 UI states handled on every affected screen (list them).
|
|
86
|
+
- [ ] No `catch` blocks that only `console.warn` without user-facing feedback.
|
|
87
|
+
- [ ] Haptic/feedback consistency for every user-initiated action.
|
|
88
|
+
- [ ] RTL traced if layout touched; logical properties used.
|
|
89
|
+
- [ ] Cross-screen audit if a new UX pattern was introduced.
|
|
90
|
+
- [ ] No modified file over ~500 lines without extracting components.
|
|
91
|
+
1. **QA tier** — `qa-architect` picks the tier (and authors progression tests); `qa-runner` executes and makes it pass (§6).
|
|
92
|
+
2. **Security check** — apply `security-engineer` when the change touches data/auth/input/secrets/deps.
|
|
93
|
+
3. **Commit** — concise `feat:` / `fix:` / `refactor:` message.
|
|
93
94
|
4. **Push** — `git push origin main`.
|
|
94
|
-
- **Mechanical floor**: a
|
|
95
|
-
- **Lean permissions**: grant only the narrowest `git`/`gh` action needed;
|
|
96
|
-
- Git may not be on PATH in the default shell
|
|
95
|
+
- **Mechanical floor**: a pre-push hook should run `npm run test:quick` (project-provided; the harness does not install git hooks).
|
|
96
|
+
- **Lean permissions**: grant only the narrowest `git`/`gh` action needed; escalate only after a command has actually failed.
|
|
97
|
+
- Git may not be on PATH in the default shell — use the full path (`.agents/memory/locations.md`).
|
|
97
98
|
|
|
98
99
|
## 8. Session & Traceability Discipline
|
|
99
|
-
|
|
100
|
-
- **
|
|
101
|
-
- **
|
|
102
|
-
- **
|
|
103
|
-
- **
|
|
100
|
+
|
|
101
|
+
- **One session = one coherent task**; keep a short checklist as the single source of truth.
|
|
102
|
+
- **Planned vs. Shipped**: at session end, record a "planned → shipped → deferred" delta so aspirational docs are never mistaken for reality. Always verify against live code and schema.
|
|
103
|
+
- **Dispatch Log (mandatory)**: every wrap-up opens with `subagent → model → shipped/deferred`. An empty log is non-compliant.
|
|
104
|
+
- **Persist Continuity**: use the `handoff` skill to update `.agents/memory/handoff.md`. Project history lives in `.agents/memory/history.md`; stack facts in `.agents/memory/stack-versions.md`.
|
|
105
|
+
- **Pointers Map Hygiene**: record every created/discovered/changed important location (session archives, scratch scripts, logs, docs, DB targets, env files) in `.agents/memory/locations.md`.
|
|
@@ -24,6 +24,6 @@ _TODO: name and outline the domain's central lifecycle/state machine._
|
|
|
24
24
|
<!-- user progression tiers and activity badges -->
|
|
25
25
|
_TODO: define user tiers and rewards._
|
|
26
26
|
|
|
27
|
-
##
|
|
28
|
-
<!-- ID formats
|
|
27
|
+
## Identifiers & acronyms
|
|
28
|
+
<!-- ID formats, domain-specific terms -->
|
|
29
29
|
_TODO: list identifier patterns and glossary terms._
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Project history
|
|
2
|
+
|
|
3
|
+
Durable, non-obvious project facts that don't belong in the session handoff.
|
|
4
|
+
Append one line per milestone/finding with a date; keep it a pointer index, not
|
|
5
|
+
a spec (code and the DB schema are the source of truth).
|
|
6
|
+
|
|
7
|
+
- <YYYY-MM-DD> <fact / decision / gotcha, with file or commit ref>
|
|
@@ -19,6 +19,20 @@ model). Change it only by editing `.opencode/agents/<name>.md` `model:` — the
|
|
|
19
19
|
`model:` label in `.agents/skills/*/SKILL.md` is informational only and does NOT
|
|
20
20
|
route models.
|
|
21
21
|
|
|
22
|
+
## Per-persona enforcement
|
|
23
|
+
|
|
24
|
+
In addition to `model:`, agent files carry mechanical guardrails in their
|
|
25
|
+
frontmatter:
|
|
26
|
+
|
|
27
|
+
- **Thinkers** (`planner`, `product-manager`) have `permission: { edit: deny, bash: deny }`.
|
|
28
|
+
- **`qa-architect`** has `permission: { bash: deny }` (authors tests, never runs).
|
|
29
|
+
- **`handoff`** has `permission: { bash: deny }`.
|
|
30
|
+
- **Deterministic personas** (`planner`, `qa-architect`, `qa-runner`, `handoff`,
|
|
31
|
+
`diagnostics-expert`) pin `temperature: 0.1`.
|
|
32
|
+
- **`steps:`** caps iterations per persona (cost ceiling).
|
|
33
|
+
- **`planner` / `handoff`** are `hidden: true` (orchestration-only, not in the
|
|
34
|
+
`@` menu).
|
|
35
|
+
|
|
22
36
|
## Subagent output contract
|
|
23
37
|
|
|
24
38
|
Every subagent must return a single final message with, in order:
|
|
@@ -33,14 +47,16 @@ Every subagent must return a single final message with, in order:
|
|
|
33
47
|
2. Degrade inline on the main model and log `degraded: <persona> model: <reason>`.
|
|
34
48
|
3. Never silently skip or re-scope — only waive via the explicit waiver path.
|
|
35
49
|
|
|
36
|
-
##
|
|
50
|
+
## Gates
|
|
37
51
|
|
|
38
|
-
`scripts/qa/check-dispatch-config.js` verifies model
|
|
39
|
-
and the output-contract marker.
|
|
52
|
+
- `npm run test:dispatch` — `scripts/qa/check-dispatch-config.js` verifies model
|
|
53
|
+
pins, persona↔skill parity, and the output-contract marker.
|
|
54
|
+
- `npm run test:governance` — `scripts/qa/governance.js` enforces the wrap-up
|
|
55
|
+
dispatch log.
|
|
56
|
+
- `scripts/qa/check-qa-scripts.js` — verifies the DoD-referenced QA tier scripts
|
|
57
|
+
(project-provided) are wired into `package.json`.
|
|
40
58
|
|
|
41
|
-
|
|
42
|
-
npm run test:dispatch
|
|
43
|
-
```
|
|
59
|
+
Run `test:dispatch` after editing any agent/skill path.
|
|
44
60
|
|
|
45
61
|
## Gotchas
|
|
46
62
|
|
|
@@ -3,10 +3,33 @@
|
|
|
3
3
|
Confirmed framework / runtime versions. Verify against `package.json` and
|
|
4
4
|
`mobile/package.json` before trusting this file.
|
|
5
5
|
|
|
6
|
-
_TODO: record web framework, styling, ORM, mobile SDK/native, and key libraries with versions._
|
|
7
|
-
|
|
8
6
|
- **Web**:
|
|
9
7
|
- **Styling**:
|
|
10
8
|
- **ORM / DB**:
|
|
11
9
|
- **Mobile**:
|
|
12
10
|
- **Key native libs**:
|
|
11
|
+
|
|
12
|
+
## Web gotchas
|
|
13
|
+
|
|
14
|
+
Record framework/library gotchas that bite during builds. Seed with any that
|
|
15
|
+
apply to your stack; prune the rest.
|
|
16
|
+
|
|
17
|
+
- **Async route params (App Router)**: dynamic route params in `page.tsx` /
|
|
18
|
+
`route.ts` are Promises — always `const { id } = await params;`.
|
|
19
|
+
- **Framer Motion typing**: import the `Variants` type explicitly to avoid
|
|
20
|
+
strict-TS build failures.
|
|
21
|
+
|
|
22
|
+
## ORM / DB gotchas
|
|
23
|
+
|
|
24
|
+
- **Generator & config layout**: a recent ORM major renamed the client generator
|
|
25
|
+
and moved config out of `schema.prisma` (e.g. a `prisma.config.ts`). Confirm the
|
|
26
|
+
exact generator name and datasource location before editing the schema.
|
|
27
|
+
- Record migrate + generate commands here once confirmed.
|
|
28
|
+
|
|
29
|
+
## Mobile gotchas
|
|
30
|
+
|
|
31
|
+
- **css-interop freeze race**: on `shadow-*` / `opacity-*` / `#NN` color
|
|
32
|
+
shorthand in Expo Go — prefer inline styles for animated/opacity properties.
|
|
33
|
+
- **Expo Go vs dev build**: remote push notifications require an `eas` dev build
|
|
34
|
+
(Expo Go cannot receive them).
|
|
35
|
+
- Record any other native/runtime caveats discovered during sessions here.
|
|
@@ -1,85 +1,29 @@
|
|
|
1
|
-
# {{PROJECT_NAME}} Operating Rules
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
| QA execution (run tiers, catalog E2E, data cleanup) | `qa-runner` |
|
|
31
|
-
| DB schema / data model / tenancy / sync protocol | `system-architect` |
|
|
32
|
-
| Auth, secrets, input validation, external services, deps | `security-engineer` |
|
|
33
|
-
| Error / performance / API debugging | `diagnostics-expert` |
|
|
34
|
-
| Features, gamification, product journeys | `product-manager` |
|
|
35
|
-
| Data/catalog ingestion / entity resolution | `data-engineer` |
|
|
36
|
-
| Deployment / cron / secrets / build & release | `devops-engineer` |
|
|
37
|
-
| Session wrap-up / handoff | `handoff` |
|
|
38
|
-
|
|
39
|
-
Every session wrap-up MUST open with a **dispatch log** — `subagent → model → shipped/deferred`. An empty log is a non-compliant session.
|
|
40
|
-
|
|
41
|
-
## 1. Fact-Based, Zero-Guessing SDLC — Evidence Over Speculation
|
|
42
|
-
- NEVER speculate, guess, or assume the root cause of an error or system behavior across any persona.
|
|
43
|
-
- Inspect live logs, telemetry (debug-log endpoints, mobile debug logs), structured telemetry records (e.g. `ExternalServiceLog`), or database state before proposing fixes.
|
|
44
|
-
- If logs/telemetry are insufficient, FIRST add structured instrumentation, run it, reproduce, capture actual data, and base the fix exclusively on observed facts.
|
|
45
|
-
- Verify against the real application runtime — never ad-hoc scripts that bypass real config/middleware.
|
|
46
|
-
|
|
47
|
-
## 2. Data & business-logic integrity
|
|
48
|
-
- NEVER create hardcoded mock lists or fake data (records, reviews, fallback arrays) without explicit approval.
|
|
49
|
-
- Prefer dynamic database queries and database-backed `SystemSetting` values.
|
|
50
|
-
|
|
51
|
-
## 3. UI, mobile ergonomics, RTL & flow alignment
|
|
52
|
-
- NEVER use `Alert.alert()`, `alert()`, `confirm()`, or `prompt()`. Use toasts, bottom sheets, or inline states.
|
|
53
|
-
- Hydrate from local cache (AsyncStorage / SQLite) so the UI never renders blank loading states.
|
|
54
|
-
- Handle the 5 UI states: ideal, empty (with CTA), loading, error (with retry), partial/single-item.
|
|
55
|
-
- Use logical CSS/props (`ps-*`, `ms-*`, `text-start`), never physical (`pl-*`, `left-*`).
|
|
56
|
-
- In React Native RTL, use inverted horizontal lists and direction-aware flex.
|
|
57
|
-
- **Legacy Pruning & Physical Roleplay Rule**: When refactoring or introducing a new flow/paradigm (e.g. async drop-off vs in-person handoff), ALWAYS audit and prune contradictory legacy friction steps (e.g. PINs, redundant codes) and roleplay the physical real-world user journey step-by-step.
|
|
58
|
-
|
|
59
|
-
## 4. Stack — verify versions first
|
|
60
|
-
- Never assume framework versions from memory. Read `.agents/memory/stack-versions.md` (the project-specific version manifest) before writing framework code.
|
|
61
|
-
- Read the relevant framework guide shipped in `node_modules/<framework>/dist/docs/` (if present) before writing against it; heed deprecation notices.
|
|
62
|
-
- Framework-specific gotchas (e.g. async route params, strict typing) live in the `frontend-engineer` / `mobile-engineer` skills.
|
|
63
|
-
|
|
64
|
-
## 5. Token & workflow discipline
|
|
65
|
-
- No heavy planning docs for simple fixes.
|
|
66
|
-
- Search before reading; use targeted line reads; batch independent searches/reads.
|
|
67
|
-
- Delegate broad searches; persist non-obvious facts to `.agents/memory/`.
|
|
68
|
-
- **Subagent & model routing**: Satisfy the **Step Zero dispatch gate** (top of this file) before touching any code. Read `.agents/memory/model-routing.md` at session start for the persona→concrete-model tiers. Do NOT inline persona-owned work in the main conversation; load a persona via the `skill` tool only for instruction-only context.
|
|
69
|
-
|
|
70
|
-
## 6. Testing — right-sized QA tier & Static ≠ Runtime rule
|
|
71
|
-
- Never declare code verified based solely on static typing (`tsc`); always execute runtime component or API pathways.
|
|
72
|
-
- Tier 1: `npm run test:quick` (Types + Translations + Mobile Headless Render Smoke in ~3s) · Tier 2: `npm run test:routes` · Tier 3: `npm run test:api` · Tier 5: `npm run test:verify` · Tier 6: `npm run test:security`.
|
|
73
|
-
- Audit testing gaps per subsystem and graduate progression tests into the permanent regression suite.
|
|
74
|
-
|
|
75
|
-
## 7. Definition of Done
|
|
76
|
-
1. Run the right-sized QA tier and make it pass.
|
|
77
|
-
2. Apply the security lens when the change touches data, auth, input, or secrets.
|
|
78
|
-
3. Commit with a concise `feat:` / `fix:` / `refactor:` message.
|
|
79
|
-
4. Push to `main` (the pre-push hook runs `npm run test:quick`).
|
|
80
|
-
|
|
81
|
-
## 8. Session discipline
|
|
82
|
-
- One session = one coherent task.
|
|
83
|
-
- At the end, record a planned → shipped → deferred delta (see `.agents/skills/handoff/SKILL.md`).
|
|
84
|
-
- Every wrap-up MUST open with the **dispatch log** (`subagent → model → shipped/deferred`). Empty log = non-compliant session.
|
|
85
|
-
- Read `.agents/memory/locations.md` at session start (canonical map of sessions, logs, docs, data). Update it at session end with any new/changed locations (external session archives, scratch scripts, log files, DB targets), so each front-end's data stays discoverable.
|
|
1
|
+
# {{PROJECT_NAME}} Operating Rules (summary)
|
|
2
|
+
|
|
3
|
+
Always in effect. Full detail lives in `.agents/AGENTS.md`; read it before non-trivial work.
|
|
4
|
+
|
|
5
|
+
## Step Zero — subagent dispatch gate (non-negotiable)
|
|
6
|
+
|
|
7
|
+
Before reading or editing any file for a task, dispatch the relevant personas via the `task` tool — each runs on its own `model:` (`.opencode/agents/<name>.md`). Dispatch independent subagents in parallel; serialize only on dependencies. Keep only coordination/mechanical work (reads, git, commits) on the main model.
|
|
8
|
+
|
|
9
|
+
- Persona map, waivers, and the dispatch-failure ladder: `.agents/AGENTS.md` §5 and `.agents/memory/model-routing.md`.
|
|
10
|
+
- Every subagent returns the output contract (`Result` → `Evidence` → `Deferred & risks`).
|
|
11
|
+
- Wrap up with a **dispatch log** (`subagent → model → shipped/deferred`) in `.agents/memory/handoff.md`.
|
|
12
|
+
|
|
13
|
+
## Non-negotiable laws
|
|
14
|
+
|
|
15
|
+
1. **Zero speculation** — base every fix/decision on observed logs, telemetry, or DB state; instrument first if evidence is missing.
|
|
16
|
+
2. **No hardcoded mocks/fallback data** — prefer dynamic queries and database-backed settings.
|
|
17
|
+
3. **5 UI states** (ideal/empty/loading/error/partial), user-visible errors (never `console.warn`-only), and RTL-safe logical props.
|
|
18
|
+
4. **Verify stack versions** before writing framework code (`.agents/memory/stack-versions.md`).
|
|
19
|
+
5. **Token discipline** — search before read, targeted reads, batch reads, don't re-read unchanged files, right-size QA.
|
|
20
|
+
6. **Static ≠ runtime** — never declare verified from `tsc` alone; execute a real runtime/API path.
|
|
21
|
+
7. **Commit** with `feat:`/`fix:`/`refactor:` then push to main.
|
|
22
|
+
|
|
23
|
+
## Definition of Done
|
|
24
|
+
|
|
25
|
+
Right-sized QA tier → security lens (if the change touches data/auth/input/secrets) → commit → push.
|
|
26
|
+
|
|
27
|
+
## Session checklist
|
|
28
|
+
|
|
29
|
+
Start: read `.agents/memory/locations.md` + `.agents/memory/model-routing.md`. End: record the dispatch log and update the handoff memory.
|
|
@@ -19,8 +19,8 @@ You own catalog/data ingestion, entity resolution, and external service integrat
|
|
|
19
19
|
## Scope
|
|
20
20
|
|
|
21
21
|
- Ingest from your project's external sources (see `.agents/memory/domain-map.md` §External sources) and map them into the canonical entity chain (see §Entity model).
|
|
22
|
-
- Entity resolution / dedup heuristics (canonical-vs-
|
|
23
|
-
- External-service telemetry via
|
|
22
|
+
- Entity resolution / dedup heuristics (canonical-vs-derived matching, cross-source reconciliation).
|
|
23
|
+
- External-service telemetry via the project's structured log (`.agents/memory/domain-map.md` §External sources): status, latency, rate-limit, auth errors.
|
|
24
24
|
|
|
25
25
|
## Rules
|
|
26
26
|
|
|
@@ -16,7 +16,7 @@ You own deployment, scheduling, secrets, and build/release pipelines — not app
|
|
|
16
16
|
|
|
17
17
|
## Scope
|
|
18
18
|
|
|
19
|
-
- **Cron / scheduling**: the project's hosting cron config (e.g.
|
|
19
|
+
- **Cron / scheduling**: the project's hosting cron config (e.g. a provider `crons` block; the provider typically sends a cron secret as an `Authorization: Bearer` header and never follows redirects; verify the plan's run-frequency cap).
|
|
20
20
|
- **Env & secrets**: `.env` (gitignored) / `.env.example` (tracked). Never commit a real secret; document the variable in `.env.example`.
|
|
21
21
|
- **Deployment**: the project's hosting config (build settings, `maxDuration`, etc.) — see `.agents/memory/locations.md` for the canonical deploy targets.
|
|
22
22
|
- **Mobile releases**: `eas build`, TestFlight, Play internal track.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: diagnostics-expert
|
|
3
|
-
description: Use when debugging errors, performance regressions, or API anomalies — log-first investigation,
|
|
3
|
+
description: Use when debugging errors, performance regressions, or API anomalies — log-first investigation, telemetry, cold-start profiling, authentic reproduction.
|
|
4
4
|
model: reasoning
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -12,9 +12,9 @@ You are a Site Reliability & Diagnostics Engineer. You solve bugs, race conditio
|
|
|
12
12
|
|
|
13
13
|
### 1. Zero Guessing & Log-First Rule
|
|
14
14
|
- **Never guess root causes**.
|
|
15
|
-
- Always inspect the live server output, client telemetry (
|
|
15
|
+
- Always inspect the live server output, client telemetry, and the project's structured external-service log (see `.agents/memory/domain-map.md` §External sources and `.agents/memory/locations.md` for log paths) before forming a hypothesis:
|
|
16
16
|
```ts
|
|
17
|
-
// Inspect external
|
|
17
|
+
// Inspect the project's structured external-service / telemetry log
|
|
18
18
|
const logs = await prisma.externalServiceLog.findMany({
|
|
19
19
|
orderBy: { createdAt: 'desc' },
|
|
20
20
|
take: 10
|
|
@@ -24,20 +24,19 @@ You are a Site Reliability & Diagnostics Engineer. You solve bugs, race conditio
|
|
|
24
24
|
|
|
25
25
|
### 2. Missing Logs? Instrument First
|
|
26
26
|
- If existing logs do not pinpoint why an API returned an unexpected response or why a client UI stalled:
|
|
27
|
-
1. Add structured telemetry
|
|
28
|
-
2. For mobile issues,
|
|
27
|
+
1. Add structured telemetry via the project's logger (e.g. `logDebug(tag, payload)` or `console.log('[DEBUG_TAG]', { ... })`).
|
|
28
|
+
2. For mobile issues, use the project's device-log collector (`.agents/memory/locations.md`) to capture traces.
|
|
29
29
|
3. Execute the operation (or ask the user to reproduce) and inspect the captured log file.
|
|
30
30
|
4. Formulate the fix solely from the concrete failure point observed in the telemetry.
|
|
31
31
|
|
|
32
32
|
### 3. Authentic API & Client Reproduction
|
|
33
33
|
- Never write ad-hoc external test scripts that execute standalone HTTP fetch requests bypassing auth context, cookies, or headers.
|
|
34
|
-
- Always execute operations through the actual application functions (e.g. `api.sync(userId)`, `api.
|
|
34
|
+
- Always execute operations through the actual application functions (e.g. `api.sync(userId)`, `api.search(query)`).
|
|
35
35
|
|
|
36
36
|
### 4. Performance & Cold-Start Profiling
|
|
37
37
|
- Measure the time taken across each layer:
|
|
38
|
-
1. Local storage read (
|
|
38
|
+
1. Local storage read (cache/AsyncStorage/SQLite).
|
|
39
39
|
2. Network round-trip (`fetch` duration).
|
|
40
|
-
3. Database query resolution (
|
|
40
|
+
3. Database query resolution (ORM).
|
|
41
41
|
4. React rendering & layout calculation.
|
|
42
42
|
- Eliminate duplicate API calls on component mount by using memoized hydration listeners or local caches.
|
|
43
|
-
|
|
@@ -15,8 +15,8 @@ You are the session continuity keeper. When the user asks to save progress or wr
|
|
|
15
15
|
- **Planned**: what was intended.
|
|
16
16
|
- **Shipped**: what was actually implemented/verified (cite files + commit hash).
|
|
17
17
|
- **Deferred**: what was consciously left out, with a one-line reason.
|
|
18
|
-
3. **Record it** in `.agents/memory/handoff.md` (tracked file). Keep the file short (last session only). Move any durable notes into `.agents/memory/` topic files (e.g. `stack-versions.md`, `
|
|
19
|
-
4. **Update the locations map** — `.agents/memory/locations.md` is the canonical index of where sessions, logs, docs, and data live. Add/refresh an entry for every external location this session created, discovered, or changed (AI session archives, scratch scripts, log files, DB targets, env files, docs). Each front-end
|
|
18
|
+
3. **Record it** in `.agents/memory/handoff.md` (tracked file). Keep the file short (last session only). Move any durable notes into `.agents/memory/` topic files (e.g. `stack-versions.md`, `history.md`) rather than growing the handoff.
|
|
19
|
+
4. **Update the locations map** — `.agents/memory/locations.md` is the canonical index of where sessions, logs, docs, and data live. Add/refresh an entry for every external location this session created, discovered, or changed (AI session archives, scratch scripts, log files, DB targets, env files, docs). Each agent front-end records its own session paths. If nothing changed, leave it as-is.
|
|
20
20
|
5. **Never invent** — mark anything uncertain as "unverified".
|
|
21
21
|
|
|
22
22
|
## Template
|
|
@@ -18,8 +18,8 @@ You own the native React Native layer and its gotchas — not shared web UI (tha
|
|
|
18
18
|
|
|
19
19
|
- Exact runtime versions live in `.agents/memory/stack-versions.md` (Expo SDK, React Native, React, expo-router, nativewind, reanimated, worklets). Verify before writing.
|
|
20
20
|
- `newArchEnabled` defaults may be `false` for the Expo Go runtime — do not assume Fabric.
|
|
21
|
-
- css-interop can have a JS-thread freeze race on `shadow-*`/`opacity-*`/`#NN` color shorthand in Expo Go —
|
|
22
|
-
- Read `.agents/memory/
|
|
21
|
+
- css-interop can have a JS-thread freeze race on `shadow-*`/`opacity-*`/`#NN` color shorthand in Expo Go — see `.agents/memory/stack-versions.md` (§Mobile gotchas); prefer inline styles for animated/opacity properties.
|
|
22
|
+
- Read `.agents/memory/stack-versions.md` before starting.
|
|
23
23
|
|
|
24
24
|
## Rules
|
|
25
25
|
|