project-brain 0.14.0 → 0.16.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.
Files changed (37) hide show
  1. package/README.md +81 -12
  2. package/package.json +10 -6
  3. package/templates/skills/brain-audit/SKILL.md +134 -0
  4. package/templates/skills/brain-audit/references/abuse.md +59 -0
  5. package/templates/skills/brain-audit/references/accessibility.md +55 -0
  6. package/templates/skills/brain-audit/references/ai.md +51 -0
  7. package/templates/skills/brain-audit/references/api.md +47 -0
  8. package/templates/skills/brain-audit/references/backend.md +48 -0
  9. package/templates/skills/brain-audit/references/complexity.md +52 -0
  10. package/templates/skills/brain-audit/references/concurrency.md +60 -0
  11. package/templates/skills/brain-audit/references/consistency.md +59 -0
  12. package/templates/skills/brain-audit/references/contract-drift.md +58 -0
  13. package/templates/skills/brain-audit/references/cost.md +60 -0
  14. package/templates/skills/brain-audit/references/database.md +59 -0
  15. package/templates/skills/brain-audit/references/dependencies-licensing.md +59 -0
  16. package/templates/skills/brain-audit/references/devops.md +61 -0
  17. package/templates/skills/brain-audit/references/documentation.md +56 -0
  18. package/templates/skills/brain-audit/references/failure.md +58 -0
  19. package/templates/skills/brain-audit/references/flow-integrity.md +61 -0
  20. package/templates/skills/brain-audit/references/frontend.md +51 -0
  21. package/templates/skills/brain-audit/references/functional.md +39 -0
  22. package/templates/skills/brain-audit/references/future.md +31 -0
  23. package/templates/skills/brain-audit/references/goal.md +38 -0
  24. package/templates/skills/brain-audit/references/i18n.md +61 -0
  25. package/templates/skills/brain-audit/references/infrastructure.md +62 -0
  26. package/templates/skills/brain-audit/references/mobile.md +58 -0
  27. package/templates/skills/brain-audit/references/observability.md +55 -0
  28. package/templates/skills/brain-audit/references/packaging.md +52 -0
  29. package/templates/skills/brain-audit/references/performance.md +58 -0
  30. package/templates/skills/brain-audit/references/privacy.md +63 -0
  31. package/templates/skills/brain-audit/references/product.md +34 -0
  32. package/templates/skills/brain-audit/references/prompt-spec-gap.md +41 -0
  33. package/templates/skills/brain-audit/references/reachability.md +58 -0
  34. package/templates/skills/brain-audit/references/scalability.md +55 -0
  35. package/templates/skills/brain-audit/references/security.md +75 -0
  36. package/templates/skills/brain-audit/references/testing.md +58 -0
  37. package/templates/skills/brain-audit/references/versioning-compatibility.md +59 -0
