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

refactor: bound the dev-environment audit's measurement run and narrow it to host side effects

[._.]/ Adam Eivy8c8d947729cc
diff --git a/docs/features/scheduled-audit-organization.md b/docs/features/scheduled-audit-organization.md
index ad09163316..6e8e2f67a2 100644
--- a/docs/features/scheduled-audit-organization.md
+++ b/docs/features/scheduled-audit-organization.md
@@ -14,8 +14,7 @@ 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 existing
-better-* names remain unchanged, and better-dev-environment was added later
-under its prefixed name.
+better-* names, including better-dev-environment, remain unchanged.
Operational tasks (claims, review pipelines, reconciliation, releases, repo sync),
planning/ideation, private security assessment, JIRA, and media generation retain
diff --git a/server/lib/auditCatalog.js b/server/lib/auditCatalog.js
index 85eae8ecda..24a4936788 100644
--- a/server/lib/auditCatalog.js
+++ b/server/lib/auditCatalog.js
@@ -482,7 +482,7 @@ export const AUDIT_DEFINITIONS = Object.freeze({
'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',
+ description: 'Dev-loop host-impact audit (leaked temp files and processes, writes outside the sandbox, watcher and idle cost, suite runtime) — configurable: file issues (default) or implement one fix',
defaultFileIssues: true,
filing: filing({
slugPrefix: 'dev-environment-',
diff --git a/server/lib/auditQuality.js b/server/lib/auditQuality.js
index f0b7d24a8a..65fed850f6 100644
--- a/server/lib/auditQuality.js
+++ b/server/lib/auditQuality.js
@@ -31,7 +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.',
+ 'better-dev-environment': 'Diff host state around one bounded run of the dev commands (see the mission), then inventory the fixture, spawn, watcher and cache sites behind each change; 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 714766aa65..25b5baeb52 100644
--- a/server/lib/scheduledTaskTypes.js
+++ b/server/lib/scheduledTaskTypes.js
@@ -102,11 +102,9 @@ 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.
+ // What the development loop leaves on the developer's machine, measured by
+ // diffing host state around a bounded run. 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
diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.json
index 9437ba31d0..f260a4af3e 100644
--- a/server/services/taskPromptDefaults/integrity.snapshot.json
+++ b/server/services/taskPromptDefaults/integrity.snapshot.json
@@ -6,7 +6,7 @@
"better-cognitive-load": "a1fe22f6ef936131456c55a6b0623204",
"better-complexity": "c99f67b43ff54a1c8cf0176c721d9c06",
"better-dependency-freedom": "8a79c8be829f926bbc7720ee29818d53",
- "better-dev-environment": "5a45565120336c9891444755b5f2ec00",
+ "better-dev-environment": "2637702d714bed91f897855ef8c66f99",
"better-runtime-safety": "1038ac5008cb52e418460f53f262ad22",
"better-structural-drift": "941389a1f1c8983eef4f87af1241fbf9",
"better-test-quality": "ab53a477cd194a5c4fbda09d901a3775",
diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.js
index 09c48e7c8a..ae8501d447 100644
--- a/server/services/taskPromptDefaults/prompts.js
+++ b/server/services/taskPromptDefaults/prompts.js
@@ -1665,7 +1665,7 @@ 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
+suites, dev server, watchers 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.
@@ -1677,8 +1677,9 @@ Repository: {repoPath}
## 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:
+Before and after ONE run of the project's own test commands (a representative
+subset is enough — a per-run leak shows up in a single run) and, where safe, one
+start of its dev server stopped after about 60 seconds, snapshot:
- entries in the system temp directory, counted by name prefix;
- child processes the run started, and ports left listening;
@@ -1708,11 +1709,9 @@ count and the safe cleanup command instead.
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.
+- **Slow loop** — the slowest suites and what makes them slow (real sleeps,
+ real network, repeated expensive setup), read from that same run's reporter
+ output rather than a second run.
## Prefer a guard to a patch
@@ -1723,7 +1722,9 @@ 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;
+Whether a test's assertions prove anything, and order-dependent tests, belong to
+the test-quality work; documented setup that no longer works to the
+documentation 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.
@@ -1731,10 +1732,9 @@ 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.`,
+surviving process, the changed file — 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.`,
'infrastructure': `[Improvement: {appName}] Infrastructure and deployment audit
diff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.js
index 44ab9e16f3..3d596a621a 100644
--- a/server/services/taskPromptDefaults/versions.js
+++ b/server/services/taskPromptDefaults/versions.js
@@ -73,7 +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-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. Net-new type.
'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/taskScheduleRegistry.js b/server/services/taskScheduleRegistry.js
index bbd8b107f4..683dccc3a6 100644
--- a/server/services/taskScheduleRegistry.js
+++ b/server/services/taskScheduleRegistry.js
@@ -594,7 +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',
+ 'better-dev-environment': 'Development environment — temp files/processes leaked by test runs, writes outside the sandbox, watcher cost, suite runtime; 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',