Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: add a development-environment audit that measures what the dev loop leaves on the host

[._.]/ Adam Eivy739ff9937ccf
diff --git a/docs/features/scheduled-audit-organization.md b/docs/features/scheduled-audit-organization.md
index c8e4a8c4c5..ad09163316 100644
--- a/docs/features/scheduled-audit-organization.md
+++ b/docs/features/scheduled-audit-organization.md
@@ -13,8 +13,9 @@ better-error-handling, better-typing, better-console-errors, better-ux,
better-data-safety, better-simplify, better-module-hygiene, better-api-contract,
better-ui-lifecycle, better-observability, and better-copy, plus the service
and data-platform lenses better-infrastructure, better-data-integrity,
-better-reliability, better-privacy, and better-cost-efficiency. The six existing
-better-* names remain unchanged.
+better-reliability, better-privacy, and better-cost-efficiency. The existing
+better-* names remain unchanged, and better-dev-environment was added later
+under its prefixed name.
Operational tasks (claims, review pipelines, reconciliation, releases, repo sync),
planning/ideation, private security assessment, JIRA, and media generation retain
diff --git a/docs/features/self-improvement-audits.md b/docs/features/self-improvement-audits.md
index fe812188a1..7478776157 100644
--- a/docs/features/self-improvement-audits.md
+++ b/docs/features/self-improvement-audits.md
@@ -52,10 +52,11 @@ the operator's live checkout.
| `better-runtime-safety` | Latent defects not yet triggered | `bug`, `runtime-safety` | file | |
| `better-dependency-freedom` | Whether a dependency should exist at all | `dependencies`, `depfree` | file | yes |
| `better-test-quality` | Existing tests that prove nothing | `tests`, `test-quality` | file | |
+| `better-dev-environment` | What the dev loop leaves on the host | `tests`, `dev-environment` | file | |
## Why the boundaries are explicit
-Twenty-five lanes only pay off if they do not file each other's findings. Every
+Twenty-six lanes only pay off if they do not file each other's findings. Every
mission body names what it cedes and to whom, so two lanes cannot both claim one
problem:
@@ -73,8 +74,14 @@ problem:
`error-handling` owns the failure path once something goes wrong; and
`ui-lifecycle` owns UI lifecycle and state correctness across UI runtimes.
Its checks follow the target app’s own semantics.
-- **Tests are split two ways.** `test-coverage` owns the gaps;
- `better-test-quality` owns the tests that already exist.
+- **Tests are split three ways.** `test-coverage` owns the gaps;
+ `better-test-quality` owns whether the tests that exist prove anything; and
+ `better-dev-environment` owns what running them does to the host — temp
+ files and processes left behind, writes outside the sandbox, watcher cost,
+ suite runtime. It measures host state before and after a bounded run,
+ because a static read of one suite cannot see accumulation: every suite
+ leaking one temp directory per run passed both other lanes while filling a
+ dev machine's temp directory with tens of thousands of entries (#9000).
## The `better-` prefix and slashdo scope alignment
diff --git a/server/lib/auditCatalog.js b/server/lib/auditCatalog.js
index f4cf9fda3a..85eae8ecda 100644
--- a/server/lib/auditCatalog.js
+++ b/server/lib/auditCatalog.js
@@ -474,6 +474,24 @@ export const AUDIT_DEFINITIONS = Object.freeze({
noun: 'test-quality finding(s)',
}),
},
+ // The host the code is developed on. Every lens above reads source or runs
+ // the product; none measures what running the test suite, dev server, or
+ // setup does to the developer's machine — the gap that let test suites leak
+ // tens of thousands of temp directories unnoticed (#9000). Ungated: any
+ // repository has a development loop.
+ 'better-dev-environment': {
+ quotaBurnId: null,
+ label: 'Development environment',
+ description: 'Dev-loop host-impact audit (leaked temp files and processes, writes outside the sandbox, watcher and idle cost, suite runtime, setup drift) — configurable: file issues (default) or implement one fix',
+ defaultFileIssues: true,
+ filing: filing({
+ slugPrefix: 'dev-environment-',
+ label: 'dev-environment-audit',
+ issueLabel: 'tests',
+ labelDescription: 'Proposed from a development-environment audit',
+ noun: 'dev-environment finding(s)',
+ }),
+ },
// Service and data-platform lenses. The catalog above grew out of a web app
// with a UI; these cover what a backend service, data platform, or
// infrastructure repository is judged on and nothing above owns: the
@@ -746,7 +764,7 @@ export const DO_BETTER_SCOPE_COVERAGE = Object.freeze({
'bugs-perf': ['better-runtime-safety', 'performance', 'error-handling', 'observability', 'reliability', 'cost-efficiency'],
'stack-specific': ['ui-lifecycle', 'accessibility', 'data-safety', 'security', 'infrastructure', 'data-integrity'],
deps: ['better-dependency-freedom', 'security'],
- tests: ['test-coverage', 'better-test-quality'],
+ tests: ['test-coverage', 'better-test-quality', 'better-dev-environment'],
ux: ['ux', 'mobile-responsive', 'copy'],
structural: ['module-hygiene', 'better-structural-drift', 'simplify'],
'cognitive-load': ['better-cognitive-load', 'better-complexity'],
@@ -799,6 +817,7 @@ export const AUDIT_SUGGESTED_AFTER = Object.freeze({
// the findings the triage surfaced.
'test-coverage': Object.freeze(['code-quality']),
'better-test-quality': Object.freeze(['test-coverage']),
+ 'better-dev-environment': Object.freeze(['better-test-quality']),
// The restructuring ladder: consolidate sources of truth, delete what is
// dead, then draw module boundaries, then reduce what survives.
simplify: Object.freeze(['better-structural-drift']),
@@ -823,6 +842,7 @@ export const AUDIT_SUGGESTED_AFTER = Object.freeze({
// Urgent bugs outrank the sequence; re-measure after each merged change.
export const AUDIT_RUN_GUIDANCE = Object.freeze({
'better-test-quality': 'Assesses whether the tests you have detect the regressions the other audits found — so refactors that follow have a safety net.',
+ 'better-dev-environment': 'Follows test quality, so it measures the host impact of the suite that will keep running rather than tests about to be deleted.',
'test-coverage': 'Adds the missing boundary coverage a refactor needs before it starts; avoid duplicating assertions a stronger test already makes.',
security: 'Head of the order — an exploitable defect is fixed before any cleanup, whatever else is queued.',
'data-safety': 'Head of the order — data-loss and upgrade hazards are fixed before code moves around them.',
diff --git a/server/lib/auditQuality.js b/server/lib/auditQuality.js
index f171ce9edf..f0b7d24a8a 100644
--- a/server/lib/auditQuality.js
+++ b/server/lib/auditQuality.js
@@ -31,6 +31,7 @@ export const AUDIT_DISCOVERY = Object.freeze({
'better-runtime-safety': 'Scan asynchronous callbacks, resource cleanup, nullable access and process lifecycles across source roots; rank reachable crashes, corrupted state and leaked resources.',
'better-dependency-freedom': 'Inventory manifests and actual imports across packages; rank dependency cost, advisory exposure and removable surface against the complexity of a concrete replacement.',
'better-test-quality': 'Inventory suites and public boundaries; search assertion-free tests, overmocking, tautologies and redundant cases, prioritizing suites that falsely protect critical behavior.',
+ 'better-dev-environment': 'Snapshot host state (temp-dir entries by prefix, child processes, listening ports, untracked files, user config) before and after a bounded run of the test suites, dev server and setup scripts; inventory fixture, spawn, watcher and cache sites; rank by what accumulates per run times how often the loop runs.',
infrastructure: 'Inventory infrastructure-as-code, container, orchestration, deployment and CI files; scan exposure, identity grants, secrets, pinning, resource limits and probes, ranking reachable production exposure and irreproducible deploys first.',
'data-integrity': 'Inventory every write path, ingestion entry point, consumer, batch/backfill job and stored data format; trace retry and redelivery behavior and multi-step writes, ranking silent duplication, loss and wrong results first.',
reliability: 'Inventory process entry points, signal handling, health endpoints, queues, workers and scheduled jobs; trace shutdown, restart, overload and multi-instance behavior, ranking dropped work and outage amplification first.',
diff --git a/server/lib/scheduledTaskTypes.js b/server/lib/scheduledTaskTypes.js
index 9f6b536743..714766aa65 100644
--- a/server/lib/scheduledTaskTypes.js
+++ b/server/lib/scheduledTaskTypes.js
@@ -102,6 +102,12 @@ export const SELF_IMPROVEMENT_TASK_TYPES = [
// `test-coverage`, which owns the GAPS. Files under `tests` plus the
// `test-quality` metric label.
'better-test-quality',
+ // What the development loop does to the developer's machine: temp files and
+ // processes leaked by test runs, writes outside the sandbox, watcher and idle
+ // cost, suite runtime, setup drift. Measured by diffing host state around a
+ // bounded run — a static read cannot see accumulation. Files under `tests`
+ // plus the `dev-environment` metric label.
+ 'better-dev-environment',
// Service and data-platform lenses — what a backend API, data platform, or
// infrastructure repository is judged on that the UI-shaped audits above
// do not own. `infrastructure` is gated on IaC/container/CI files; the rest
diff --git a/server/services/taskPromptDefaults.test.js b/server/services/taskPromptDefaults.test.js
index 3e1e9007d1..7a5ba275c6 100644
--- a/server/services/taskPromptDefaults.test.js
+++ b/server/services/taskPromptDefaults.test.js
@@ -158,6 +158,7 @@ describe('taskPromptDefaults integrity snapshot', () => {
['better-runtime-safety', ['Sentinel confusion', 'a failure scenario, not a code shape', 'Not yours']],
['better-dependency-freedom', ['Acceptable', 'Suspect', 'Removable', 'Respect documented decisions', 'file no version bumps here']],
['better-test-quality', ['Vacuous', 'mutation probe', 'Deletion is a valid outcome', 'Missing coverage is separate work']],
+ ['better-dev-environment', ['Measure, do not only read', 'before and after', 'Prefer a guard to a patch', 'Not yours']],
])('%s states the discipline that makes it its own lane', (key, markers) => {
const current = DEFAULT_TASK_PROMPTS[key];
expect(PROMPT_VERSIONS[key]).toBe(['better-complexity', 'better-runtime-safety'].includes(key) ? 2 : 1);
diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.json
index 9c2c8c279f..9437ba31d0 100644
--- a/server/services/taskPromptDefaults/integrity.snapshot.json
+++ b/server/services/taskPromptDefaults/integrity.snapshot.json
@@ -6,6 +6,7 @@
"better-cognitive-load": "a1fe22f6ef936131456c55a6b0623204",
"better-complexity": "c99f67b43ff54a1c8cf0176c721d9c06",
"better-dependency-freedom": "8a79c8be829f926bbc7720ee29818d53",
+ "better-dev-environment": "5a45565120336c9891444755b5f2ec00",
"better-runtime-safety": "1038ac5008cb52e418460f53f262ad22",
"better-structural-drift": "941389a1f1c8983eef4f87af1241fbf9",
"better-test-quality": "ab53a477cd194a5c4fbda09d901a3775",
@@ -68,6 +69,7 @@
"better-cognitive-load": 1,
"better-complexity": 2,
"better-dependency-freedom": 1,
+ "better-dev-environment": 1,
"better-runtime-safety": 2,
"better-structural-drift": 1,
"better-test-quality": 1,
diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.js
index 31a497c9f7..09c48e7c8a 100644
--- a/server/services/taskPromptDefaults/prompts.js
+++ b/server/services/taskPromptDefaults/prompts.js
@@ -1662,6 +1662,80 @@ practical public boundary instead of deleting it.
Cite the test file and case name with \`file:LINE\`, the source it claims to
cover, and the probe result.`,
+ 'better-dev-environment': `[Improvement: {appName}] Development environment audit
+
+Audit what {appName}'s development loop does to the machine it runs on: the test
+suites, dev server, watchers, setup scripts and pre-push checks. The product can
+be correct and every test meaningful while each run quietly leaves something
+behind. On a machine where agents run the suites many times a day, one leaked
+directory per run becomes tens of thousands.
+
+Repository: {repoPath}
+
+{modeInstructions}
+
+## Measure, do not only read
+
+A static read of one test file cannot see accumulation — you have to observe it.
+Before and after a bounded run of the project's own test commands (and, where
+safe, one start/stop of its dev server), snapshot:
+
+- entries in the system temp directory, counted by name prefix;
+- child processes the run started, and ports left listening;
+- untracked or modified files in the checkout (\`git status --porcelain\`);
+- the modification times of user-level files the run could touch: the
+ project's git config, home-directory dotfiles and caches it names.
+
+Run only commands the repository documents for development. Never run a suite
+against real user data or a production database, never start a second copy of
+a long-running service on its production port, and follow the repository's
+instructions about which databases and directories tests may use. Measurement
+is read-only: do not delete anything that existed before your run — report its
+count and the safe cleanup command instead.
+
+## Hunt for
+
+- **Leaks per run** — temp directories or files a test or helper creates and
+ never removes; child processes, servers, or watchers still alive after the
+ suite exits; ports left bound; handles that keep the runner from exiting.
+- **Writes outside the sandbox** — a test or script that mutates the real
+ checkout's git config, the user's home directory, a global cache, the real
+ database, or a shared directory other checkouts also use.
+- **Accumulation** — caches, logs, build output, worktrees, or downloaded
+ artifacts that only grow during development and have no cleanup path.
+- **Idle and watcher cost** — a dev server or watcher that watches directories
+ that churn (data, temp, dependency trees), a polling loop, or CPU and disk
+ activity when nothing is being edited.
+- **Parallel-checkout collisions** — fixed ports, fixed temp paths, or a shared
+ database that break when two checkouts or agents run the suite at once.
+- **Slow or nondeterministic loop** — the slowest suites and what makes them
+ slow (real sleeps, real network, repeated expensive setup), and tests that
+ pass or fail depending on order, clock, or machine.
+- **Setup drift** — documented setup, install, or version requirements that no
+ longer match what the scripts and manifests actually do.
+
+## Prefer a guard to a patch
+
+When a finding is a class of mistake (every suite that calls \`mkdtemp\` without
+removing it), the fix includes a mechanical guard — a conventions test, a
+shared helper with cleanup built in, or a runner-level teardown — so the next
+suite cannot reintroduce it. Fixing the one instance you measured is not enough.
+
+## Not yours
+
+Whether a test's assertions prove anything belongs to the test-quality work;
+missing coverage to the test-coverage work; leaks in the running product to
+the runtime-safety work; CI and deployment configuration to the infrastructure
+work; dependency versions to the dependency-update work.
+
+## The bar
+
+Every finding quotes its measurement — the before and after counts, the
+surviving process, the changed file — names the source with \`file:LINE\`,
+and estimates the cost at the project's real cadence (runs per day times what
+each run leaves or spends). Report counts and name prefixes, never absolute
+paths that contain a username or other machine identity.`,
+
'infrastructure': `[Improvement: {appName}] Infrastructure and deployment audit
Audit how {appName} is built, packaged, deployed, and run, as described by the
diff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.js
index 060f9d8734..44ab9e16f3 100644
--- a/server/services/taskPromptDefaults/versions.js
+++ b/server/services/taskPromptDefaults/versions.js
@@ -73,6 +73,7 @@ export const PROMPT_VERSIONS = {
'reliability': 1, // v1: service reliability audit — shutdown draining, truthful health checks, backpressure, job leasing/checkpoints, startup fragility, mixed-version deploys. Net-new type.
'privacy': 1, // v1: personal/sensitive-data audit — operational exposure, third-party minimization, API over-exposure, retention, erasure reach, real data in fixtures. Honors the project's documented sharing model. Net-new type.
'cost-efficiency': 1, // v1: metered-spend audit — repeated paid calls, unrequested provider work, retry multiplication, unbounded scans, storage growth, over-provisioning, egress. Net-new type.
+ 'better-dev-environment': 1, // v1: host impact of the development loop, measured by diffing host state around a bounded run — leaked temp files/processes/ports, writes outside the sandbox, accumulation, watcher/idle cost, suite runtime, setup drift. Net-new type (#9000 went undetected by every other lens).
'better-test-quality': 1, // v1: vacuous/weak/redundant existing tests, proven with a mutation probe. Distinct from test-coverage, which owns the gaps.
'stash-cleanup': 2, // v2: the STALE/ABANDONED heuristic names `AGENTS.md` (or `CLAUDE.md`) as the policy file to check before assuming a stash contradicts current architecture (#4852). v1: triage git stash list — supersession check against main, drop superseded/stale entries, leave real unlanded work in place. Net-new type (no retired-hash history needed).
'repo-sync': 1, // v1: verify + finish the deterministic install-wide origin-sync sweep (services/repoSync.js) — resolve mid-flight merges/rebases, decide what to do with uncommitted work, land or report unpushed branches, triage the stashes it could not prove redundant. Net-new type (no retired-hash history needed).
diff --git a/server/services/taskSchedule.test.js b/server/services/taskSchedule.test.js
index 41195f825a..9fc8e7c25d 100644
--- a/server/services/taskSchedule.test.js
+++ b/server/services/taskSchedule.test.js
@@ -1902,6 +1902,7 @@ describe('taskSchedule', () => {
'better-runtime-safety',
'better-dependency-freedom',
'better-test-quality',
+ 'better-dev-environment',
])
})
diff --git a/server/services/taskScheduleRegistry.js b/server/services/taskScheduleRegistry.js
index 38636a4b70..bbd8b107f4 100644
--- a/server/services/taskScheduleRegistry.js
+++ b/server/services/taskScheduleRegistry.js
@@ -369,6 +369,7 @@ const TASK_INTERVAL_DEFAULTS = {
'better-runtime-safety': fileIssuesAuditInterval(),
'better-dependency-freedom': fileIssuesAuditInterval(),
'better-test-quality': fileIssuesAuditInterval(),
+ 'better-dev-environment': fileIssuesAuditInterval(),
// Service and data-platform lenses (see AUDIT_DEFINITIONS). File-issues by
// default — their findings usually touch production configuration — with
// open issues + PRs preloaded for dedup like the do:better lanes above.
@@ -593,6 +594,7 @@ export const TASK_TYPE_DESCRIPTIONS = {
'better-runtime-safety': 'Runtime safety — missing awaits, unhandled rejections, unguarded nulls, leaks, races; file issues (default) or implement fixes',
'better-dependency-freedom': 'Dependency freedom — replace micro-packages and native-API wrappers with in-repo code; file issues (default) or implement one removal',
'better-test-quality': 'Test quality — vacuous, weak, or redundant tests; file issues (default) or implement one cleanup',
+ 'better-dev-environment': 'Development environment — temp files/processes leaked by test runs, writes outside the sandbox, watcher cost, suite runtime, setup drift; file issues (default) or implement one fix',
'infrastructure': 'Infrastructure & deployment — IaC, containers, orchestration and CI: exposure, identity grants, secrets, pinning, limits; file issues (default) or implement fixes',
'data-integrity': 'Data integrity — idempotent ingestion, atomic writes, consistency, schema evolution of stored data; file issues (default) or implement fixes',
'reliability': 'Reliability — graceful shutdown, health/readiness, backpressure, job leasing, mixed-version deploys; file issues (default) or implement fixes',