@@ -0,0 +1,51 @@
1
+ # Frontend
2
+
3
+ Client-side structure and correctness. Gate: a UI framework was detected.
4
+
5
+ Family B does the wiring work — orphan handlers and the loading/empty/error triad live in `flow-integrity.md`. Do not duplicate them here; cross-reference.
6
+
7
+ ## Component structure
8
+
9
+ - [ ] Components separate what they show from where the data comes from. A component that fetches, transforms, and renders has three reasons to change.
10
+ - [ ] No component is large enough that its responsibilities cannot be named in one sentence. Find the biggest ones via `repo_map`.
11
+ - [ ] Shared UI is shared, not copy-pasted. `search_code` a distinctive class name or string from a component to find its duplicates.
12
+ - [ ] Props are typed, and optional props have defaults at one place rather than at each call site.
13
+
14
+ ## State
15
+
16
+ - [ ] Each piece of state has one owner. State duplicated in two places will diverge.
17
+ - [ ] Server data and UI state are distinguishable. Caching server data in the same store as ephemeral UI flags makes invalidation guesswork.
18
+ - [ ] Derived values are derived, not stored alongside their source.
19
+ - [ ] Global state holds only what genuinely needs to be global. Check `find_callers` on each store selector — a global read by one component is local state in the wrong place.
20
+
21
+ ## Data fetching
22
+
23
+ - [ ] Requests are cancelled or ignored when the component unmounts. Otherwise a late response writes to a dead component.
24
+ - [ ] Nothing fetches in a render path.
25
+ - [ ] Refetch and invalidation rules are explicit. "It updates on reload" is a defect if the user expects it sooner.
26
+ - [ ] Waterfall requests — a fetch whose input comes from a previous fetch's output — are intentional, not accidental.
27
+
28
+ ## Rendering correctness
29
+
30
+ - [ ] List keys are stable identities, not array indices.
31
+ - [ ] Effects declare every dependency they read, and none they do not.
32
+ - [ ] No layout shift from content that arrives late — reserved space or a skeleton.
33
+ - [ ] Forms are controlled consistently; a mix of controlled and uncontrolled inputs in one form is a bug waiting for a reset.
34
+
35
+ ## Assets and bundle
36
+
37
+ - [ ] Images have dimensions and a modern format; nothing ships a 4 MB PNG as a thumbnail.
38
+ - [ ] Large dependencies are justified. Check the manifest against what is actually imported — cross-reference `Dependencies & Licensing`.
39
+ - [ ] Code splitting exists at route boundaries if the app has routes.
40
+ - [ ] Unused assets are reported under `Reachability`, not here.
41
+
42
+ ## Severity guidance
43
+
44
+ | Situation | Severity |
45
+ |---|---|
46
+ | Late response writing to an unmounted component | Medium |
47
+ | Duplicated state that can diverge | Medium |
48
+ | Array index used as a list key over reorderable data | Medium |
49
+ | Fetch inside a render path | High |
50
+ | Effect with a missing dependency it reads | Medium |
51
+ | Copy-pasted shared UI | Low |
@@ -0,0 +1,39 @@
1
+ # Functional
2
+
3
+ Does the software actually do what it claims to do? This module audits behaviour against stated intent — README, docs, specs, tests, and the names the code itself uses.
4
+
5
+ ## Claimed vs. real behaviour
6
+
7
+ - [ ] Every capability the README/docs advertise exists in code. Confirm with `search_code` on the feature's name, then `find_symbol` on what it points at. A documented feature with no implementation is `High`.
8
+ - [ ] Every CLI command, flag, subcommand, or public entry point listed in docs is reachable from the real dispatcher. Confirm with `trace_path` from the entry point to the handler.
9
+ - [ ] The inverse: capabilities that exist in code but appear in no doc. Undocumented ⇒ nobody uses it ⇒ candidate for the Reachability module.
10
+ - [ ] Names do not lie. A function called `validateUser` that only checks non-null, a `cache` that never evicts, a `retry` with one attempt. Naming drift is `Medium` — it misleads every future reader.
11
+
12
+ ## Input handling
13
+
14
+ - [ ] Each public entry point states what it accepts and rejects the rest. Missing validation at a trust boundary escalates to the Security module.
15
+ - [ ] Boundary values are handled: empty string, empty collection, zero, negative, max int, unicode, very long input.
16
+ - [ ] Optional parameters have a defined default, and the default is the safe one.
17
+ - [ ] Malformed input produces an actionable error, not a stack trace and not silence.
18
+
19
+ ## Output correctness
20
+
21
+ - [ ] Return shapes are consistent across the success paths of the same function. A function returning `T | null | undefined | []` for "nothing" has three ways to be wrong at every call site.
22
+ - [ ] Errors are distinguishable from valid empty results. `find_callers` returning `[]` must not mean the same thing as "lookup failed".
23
+ - [ ] Side effects match the name: a function named as a query does not mutate.
24
+
25
+ ## State and idempotency
26
+
27
+ - [ ] Operations advertised as idempotent actually are — running twice produces the same end state. Test it, do not assume it.
28
+ - [ ] Re-entrant / re-run paths (setup, init, sync, migrate) preserve existing user data rather than clobbering it, unless overwrite is the documented contract.
29
+ - [ ] Partial failure leaves recoverable state — no half-written config, no orphaned rows, no lock left held.
30
+
31
+ ## Behavioural gaps
32
+
33
+ - [ ] For each core feature, list what a user would reasonably expect that is absent. Missing cancel, missing undo, missing dry-run, missing list/inspect for something the tool creates.
34
+ - [ ] Every "create" has a matching way to see and remove what was created — or the omission is documented as deliberate.
35
+ - [ ] Configuration that can be set can also be read back and reset.
36
+
37
+ ## Evidence discipline
38
+
39
+ Every finding here cites `file:line`. "This feature seems incomplete" without a line reference is not a finding — it is a hypothesis. Downgrade its confidence and say what you would need to confirm it.
@@ -0,0 +1,31 @@
1
+ # Future
2
+
3
+ What will hurt six months from now? This module is forward-looking, which makes it the easiest place to invent findings. Every item here must point at code that exists today.
4
+
5
+ ## Extension points
6
+
7
+ - [ ] Where the project clearly expects to grow (new providers, new commands, new file types), is adding one a single-file change or a shotgun edit? Use `find_callers` on the dispatcher to count the places a new case must be registered.
8
+ - [ ] Hardcoded lists that will need an entry per future addition — a switch, a `Set` of names, a manual manifest. Not automatically wrong; a hand-maintained list guarded by a parity test is often better than codegen. Flag the ones with no guard.
9
+ - [ ] Interfaces with exactly one implementation. Either the abstraction is speculative, or a second implementation is coming and the seam is real. Say which you think it is.
10
+
11
+ ## Scaling assumptions
12
+
13
+ - [ ] Loops and data structures that assume small N. Find them, then check what actually bounds N — a config value, user input, or nothing.
14
+ - [ ] Anything loaded fully into memory: whole files, whole tables, whole directories. State the input size at which it breaks.
15
+ - [ ] Synchronous work on a path that will eventually be called in a loop.
16
+
17
+ ## Lock-in
18
+
19
+ - [ ] Dependencies on a specific vendor, model, API version, or file format, with no adapter layer. Note the switching cost.
20
+ - [ ] Data formats written to disk with no version field. Migrating them later means guessing.
21
+ - [ ] Persisted state whose schema has no migration path.
22
+
23
+ ## Deprecation debt
24
+
25
+ - [ ] APIs, flags, or config keys kept for backwards compatibility with no removal date and no deprecation warning. They will be kept forever by default.
26
+ - [ ] Duplicated code paths where one is "the old way" — check with `find_callers` whether the old way still has callers. If not, it is dead (report under `Reachability`); if yes, the migration is unfinished.
27
+ - [ ] Pinned dependency versions with a comment explaining a workaround. Verify the workaround is still needed.
28
+
29
+ ## What NOT to report here
30
+
31
+ Speculative refactors, "this could be more generic", and architecture preferences with no concrete future cost. If you cannot name the change that will be painful and the code that makes it painful, it is not a finding — it is taste.
@@ -0,0 +1,38 @@
1
+ # Goal
2
+
3
+ Does the code still serve the goal it was written for? Codebases drift: the goal moves, the code does not, and nobody writes down the divergence. This module surfaces it.
4
+
5
+ ## Stated goal
6
+
7
+ - [ ] Locate the goal as written — README opening, package description, ADRs, design docs. `search_code` the project name; `search_context` for "purpose" or "why".
8
+ - [ ] If two sources state different goals, that contradiction is a `Medium` finding on its own. Pick neither; report both.
9
+ - [ ] If no source states a goal, say so plainly. A project whose purpose exists only in someone's head cannot be onboarded onto.
10
+
11
+ ## Goal vs. architecture
12
+
13
+ - [ ] The architecture serves the stated goal. A local-first tool with a hard cloud dependency, a "simple" tool with a plugin system, a "fast" tool with a synchronous network call on the hot path — each is a goal/structure mismatch.
14
+ - [ ] The highest-PageRank symbols from `repo_map` sit on the goal's critical path. If the center of the call graph is infrastructure rather than the core job, the project may have drifted into building a framework.
15
+ - [ ] Constraints implied by the goal are actually enforced. "Offline-capable" ⇒ find the network calls and check each has a degraded path. "Zero-config" ⇒ count required config keys.
16
+
17
+ ## Goal vs. scope
18
+
19
+ - [ ] Features that serve no stated goal. Not automatically wrong, but each needs a reason — otherwise it is scope that will need maintenance forever.
20
+ - [ ] Goals with no supporting feature. The stated ambition nothing implements. This is usually the more expensive direction.
21
+ - [ ] Abandoned directions: half-built subsystems, feature flags never turned on, TODOs older than the last major refactor. Cross-check with `Reachability`.
22
+
23
+ ## Decision record
24
+
25
+ - [ ] Significant architectural choices have a recorded why — ADR, design doc, or at minimum a comment. An unexplained choice cannot be revisited safely because nobody knows what it was trading against.
26
+ - [ ] Decisions that were reversed are recorded as reversed, not silently overwritten. Otherwise the next person re-litigates a settled question.
27
+ - [ ] Where a decision's rationale has expired (the constraint it optimised for is gone), flag it. That is the highest-value finding in this module.
28
+
29
+ ## Severity guidance
30
+
31
+ | Situation | Severity |
32
+ |---|---|
33
+ | Architecture actively prevents a stated goal | High |
34
+ | Two sources state contradictory goals | Medium |
35
+ | No goal recorded anywhere | Medium |
36
+ | Decision whose rationale has expired | Medium |
37
+ | Feature serving no stated goal | Low |
38
+ | Abandoned direction still in the tree | Low |
@@ -0,0 +1,61 @@
1
+ # i18n
2
+
3
+ Gate: locale files or translation keys were detected.
4
+
5
+ The core of this module is the two-directional key sweep from `reachability.md`, applied to locales. Run both directions — they fail differently, and one of them fails in front of a user.
6
+
7
+ ## Key integrity
8
+
9
+ - [ ] **Keys used in code but missing from a locale file.** The user sees a raw key, or a crash. `search_code` the translation function, extract the keys, diff against each locale. This is `High`.
10
+ - [ ] Keys present in locale files that no call site uses. Dead translation weight, and translators are paying to maintain it.
11
+ - [ ] Every locale has the same key set. A key present in the default locale and missing in another means that locale degrades in production only.
12
+ - [ ] Dynamically constructed keys — `t('errors.' + code)` — cannot be statically verified. Enumerate the possible values and confirm each exists, or flag the construction as unverifiable.
13
+ - [ ] Keys are namespaced consistently, and the namespace scheme is one scheme.
14
+
15
+ ## Untranslated strings
16
+
17
+ - [ ] User-visible strings hardcoded in components instead of going through the translation function. These are invisible until someone switches locale.
18
+ - [ ] Strings in the less-obvious places: error messages, validation text, email templates, notifications, page titles, `aria-label` values, placeholder text, document metadata.
19
+ - [ ] Server-generated user-facing text — it needs the user's locale, not the server's.
20
+
21
+ ## Formatting
22
+
23
+ - [ ] Dates, times, numbers, currencies, and percentages go through locale-aware formatting rather than manual concatenation. `search_code` for hand-built date strings.
24
+ - [ ] Timezone handling is explicit for anything displayed to a user.
25
+ - [ ] Currency carries an explicit currency code, never an assumed one.
26
+ - [ ] Sorting uses locale-aware collation where the list is user-visible.
27
+
28
+ ## Grammar
29
+
30
+ - [ ] Pluralisation uses the framework's plural rules, not `count === 1 ? x : y`. Many languages have more than two plural forms; a binary check is wrong in them by construction.
31
+ - [ ] No sentences assembled from concatenated fragments — word order differs across languages, so the fragments cannot be reordered.
32
+ - [ ] Interpolated values are named placeholders, not positional ones, so translators can reorder them.
33
+ - [ ] Gendered or context-dependent strings have the context available to the translator.
34
+
35
+ ## Layout
36
+
37
+ - [ ] Text expansion is tolerated — translations commonly run 30–50% longer. Fixed-width containers and single-line assumptions break.
38
+ - [ ] Right-to-left layout is handled if any supported locale requires it: logical CSS properties, mirrored icons, correct text direction.
39
+ - [ ] Fonts cover the character sets of every supported locale.
40
+ - [ ] Truncation is by grapheme, not by byte or code unit.
41
+
42
+ ## Process
43
+
44
+ - [ ] Locale detection has a defined precedence and a fallback, and the fallback is complete.
45
+ - [ ] Missing translations fall back to a readable string, never to the raw key or an empty string.
46
+ - [ ] Something keeps locales in sync — a CI check on key parity. Without it, drift is guaranteed. This is the same anti-drift pattern as a manifest parity test.
47
+
48
+ ## Severity guidance
49
+
50
+ | Situation | Severity |
51
+ |---|---|
52
+ | Key used in code but missing from a shipped locale | High |
53
+ | Missing translation renders the raw key to the user | High |
54
+ | Sentences assembled from concatenated fragments | Medium |
55
+ | Binary pluralisation instead of plural rules | Medium |
56
+ | Hardcoded user-visible string bypassing translation | Medium |
57
+ | Manually formatted dates, numbers, or currency | Medium |
58
+ | Locale key sets out of sync with no CI check | Medium |
59
+ | Positional instead of named placeholders | Low |
60
+ | Layout that breaks on text expansion | Low |
61
+ | Unused keys in locale files | Low |
@@ -0,0 +1,62 @@
1
+ # Infrastructure
2
+
3
+ Runtime environment and its definition. Gate: CI/CD, a Dockerfile, or IaC was detected.
4
+
5
+ `DevOps` audits how code becomes an artefact. This module audits where that artefact runs and whether the definition of that place is trustworthy.
6
+
7
+ ## Declared vs. actual
8
+
9
+ - [ ] Infrastructure is in code. Resources created by hand are undocumented, unreviewable, and unreproducible — that gap is the first finding.
10
+ - [ ] State files are remote and locked, not local. A local state file means one machine holds the only truth.
11
+ - [ ] Drift is detectable — something compares declared to actual. Without it, IaC describes intentions rather than reality.
12
+ - [ ] Every environment comes from the same definition with different inputs. Divergent per-environment definitions guarantee "works in staging".
13
+
14
+ ## Configuration
15
+
16
+ - [ ] Every environment variable the application reads is declared in the deployment definition. Cross-reference the used-but-never-declared sweep in `reachability.md` — this is where that check pays off most.
17
+ - [ ] Required config with no value fails at startup, not at first use in production.
18
+ - [ ] Defaults in the definition are safe for production, not convenient for development.
19
+ - [ ] Nothing environment-specific is compiled into the artefact.
20
+
21
+ ## Resource limits
22
+
23
+ - [ ] CPU and memory limits are set. No limit means one process can starve its neighbours; a limit far above observed use wastes money — cross-reference `cost.md`.
24
+ - [ ] Disk is bounded and monitored, especially wherever logs or uploads land.
25
+ - [ ] Connection and file-descriptor limits accommodate the configured pool sizes. A pool larger than the descriptor limit fails under load only.
26
+ - [ ] Autoscaling bounds exist at both ends, and the scale-up signal is the resource that actually saturates.
27
+
28
+ ## Network and access
29
+
30
+ - [ ] Nothing is publicly reachable that does not need to be — databases, caches, admin ports, metrics endpoints.
31
+ - [ ] Ingress rules are specific rather than open ranges. `search_code` the IaC for `0.0.0.0/0`.
32
+ - [ ] Service-to-service access is least-privilege, not a shared broad role.
33
+ - [ ] Credentials are workload identities where available, rather than long-lived static keys.
34
+
35
+ ## Durability
36
+
37
+ - [ ] Backups exist for every stateful resource, and a restore has been performed. An untested backup is not a backup.
38
+ - [ ] Restore time and acceptable data loss are stated, not assumed.
39
+ - [ ] Deletion protection on resources whose loss would be unrecoverable.
40
+ - [ ] Stateful data is not on ephemeral storage.
41
+
42
+ ## Operability
43
+
44
+ - [ ] Someone can reach logs, metrics, and a shell for a running instance without a bespoke procedure. Cross-reference `observability.md`.
45
+ - [ ] Restart, scale, and redeploy are single documented commands.
46
+ - [ ] The definition names an owner. Unowned infrastructure is what still runs three years after the team forgot it.
47
+
48
+ ## Severity guidance
49
+
50
+ | Situation | Severity |
51
+ |---|---|
52
+ | Datastore or admin port publicly reachable | Critical |
53
+ | Long-lived static credentials in the definition | Critical |
54
+ | No backup for a stateful resource | High |
55
+ | Backup exists but restore never tested | High |
56
+ | Stateful data on ephemeral storage | High |
57
+ | Ingress open to `0.0.0.0/0` beyond a public entry point | High |
58
+ | Application env var not declared in the deployment | High |
59
+ | No resource limits set | Medium |
60
+ | Manually created resources absent from IaC | Medium |
61
+ | Local or unlocked state file | Medium |
62
+ | No drift detection | Low |
@@ -0,0 +1,58 @@
1
+ # Mobile
2
+
3
+ Native or cross-platform mobile concerns. Gate: a native mobile project was detected.
4
+
5
+ Mobile amplifies every defect the other modules find: the network is unreliable, the process can die at any moment, and the user cannot read a stack trace. Audit accordingly.
6
+
7
+ ## Lifecycle
8
+
9
+ - [ ] State survives backgrounding. Anything held only in memory is gone when the OS reclaims the process.
10
+ - [ ] In-flight work is paused or cancelled on background, and resumed or abandoned deliberately on foreground.
11
+ - [ ] Deep links and cold starts reach the same state as in-app navigation. A screen reachable only through a parent that initialises it will crash on deep link.
12
+ - [ ] Rotation and configuration changes do not lose user input.
13
+
14
+ ## Network reality
15
+
16
+ - [ ] Every request assumes it can fail, be slow, or arrive twice. Offline is a state, not an error.
17
+ - [ ] Retries are bounded and backed off. An unbounded retry on a metered connection is a cost defect too — cross-reference `Cost`.
18
+ - [ ] Large payloads are paginated or streamed. Mobile memory limits are lower than the developer's machine.
19
+ - [ ] Uploads survive interruption, or explicitly restart.
20
+
21
+ ## Permissions
22
+
23
+ - [ ] Every permission requested is actually used. `search_code` the manifest/plist entries and confirm each has a call site — an unused permission is a store-review risk and a trust cost.
24
+ - [ ] Denial is handled, including permanent denial, with a path forward rather than a dead end.
25
+ - [ ] Permissions are requested at the moment of need with context, not all at launch.
26
+
27
+ ## Storage and secrets
28
+
29
+ - [ ] Tokens and credentials use the platform keystore, never plain preferences or a local file. `search_code` for the preference API alongside token-like keys.
30
+ - [ ] Cached user data is clearable, and logout actually clears it.
31
+ - [ ] Local database migrations exist and are tested against the previous version's schema.
32
+
33
+ ## Platform integration
34
+
35
+ - [ ] Both platforms are covered wherever the code branches on OS. A branch handling one platform and falling through on the other is a half-wired feature — cross-reference `flow-integrity.md`.
36
+ - [ ] Minimum OS version claimed by the manifest matches the APIs actually used.
37
+ - [ ] Safe areas, notches, and system bars are respected.
38
+ - [ ] Back-navigation follows platform convention, including hardware back.
39
+
40
+ ## Performance on real devices
41
+
42
+ - [ ] No work on the main/UI thread that can block a frame — parsing, image decoding, disk, crypto.
43
+ - [ ] Lists are recycled/virtualised, not fully materialised.
44
+ - [ ] Images are downsampled to display size before decoding.
45
+ - [ ] Battery and wake-lock usage is bounded; background jobs have a stated budget.
46
+
47
+ ## Severity guidance
48
+
49
+ | Situation | Severity |
50
+ |---|---|
51
+ | Credential in plain local storage | Critical |
52
+ | Crash on deep link or cold start | High |
53
+ | State lost on backgrounding | High |
54
+ | Unbounded retry loop | High |
55
+ | Permission requested but never used | Medium |
56
+ | Permanent-denial path dead-ends | Medium |
57
+ | Blocking work on the UI thread | Medium |
58
+ | Platform branch with an unhandled side | Medium |
@@ -0,0 +1,55 @@
1
+ # Observability
2
+
3
+ Could you tell this broke, and find out why? Gate: logging, metrics, or tracing is present **or conspicuously absent**. This module was defined in the original audit design but no gate ever enabled it — it could never run. It runs now, and the absence case is the point.
4
+
5
+ The test is concrete: pick the three worst plausible failures for this system and ask, for each, what signal would exist. If the answer is "a user complains", that is the finding.
6
+
7
+ ## Coverage
8
+
9
+ - [ ] Every error path produces a signal. Cross-reference the swallowed-error sweep in `failure.md` — an empty catch block is both a failure defect and an observability hole.
10
+ - [ ] Every external call records outcome and duration. These are the failures you do not control and most need to see.
11
+ - [ ] Background jobs, cron, and queue consumers report that they ran, what they processed, and what they skipped. Silent background work is invisible when it stops.
12
+ - [ ] Startup logs the resolved configuration — with secrets redacted — so a misconfigured deploy is diagnosable from the first line.
13
+
14
+ ## Log quality
15
+
16
+ - [ ] Structured, not interpolated prose. `log("user " + id + " failed")` cannot be queried; a structured field can.
17
+ - [ ] Levels are used meaningfully: `error` means someone should look, `warn` means it is degraded, `info` is the narrative. If everything is `info`, the levels are decoration.
18
+ - [ ] Correlation identifier flows through a whole operation, including into background work. Without it, a multi-service failure cannot be reassembled.
19
+ - [ ] No personal data, credentials, or tokens in logs — cross-reference `privacy.md` and `security.md`. This is where accidental egress usually happens.
20
+ - [ ] Volume is bounded: nothing logs per item in a large loop, and no message repeats per retry without a limit.
21
+ - [ ] Enough context to act — identifiers and inputs, not just "failed".
22
+
23
+ ## Metrics
24
+
25
+ - [ ] The four that matter for any request-serving surface: rate, error rate, duration distribution, saturation. Averages hide the problem; percentiles do not.
26
+ - [ ] Queue depth and consumer lag wherever there is a queue — cross-reference `scalability.md`.
27
+ - [ ] Business-level counters for the operations that matter, not only technical ones. "Signups dropped to zero" is caught by a business metric, not by CPU.
28
+ - [ ] Cardinality is bounded — no metric labelled with a user id or a raw path.
29
+
30
+ ## Tracing
31
+
32
+ - [ ] Spans cover the boundaries: inbound request, outbound calls, database, queue publish and consume.
33
+ - [ ] Context propagates across process boundaries, including asynchronous ones.
34
+ - [ ] Span attributes carry the identifiers needed to correlate with logs.
35
+
36
+ ## Alerting
37
+
38
+ - [ ] Something alerts on the failures that matter, and it alerts on symptoms users feel rather than on causes.
39
+ - [ ] Every alert is actionable and has a stated response. An alert nobody acts on trains everyone to ignore alerts.
40
+ - [ ] Absence is alertable: a job that stops running produces no error, so the check must be on the missing heartbeat.
41
+ - [ ] Health checks distinguish liveness from readiness, and readiness reflects real dependency health.
42
+
43
+ ## Severity guidance
44
+
45
+ | Situation | Severity |
46
+ |---|---|
47
+ | No signal at all for a plausible silent failure | High |
48
+ | Credentials or personal data written to logs | High |
49
+ | Background job with no success/failure signal | High |
50
+ | Error path with no log or metric | Medium |
51
+ | No correlation identifier across an operation | Medium |
52
+ | Unbounded log volume inside a loop or retry | Medium |
53
+ | Unbounded metric cardinality | Medium |
54
+ | Only averages, no percentiles | Low |
55
+ | Every message logged at one level | Low |
@@ -0,0 +1,52 @@
1
+ # Packaging
2
+
3
+ Does what ships match what was built? Gate: a published package manifest or a release workflow was detected.
4
+
5
+ **This module earns its place empirically.** In this very project, the author's skills were absent from `package.json`'s `"files"` array and shipped to nobody for two months. Every test passed. Nothing detected it, because tests run from the repository where the files exist on disk. That is the exact class of bug this module exists to catch.
6
+
7
+ ## What is in the artefact
8
+
9
+ - [ ] Enumerate the include list (`files`, `include`, `MANIFEST`, build output config) and compare it to what the code loads at runtime. **Anything read at runtime but absent from the include list ships to nobody.**
10
+ - [ ] The inverse: files shipped that need not be — tests, fixtures, source maps in production, `.env` samples with real values, internal docs. Each is bloat, and some are leaks.
11
+ - [ ] Entry points declared in the manifest exist in the built artefact at those exact paths.
12
+ - [ ] Binaries and executables declared are present and executable.
13
+
14
+ ## Path assumptions
15
+
16
+ - [ ] No runtime code resolves a path relative to the source tree. Templates, schemas, WASM, and assets read via a source-relative path work in development and fail in the published artefact.
17
+ - [ ] Assets needed at runtime are embedded at build time or explicitly shipped and located by a mechanism that survives packaging.
18
+ - [ ] Where the project ships a compiled/bundled binary, verify the embedding actually happened rather than trusting it. This is the single highest-value check in the module.
19
+
20
+ ## Install-time verification
21
+
22
+ - [ ] Something exercises the artefact as a consumer would — installed from a packed tarball, or run from a scratch directory outside the repository with no dependencies present.
23
+ - [ ] That check runs in CI. A verification only ever run by hand will stop being run.
24
+ - [ ] The check asserts the absence of file-not-found errors, not only a zero exit code — a swallowed load failure exits zero.
25
+
26
+ ## Metadata
27
+
28
+ - [ ] Version, license, repository, and description are present and accurate.
29
+ - [ ] Declared runtime/engine requirements match what the code actually uses.
30
+ - [ ] Dependencies are in the right section — nothing needed at runtime sits in dev dependencies. This fails only for consumers, never in the repository.
31
+ - [ ] Peer dependencies and optional dependencies are declared deliberately.
32
+
33
+ ## Release process
34
+
35
+ - [ ] Publishing is automated from a tagged commit, not run from a laptop.
36
+ - [ ] The published version corresponds to a commit that exists and is tagged.
37
+ - [ ] Nothing can publish from a dirty tree.
38
+ - [ ] Multi-platform artefacts are built for every platform claimed as supported, not only the maintainer's.
39
+
40
+ ## Severity guidance
41
+
42
+ | Situation | Severity |
43
+ |---|---|
44
+ | Runtime-loaded file absent from the include list | Critical |
45
+ | Runtime path resolved relative to the source tree | Critical |
46
+ | Runtime dependency declared as a dev dependency | High |
47
+ | Secret or real credential shipped in the artefact | High |
48
+ | No verification of the artefact as a consumer would use it | High |
49
+ | Declared entry point missing from the artefact | High |
50
+ | Verification exists but does not run in CI | Medium |
51
+ | Tests and fixtures shipped to consumers | Low |
52
+ | Inaccurate engine or license metadata | Low |
@@ -0,0 +1,58 @@
1
+ # Performance
2
+
3
+ Where does time and memory actually go? Gate: a hot path or a measurable workload was detected. This module was defined in the original audit design but no gate ever enabled it — it could never run. It runs now.
4
+
5
+ **Measure or say you did not.** A performance finding with no number is a guess. If you cannot measure, state the complexity and the input size at which it matters, and mark the confidence accordingly.
6
+
7
+ ## Find the hot paths first
8
+
9
+ - [ ] `repo_map` ranks symbols by PageRank over the call graph — the top of that list is where a slowdown costs the most.
10
+ - [ ] For each candidate, `find_callers` to learn how often it is reached, and `find_callees` to see what it drags in.
11
+ - [ ] Anything called inside a loop, per request, or per item is a hot path regardless of how cheap it looks alone.
12
+
13
+ ## Algorithmic cost
14
+
15
+ - [ ] Nested iteration over the same collection — O(n²) that is fine at 10 and fatal at 10,000. State the crossover.
16
+ - [ ] Repeated linear scans where a map or set would be constant. `find_callees` for `includes`/`indexOf`/`find` inside a loop.
17
+ - [ ] Sorting or grouping recomputed on every access instead of once.
18
+ - [ ] Work repeated per item that could be hoisted out of the loop — regex compilation, config lookup, date parsing.
19
+
20
+ ## I/O
21
+
22
+ - [ ] Sequential awaits over independent operations. These should be concurrent; each one serialised costs its full latency.
23
+ - [ ] A query, file read, or network call inside a loop. Cross-reference `Database`'s N+1 check.
24
+ - [ ] Whole files or whole tables loaded to use part of them.
25
+ - [ ] Missing pagination, streaming, or batching wherever the input can grow.
26
+ - [ ] Synchronous filesystem or crypto calls on a request path.
27
+
28
+ ## Memory
29
+
30
+ - [ ] Unbounded accumulation: a cache with no eviction, an array that only grows, a map keyed by user input.
31
+ - [ ] Whole-result materialisation where a stream or iterator would do.
32
+ - [ ] Retained references that outlive their use — closures capturing large objects, listeners never removed.
33
+ - [ ] Large allocations in a loop that the allocator will churn on.
34
+
35
+ ## Caching
36
+
37
+ - [ ] Every cache has a stated key, a stated lifetime, and an invalidation path. A cache with no invalidation is a correctness bug wearing a performance costume.
38
+ - [ ] Cache keys include everything the value depends on. A key missing a dimension serves the wrong answer.
39
+ - [ ] Cached values that are cheap to compute — the cache costs more in complexity than it saves.
40
+ - [ ] Nothing caches a mutable object by reference and lets a caller mutate it.
41
+
42
+ ## Startup
43
+
44
+ - [ ] Nothing expensive happens at import time. Top-level work runs even when the code path is never used.
45
+ - [ ] Heavy dependencies are imported lazily at the point of need. Check for a dynamic import where a static one sits on a cold path.
46
+
47
+ ## Severity guidance
48
+
49
+ | Situation | Severity |
50
+ |---|---|
51
+ | Unbounded memory growth reachable from user input | High |
52
+ | Missing pagination on an endpoint over a growing table | High |
53
+ | Cache with no invalidation serving stale correctness-sensitive data | High |
54
+ | Sequential awaits over independent I/O on a hot path | Medium |
55
+ | O(n²) reachable at realistic input sizes | Medium |
56
+ | Synchronous I/O on a request path | Medium |
57
+ | Expensive work at import time | Medium |
58
+ | Repeated work hoistable out of a loop | Low |
@@ -0,0 +1,63 @@
1
+ # Privacy
2
+
3
+ Gate: personal data or user data is persisted.
4
+
5
+ Distinct from `Security`, which asks whether data can be stolen. This module asks whether the system should have the data at all, whether it goes places nobody intended, and whether the user can get it out or get it deleted.
6
+
7
+ ## Inventory first
8
+
9
+ You cannot audit what you have not enumerated. Build the list before checking anything.
10
+
11
+ - [ ] Every field that identifies or describes a person: name, email, phone, address, IP, device id, precise location, government id, payment details, biometrics, health, and anything derived from these.
12
+ - [ ] Free-text fields count. A "notes" column collects whatever users type, including data nobody designed for.
13
+ - [ ] For each field record: where it enters, where it is stored, where it is sent, how long it is kept.
14
+ - [ ] Note fields collected but never read — cross-reference `Reachability`. Data collected for no purpose is the easiest privacy finding to fix: stop collecting it.
15
+
16
+ ## Egress — where does it go
17
+
18
+ - [ ] Every third party that receives personal data: analytics, error reporting, logging, LLM providers, support tools, CDNs.
19
+ - [ ] **Error reports and logs are the most common accidental egress.** Check what is attached to an exception — request bodies, headers, user objects.
20
+ - [ ] **Prompts are egress.** If personal data is interpolated into an LLM call, that data left the system. Cross-reference `ai.md`.
21
+ - [ ] Client-side scripts that can read personal data from the page or from storage.
22
+ - [ ] Backups, exports, and fixtures — a production dump used as a test fixture is a leak. `search_code` test fixtures for real-looking emails and names.
23
+
24
+ ## Minimisation
25
+
26
+ - [ ] Each field has a purpose that someone can state. If nobody can, that is the finding.
27
+ - [ ] Precision is no higher than needed — a year instead of a birth date, a region instead of coordinates.
28
+ - [ ] Identifiers are pseudonymous where the real identity is not needed downstream.
29
+ - [ ] Personal data is not used as a key or in a URL where it will end up in logs, referrers, and browser history.
30
+
31
+ ## Retention and deletion
32
+
33
+ - [ ] Every store of personal data has a retention period, and something actually enforces it. A policy with no job is not a policy.
34
+ - [ ] Deletion is real and complete: primary tables, related rows, caches, search indexes, blob storage, backups, and third parties. `find_callers` on the delete path and check each store the inventory listed.
35
+ - [ ] Soft delete is not presented to the user as deletion.
36
+ - [ ] Logs containing personal data have a shorter retention than the logs' default, or do not contain it.
37
+
38
+ ## User rights
39
+
40
+ - [ ] Export exists and returns everything the inventory lists, not just the profile table.
41
+ - [ ] Deletion is requestable and its scope is stated.
42
+ - [ ] Consent, where required, is recorded with what was consented to and when — and withdrawal is honoured downstream, including at third parties.
43
+ - [ ] Defaults are the privacy-preserving option.
44
+
45
+ ## Boundaries
46
+
47
+ - [ ] Data crossing a jurisdiction is deliberate and documented.
48
+ - [ ] Test, staging, and development environments do not hold real personal data. If they do, that is `High` — those environments have weaker access control by design.
49
+ - [ ] Debug and admin tooling that displays personal data is access-controlled and audited.
50
+
51
+ ## Severity guidance
52
+
53
+ | Situation | Severity |
54
+ |---|---|
55
+ | Personal data in error reports or logs sent to a third party | High |
56
+ | Real personal data in a non-production environment or a test fixture | High |
57
+ | Deletion that misses stores the inventory lists | High |
58
+ | Personal data interpolated into a third-party prompt with no notice | High |
59
+ | No retention limit on a store of personal data | Medium |
60
+ | Personal data used in a URL or as a key | Medium |
61
+ | Field collected but never read | Medium |
62
+ | Consent withdrawal not propagated downstream | Medium |
63
+ | Precision higher than the purpose requires | Low |
@@ -0,0 +1,34 @@
1
+ # Product
2
+
3
+ Who is this for, and does the shape of the code agree? This module audits the product surface, not the implementation — a codebase can be technically excellent and still ship the wrong thing.
4
+
5
+ Start with `get_architecture` and `repo_map`. The highest-PageRank symbols are the product's real center of gravity; if they do not match what the README says the product is about, that gap is the finding.
6
+
7
+ ## Users and jobs
8
+
9
+ - [ ] The repo states who the user is. If no doc says it, infer it from the entry points and say you inferred it — that ambiguity is itself worth reporting.
10
+ - [ ] Each primary user job maps to a real, reachable code path. Trace one with `trace_path` from entry point to effect.
11
+ - [ ] Nothing in the codebase serves a user the docs never mention. Unexplained surface is either an undocumented feature or abandoned work.
12
+
13
+ ## Surface coherence
14
+
15
+ - [ ] One way to do each thing, or a stated reason for more than one. Three overlapping commands that half-solve the same job is a product defect before it is a code defect.
16
+ - [ ] Naming is consistent with the user's vocabulary, not the implementation's. A CLI flag named after an internal class leaks the model.
17
+ - [ ] Defaults serve the common case. Count how many flags a user must pass to do the most obvious thing — if it is more than zero, ask why.
18
+ - [ ] Error messages tell the user what to do next, not what went wrong internally.
19
+
20
+ ## Onboarding path
21
+
22
+ - [ ] There is a shortest path from install to first value, and it is documented. Follow it literally against the repo and note every step that is missing, wrong, or assumed.
23
+ - [ ] Prerequisites are stated before they are needed, not discovered by failure.
24
+ - [ ] The first-run experience handles the empty state — no data, no config, no index.
25
+
26
+ ## Feature economics
27
+
28
+ - [ ] For each feature, is there evidence anyone uses it? Cross-check with the `Reachability` module: a feature with no in-repo caller and no doc is a maintenance cost with no return.
29
+ - [ ] Features that exist only for one caller — worth reporting as candidates for inlining or removal.
30
+ - [ ] Configuration options that no code branches on. Same category.
31
+
32
+ ## Reporting
33
+
34
+ Product findings are the easiest to state as opinion and the hardest to defend. Anchor each one: a `file:line`, a missing doc section, or a traced path that dead-ends. If the only evidence is your judgement, mark the confidence low and say what would settle it.