proteum 2.1.9 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/.codex/environments/environment.toml +11 -0
  2. package/AGENTS.md +25 -11
  3. package/README.md +19 -9
  4. package/agents/project/AGENTS.md +165 -120
  5. package/agents/project/CODING_STYLE.md +1 -1
  6. package/agents/project/app-root/AGENTS.md +16 -0
  7. package/agents/project/client/AGENTS.md +5 -5
  8. package/agents/project/client/pages/AGENTS.md +13 -13
  9. package/agents/project/diagnostics.md +19 -10
  10. package/agents/project/optimizations.md +5 -6
  11. package/agents/project/root/AGENTS.md +295 -0
  12. package/agents/project/server/routes/AGENTS.md +2 -2
  13. package/agents/project/server/services/AGENTS.md +4 -2
  14. package/agents/project/tests/AGENTS.md +2 -2
  15. package/cli/app/index.ts +31 -7
  16. package/cli/commands/configure.ts +226 -0
  17. package/cli/commands/dev.ts +0 -2
  18. package/cli/commands/diagnose.ts +33 -1
  19. package/cli/commands/explain.ts +1 -1
  20. package/cli/commands/migrate.ts +51 -0
  21. package/cli/commands/orient.ts +169 -0
  22. package/cli/commands/perf.ts +8 -1
  23. package/cli/commands/verify.ts +1003 -49
  24. package/cli/compiler/artifacts/manifest.ts +4 -4
  25. package/cli/compiler/artifacts/routing.ts +2 -2
  26. package/cli/compiler/artifacts/services.ts +12 -3
  27. package/cli/compiler/client/index.ts +65 -19
  28. package/cli/compiler/common/files/style.ts +47 -2
  29. package/cli/compiler/common/generatedRouteModules.ts +31 -38
  30. package/cli/compiler/common/index.ts +10 -0
  31. package/cli/compiler/common/proteumManifest.ts +1 -0
  32. package/cli/compiler/server/index.ts +34 -9
  33. package/cli/context.ts +6 -1
  34. package/cli/index.ts +7 -8
  35. package/cli/migrate/pageContract.ts +516 -0
  36. package/cli/paths.ts +47 -6
  37. package/cli/presentation/commands.ts +100 -10
  38. package/cli/presentation/devSession.ts +4 -6
  39. package/cli/presentation/help.ts +2 -2
  40. package/cli/presentation/ink.ts +10 -5
  41. package/cli/presentation/welcome.ts +2 -4
  42. package/cli/runtime/commands.ts +94 -1
  43. package/cli/scaffold/index.ts +2 -2
  44. package/cli/scaffold/templates.ts +4 -2
  45. package/cli/utils/agents.ts +273 -58
  46. package/client/dev/profiler/index.tsx +3 -2
  47. package/client/router.ts +10 -2
  48. package/client/services/router/index.tsx +6 -22
  49. package/common/dev/connect.ts +20 -4
  50. package/common/dev/console.ts +7 -0
  51. package/common/dev/contractsDoctor.ts +354 -0
  52. package/common/dev/diagnostics.ts +10 -7
  53. package/common/dev/inspection.ts +830 -38
  54. package/common/dev/performance.ts +19 -5
  55. package/common/dev/profiler.ts +1 -0
  56. package/common/dev/proteumManifest.ts +5 -4
  57. package/common/dev/requestTrace.ts +12 -1
  58. package/common/router/contracts.ts +8 -11
  59. package/common/router/index.ts +2 -2
  60. package/common/router/pageData.ts +72 -0
  61. package/common/router/register.ts +10 -46
  62. package/common/router/response/page.ts +28 -16
  63. package/docs/dev-sessions.md +8 -4
  64. package/docs/diagnostics.md +77 -11
  65. package/docs/migrate-from-2.1.3.md +388 -0
  66. package/docs/request-tracing.md +25 -6
  67. package/package.json +6 -1
  68. package/scripts/update-codex-agents.ts +2 -2
  69. package/server/app/container/console/index.ts +11 -1
  70. package/server/app/container/trace/index.ts +117 -0
  71. package/server/app/devDiagnostics.ts +1 -1
  72. package/server/app/index.ts +5 -1
  73. package/server/services/auth/index.ts +9 -0
  74. package/server/services/router/index.ts +64 -14
  75. package/server/services/router/request/api.ts +7 -1
  76. package/server/services/router/response/index.ts +8 -28
  77. package/types/global/vendors.d.ts +12 -0
  78. package/types/vendors.d.ts +12 -0
  79. package/common/router/pageSetup.ts +0 -51
@@ -0,0 +1,11 @@
1
+ # THIS IS AUTOGENERATED. DO NOT EDIT MANUALLY
2
+ version = 1
3
+ name = "core"
4
+
5
+ [setup]
6
+ script = ""
7
+
8
+ [[actions]]
9
+ name = "Run"
10
+ icon = "run"
11
+ command = "npm login && npm publish"
package/AGENTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Proteum Core
2
2
 
3
- This file governs work in the Proteum framework repository itself. For downstream app rules, use `agents/project/AGENTS.md`.
3
+ This file governs work in the Proteum framework repository itself. For downstream app rules, use `agents/project/AGENTS.md` for the standalone app-root contract, or split between `agents/project/root/AGENTS.md` and `agents/project/app-root/AGENTS.md` in a monorepo.
4
4
  Role: keep only framework-repo instructions here.
5
5
  Keep here: core-repo priorities, framework change workflow, reference-app validation, and framework-specific constraints.
6
6
  Do not put here: downstream app implementation contracts, area-specific app rules, or repeated content that belongs in `agents/project/**`.
@@ -19,22 +19,33 @@ After those optimization concerns, preserve explicit, typed, machine-readable co
19
19
  - Keep `server/index.ts` as the canonical type root for services, router context, request context, and models.
20
20
  - Keep generated code deterministic, auditable, and easy to map back to source.
21
21
  - Prefer typed traces, perf rollups, and manifest-backed diagnostics over ad hoc logging.
22
+ - For Prisma-backed apps, declare database structure changes in the app's `schema.prisma` only. Never create or edit migration files manually, and never run schema-mutating SQL such as `ALTER TABLE`, `CREATE TABLE`, or `DROP TABLE`.
22
23
  - Follow `agents/project/optimizations.md` when choosing packages, helpers, runtimes, plugins, or build infrastructure.
23
24
  - Delete obsolete compatibility layers, helper indirection, and unused packages when safe.
24
25
 
25
26
  ## Workflow
26
27
 
27
28
  - If the user pastes raw errors without asking for a fix, do not implement changes. List likely causes and, for each one, give probability, why, and how to fix it.
29
+ - If you changed any app `schema.prisma`, do not start testing or validation yet. Ask the user to run the following command in the affected worktree directory, replacing the placeholders, and wait for the user to reply exactly `continue` before resuming validation or tests:
30
+ ```
31
+ cd <worktree path>
32
+ npx prisma migrate dev --config ./prisma.config.ts --name <migration name>
33
+ ```
28
34
  - After implementing a framework feature or change, do not stop at code edits. Boot both reference apps, exercise the affected flow with Playwright or the smallest real Proteum surface, run the relevant `proteum` diagnostics or perf commands, and confirm there is no meaningful regression in runtime behavior, performance, load size, SEO output, or coding-style expectations before finishing.
29
- - When starting a long-lived reference app dev server for framework work, prefer `npx proteum dev --session-file <path> --replace-existing --port <port>` so the session can be listed and stopped deterministically later.
35
+ - When starting a long-lived reference app dev server for framework work, always request elevated permissions and run `npx proteum dev` outside the sandbox. Use an explicit thread-scoped session file such as `var/run/proteum/dev/framework-<app>-<task>.json`, inspect tracked sessions plus current listeners first, for example with `npx proteum dev list --json` and `lsof -nP -iTCP -sTCP:LISTEN`, then choose a port that is not currently used before starting `npx proteum dev --session-file <path> --port <port>`.
36
+ - Do not use `--replace-existing` unless you are restarting the exact session file started by the current thread/task. Never replace another live session that belongs to a user, another thread, or an unknown owner.
37
+ - When a reference app uses local `file:` connected projects for the affected flow, boot every connected producer app as well, each on its own free port and thread-scoped session file, and run every one of those `proteum dev` processes with elevated permissions outside the sandbox before starting or validating the consumer app.
30
38
  - Before retrying a boot on the same app, changing ports, or finishing the task, stop every framework-started dev session with `npx proteum dev stop --session-file <path>` or `npx proteum dev stop --all --stale`.
31
39
  - If the task changed the dev workflow itself, verify the final cleanup path with `npx proteum dev list --json` before finishing.
32
- - When you have finished your work, summarize in one top-level short (up to 100 characters) sentence the changes you made since the beginning of the conversation. Strictly use the Conventional Commits specification:
33
- ```
34
- Commit message: <type>[optional scope]: <description>
40
+ - When you have finished your work, summarize in one top-level short (up to 100 characters) sentence ALL the changes you made since the beginning of the WHOLE conversation. Strictly use the Conventional Commits specification:
41
+ ```
42
+ Commit message: <type>[optional scope]: <description>
35
43
 
36
- [optional body]
37
- ```
44
+ [optional body]
45
+ ```
46
+ If the user replies exactly `commit`, use that Conventional Commit message, stage the task-related changed files with `git add` while avoiding unrelated user changes or incidental untracked files, then create the commit by running `git commit`.
47
+ After providing a commit message or after creating a commit, immediately follow it with this exact prompt and obey it:
48
+ `Explain in short minimalistic and few bullet points what we changed in this thread, like you would do to your grandma. Start with a verb in the past.`
38
49
 
39
50
  ## Core Changes
40
51
 
@@ -44,9 +55,9 @@ Commit message: <type>[optional scope]: <description>
44
55
  - `/Users/gaetan/Desktop/Projets/unique.domains/platform/apps/product`
45
56
  - `/Users/gaetan/Desktop/Projets/unique.domains/platform/apps/website`
46
57
  - Inspect how both apps currently use the touched feature, runtime, API, compiler behavior, or generated output before proposing or implementing changes.
47
- - Keep the developer-facing contract synchronized when framework work changes CLI commands, profiler capabilities, or the `proteum dev` banner. Update the live surfaces together in the same pass: CLI command/help definitions, profiler panels and dev-only endpoints, banner text/examples, and the most relevant agent docs that describe them, especially `AGENTS.md`, `agents/project/AGENTS.md`, `agents/project/diagnostics.md`, and any narrower `agents/project/**/AGENTS.md` file that mentions the changed workflow.
48
- - Current CLI banner contract: every human-facing Proteum CLI run prints the welcome banner and includes the active Proteum installation method, while only `proteum dev` clears the interactive terminal before rendering, exposes `CTRL+R` reload plus `CTRL+C` shutdown hotkeys in its session UI, and reports connected app names plus successful connected `/ping` checks in the ready banner.
49
- - Keep core changes aligned with the explicit controller/page architecture in `agents/project/AGENTS.md`.
58
+ - Keep the developer-facing contract synchronized when framework work changes CLI commands, profiler capabilities, or the `proteum dev` banner. Update the live surfaces together in the same pass: CLI command/help definitions, profiler panels and dev-only endpoints, banner text/examples, and the most relevant agent docs that describe them, especially `AGENTS.md`, `agents/project/AGENTS.md`, `agents/project/root/AGENTS.md`, `agents/project/app-root/AGENTS.md`, `agents/project/diagnostics.md`, and any narrower `agents/project/**/AGENTS.md` file that mentions the changed workflow.
59
+ - Current CLI banner contract: only the bare `proteum build` and bare `proteum dev` commands print the welcome banner and include the active Proteum installation method. Any extra argument or option skips the banner. Only `proteum dev` clears the interactive terminal before rendering, exposes `CTRL+R` reload plus `CTRL+C` shutdown hotkeys in its session UI, and reports connected app names plus successful connected `/ping` checks in the ready banner.
60
+ - Keep core changes aligned with the explicit controller/page architecture in `agents/project/root/AGENTS.md` and its standalone composition in `agents/project/AGENTS.md`.
50
61
  - Prefer removing framework magic when the same result can be expressed with explicit contracts, generated code, or typed context.
51
62
  - Apply the pruning rules from `agents/project/optimizations.md`, especially for webpack plugins, Babel plugins, aliases, helpers, runtime services, and npm packages that are not meaningfully used by both apps.
52
63
  - Remove dead docs, flags, helper files, and compatibility branches in the same pass when safe.
@@ -64,13 +75,16 @@ Commit message: <type>[optional scope]: <description>
64
75
 
65
76
  Do not stop at static analysis for routing, controllers, generated code, SSR, client runtime, services, webpack, Babel, or emitted assets.
66
77
 
67
- - Run `npx proteum dev --no-cache --replace-existing --session-file var/run/proteum/dev/framework-<app>.json --port 3xxx` in both reference apps on explicit ports.
78
+ - Run `npx proteum dev --no-cache --session-file var/run/proteum/dev/framework-<app>.json --port <free-3xxx-port>` in both reference apps on explicit free ports and with elevated permissions outside the sandbox.
79
+ - If either reference app uses local `file:` connected projects for the affected flow, run those producer apps too on their own free ports before exercising the consumer.
68
80
  - When validating a concrete route, controller path, or failing page on a running dev server, prefer `proteum diagnose <path> --port <port>` first. Use raw `proteum trace ...` output when you need lower-level event detail beyond the diagnose summary.
69
81
  - When the issue is latency, CPU, SQL cost, render cost, or memory drift, inspect `proteum perf top`, `proteum perf request`, `proteum perf compare`, or `proteum perf memory` against the running dev server before adding custom instrumentation.
70
82
  - When a framework change can affect shipped client code size, run `proteum build --prod --analyze` for static bundle artifacts or `proteum build --prod --analyze --analyze-serve --analyze-port auto` when you need a local analyzer URL.
71
83
  - For protected browser or API flows in dev, prefer `npx proteum session <email> --role <role>` to mint a dev auth cookie instead of automating the login UI. Use the login UI only when login itself is the feature under test.
84
+ - When a task needs browser execution instead of the higher-level verifier, prefer `npx proteum verify browser <path>` or direct Playwright with a disposable profile. Keep auth sourced from `npx proteum session`, not UI login or shared browser state.
72
85
  - For request-time behavior, arm traces with `proteum trace arm --capture deep`, reproduce once, then inspect `proteum trace latest` or `proteum trace show <requestId>`.
73
86
  - When the framework-facing workflow itself changed, verify the CLI surface too with `proteum verify framework-change --crosspath-port <port> --product-port <port> --website-port <port>`.
87
+ - Only the final verifier agent should usually run browser flows. Other agents should stay on `orient`, `verify owner`, `verify request`, and command-level checks unless browser execution is the only trustworthy surface.
74
88
  - Open the real pages with Playwright.
75
89
  - Inspect browser console errors and warnings.
76
90
  - Inspect server startup and runtime errors.
package/README.md CHANGED
@@ -4,6 +4,8 @@ Proteum is an LLM-first SSR / SEO / TypeScript framework for full-stack web appl
4
4
 
5
5
  It is built for teams that want explicit server contracts, server-first rendering, deterministic generated artifacts, and a codebase that an AI agent can inspect without reverse-engineering hidden runtime magic.
6
6
 
7
+ Migration guide for older apps: [docs/migrate-from-2.1.3.md](docs/migrate-from-2.1.3.md)
8
+
7
9
  ## Why Proteum
8
10
 
9
11
  Most full-stack frameworks optimize first for human convenience.
@@ -24,7 +26,7 @@ Proteum combines:
24
26
 
25
27
  ## Core Principles
26
28
 
27
- - **Server-first by default.** Put data loading in the page setup function and keep client code focused on UI.
29
+ - **Server-first by default.** Put data loading in the page data function and keep client code focused on UI.
28
30
  - **Explicit request entrypoints.** Controllers are classes. Request access is explicit through `this.request`.
29
31
  - **Local validation.** Validate handler input inside the handler with `this.input(schema)`.
30
32
  - **Deterministic generation.** Proteum owns `.proteum/` and regenerates it from source.
@@ -69,7 +71,7 @@ Important files:
69
71
  - `process.env` / optional `.env`: `PORT`, `ENV_*`, `URL`, `URL_INTERNAL`, any app-chosen variables referenced by `proteum.config.ts`, and `TRACE_*` environment variables loaded by the app
70
72
  - `server/config/*.ts`: plain typed config exports consumed by the explicit app bootstrap
71
73
  - `server/index.ts`: default-exported `Application` subclass that instantiates root services and router plugins
72
- - `client/pages/**`: SSR page entrypoints registered through `Router.page(...)`
74
+ - `client/pages/**`: SSR page entrypoints registered through `Router.page(path, options, data, render)`
73
75
  - `server/controllers/**`: request handlers that extend `Controller`
74
76
  - `commands/**`: dev-only internal commands that extend `Commands`
75
77
  - `server/services/**`: business logic that extends `Service`
@@ -192,9 +194,11 @@ import Router from '@/client/router';
192
194
 
193
195
  Router.page(
194
196
  '/',
197
+ {
198
+ auth: false,
199
+ layout: false,
200
+ },
195
201
  ({ Plans, Stats }) => ({
196
- _auth: false,
197
- _layout: false,
198
202
  plans: Plans.getPlans(),
199
203
  stats: Stats.general(),
200
204
  }),
@@ -207,9 +211,10 @@ Router.page(
207
211
  What happens here:
208
212
 
209
213
  - the first argument is the route path
210
- - the optional setup function runs on the server for SSR data loading
211
- - keys prefixed with `_` become route options such as `_auth`, `_layout`, `_static`, or `_redirectLogged`
212
- - every other returned key becomes page data
214
+ - the second argument is the explicit route-options object
215
+ - the third argument is the page data function or `null`
216
+ - route behavior such as `auth`, `layout`, `static`, or `redirectLogged` lives in the options object
217
+ - every key returned from the data function becomes page data
213
218
  - the renderer receives the resolved data and the generated controller/service context
214
219
 
215
220
  ## Example: Controller
@@ -334,6 +339,7 @@ Proteum ships with a compact CLI focused on the real app lifecycle:
334
339
  | `proteum session` | Mint a dev-only auth session token and Playwright-ready cookie payload |
335
340
  | `proteum verify` | Validate framework-facing workflows across one or more running dev apps; `framework-change` is the built-in cross-reference-app check |
336
341
  | `proteum init` | Scaffold a new Proteum app with built-in deterministic templates |
342
+ | `proteum configure agents` | Interactively configure Proteum-managed instruction symlinks and confirm overwrites for standalone or monorepo apps |
337
343
  | `proteum create` | Scaffold a page, controller, command, route, or root service inside an app |
338
344
 
339
345
  Recommended daily workflow:
@@ -347,7 +353,7 @@ proteum build --prod --analyze
347
353
  proteum build --prod --analyze --analyze-serve --analyze-port auto
348
354
  ```
349
355
 
350
- Every human-facing Proteum CLI run prints the welcome banner and includes the active Proteum installation method. `proteum dev` is the only command that clears the interactive terminal before rendering its live session UI, exposes `CTRL+R` reload plus `CTRL+C` shutdown hotkeys, and prints connected app names plus successful connected `/ping` checks in the server-ready banner.
356
+ Only the bare `proteum build` and bare `proteum dev` commands print the welcome banner and include the active Proteum installation method. Any extra argument or option skips the banner. `proteum dev` is the only command that clears the interactive terminal before rendering its live session UI, exposes `CTRL+R` reload plus `CTRL+C` shutdown hotkeys, and prints connected app names plus successful connected `/ping` checks in the server-ready banner.
351
357
 
352
358
  Useful inspection commands:
353
359
 
@@ -383,11 +389,14 @@ Useful scaffolding commands:
383
389
  ```bash
384
390
  proteum init my-app --name "My App"
385
391
  proteum init my-app --name "My App" --dry-run --json
392
+ proteum configure agents
386
393
  proteum create page marketing/faq --route /faq
387
394
  proteum create controller Founder/projects --method list
388
395
  proteum create service Conversion/Plans
389
396
  ```
390
397
 
398
+ `proteum configure agents` asks before replacing any existing non-managed instruction file or foreign symlink. If you decline, that path is left untouched.
399
+
391
400
  `proteum connect`, `proteum explain`, `proteum doctor`, and `proteum diagnose` share the same generated manifest and contract state. `proteum perf` uses the same dev request-trace store as the profiler `Perf` tab. For the full diagnostics and tracing model, see [docs/diagnostics.md](docs/diagnostics.md) and [docs/request-tracing.md](docs/request-tracing.md).
392
401
 
393
402
  ## Dev Commands
@@ -512,7 +521,7 @@ If you are an LLM or automation agent, start here:
512
521
  4. Read `.proteum/manifest.json` or run `proteum explain --json`.
513
522
  5. Inspect `server/controllers/**` for request entrypoints.
514
523
  6. Inspect `server/services/**` for business logic.
515
- 7. Inspect `client/pages/**` for SSR routes and page setup contracts.
524
+ 7. Inspect `client/pages/**` for SSR routes and page data contracts.
516
525
  8. If the task touches a protected route or controller in dev and login UX is not the feature under test, use `proteum session <email> --role <role>` before Playwright or direct HTTP calls.
517
526
 
518
527
  For implementation rules in a real Proteum app, treat the local `AGENTS.md` files plus `proteum explain`, `proteum doctor`, `proteum diagnose`, `proteum perf`, and `proteum trace` as the task contract. This README is the framework overview, not the project-local instruction layer.
@@ -576,6 +585,7 @@ Then use the normal workflow:
576
585
 
577
586
  ```bash
578
587
  npm install
588
+ npx proteum configure agents
579
589
  npx proteum dev
580
590
  npx proteum check
581
591
  npx proteum build --prod
@@ -1,45 +1,71 @@
1
1
  # Proteum Project Contract
2
2
 
3
- This is the canonical contract for Proteum-based projects shipped with Proteum. Narrower `AGENTS.md` files in this folder add area-specific rules on top of this file.
4
- Role: keep only project-wide app rules here.
3
+ This is the canonical standalone-app contract for Proteum-based projects shipped with Proteum. Narrower `AGENTS.md` files in this folder add area-specific rules on top of this file.
4
+ When splitting instructions across a monorepo, put the Proteum-wide rules in the monorepo-root `AGENTS.md` and keep only app-root-specific additions in each Proteum app root `AGENTS.md`.
5
+ Role: keep only project-wide app rules here when one root `AGENTS.md` must carry both the reusable Proteum contract and the app-root addendum.
5
6
  Keep here: cross-cutting project workflow, architecture contracts, shared typing rules, and rules that apply across client, server, pages, and tests.
6
7
  Do not put here: detailed diagnostics workflow, optimization checklists, coding-style details, or narrow area-specific instructions that belong in `diagnostics.md`, `optimizations.md`, `CODING_STYLE.md`, `client/AGENTS.md`, `client/pages/AGENTS.md`, `server/routes/AGENTS.md`, `server/services/AGENTS.md`, or `tests/AGENTS.md`.
7
8
 
8
- Optimization source of truth: project-root `optimizations.md`.
9
- Diagnostics source of truth: project-root `diagnostics.md`.
10
- Coding style source of truth: project-root `CODING_STYLE.md`.
9
+ Optimization source of truth: root-level `optimizations.md`.
10
+ Diagnostics source of truth: root-level `diagnostics.md`.
11
+ Coding style source of truth: root-level `CODING_STYLE.md`.
11
12
 
12
- ## Workflow
13
+ ## Fast Triggers
13
14
 
14
- - At the beginning of every task, acknowledge the applicable optimization, diagnostics, and coding-style sources before analyzing or editing code: project-root `optimizations.md`, project-root `diagnostics.md`, project-root `CODING_STYLE.md`, and any narrower area `AGENTS.md`.
15
+ - If you are working in a newly created Proteum worktree, before following the rest of these instructions:
16
+ - Copy `.env` from the main worktree.
17
+ - Run `npx proteum refresh`.
18
+ - Read and acknowledge the applicable `AGENTS.md` files.
19
+ - Run `npm i`.
20
+ - Run the dev server with the task-safe elevated-permissions launch workflow from `Task Lifecycle`, and keep it running so user can see the results by himself.
15
21
  - If the user pastes raw errors without asking for a fix, do not implement changes. List likely causes and, for each one, give probability, why, and how to fix it.
16
- - Follow project-root `diagnostics.md` for diagnosis, runtime reproduction, temporary instrumentation, error-solving workflow, and verification method selection.
17
- - For new app or artifact boilerplate, prefer `npx proteum init ...` and `npx proteum create ...` before creating files by hand. Use `--dry-run --json` when an agent needs a machine-readable plan before writing files.
18
- - After running `npx proteum create ...`, adapt the generated code to the real feature instead of leaving placeholder logic in place.
19
- - When starting a long-lived dev server for an agent task, prefer `npx proteum dev --session-file <path> --replace-existing --port <port>` so the session can be listed and stopped deterministically later.
20
- - Do not start a second `proteum dev` server for the same app and port until the earlier tracked session has been stopped or replaced.
21
- - When framework work changes Proteum CLI commands, profiler panels/features, or the `proteum dev` banners, keep this file, project-root `diagnostics.md`, and any narrower area `AGENTS.md` that mentions the same workflow aligned with the live framework behavior in the same pass.
22
- - Current CLI banner contract: every human-facing Proteum CLI run prints the welcome banner and includes the active Proteum installation method, while only `proteum dev` clears the interactive terminal before rendering, exposes `CTRL+R` reload plus `CTRL+C` shutdown hotkeys in its session UI, and reports connected app names plus successful connected `/ping` checks in the ready banner.
23
- - Before finishing, double-check the touched files and generated output against the applicable optimization, diagnostics, and coding-style sources: project-root `optimizations.md`, project-root `diagnostics.md`, project-root `CODING_STYLE.md`, and any narrower area `AGENTS.md`.
24
- - After implementing any feature or behavior change, always verify it on a running app before finishing: start the server, exercise the affected flow with Playwright or the smallest real runtime or `npx proteum` surface, run the relevant diagnostics or perf commands, and confirm there is no meaningful regression in behavior, performance, bundle/load size, SEO output, or coding style.
25
- - Before finishing a task, stop every `proteum dev` session started during the task and confirm cleanup with `npx proteum dev list --json` or an explicit `npx proteum dev stop --session-file <path>`.
26
- - When you have finished your work, summarize in one top-level short (up to 100 characters) sentence the changes you made since the beginning of the conversation. Strictly use the Conventional Commits specification:
27
- ```
28
- Commit message: <type>[optional scope]: <description>
29
-
30
- [optional body]
31
- ```
22
+ - If the task is ambiguous, generated, connected, or multi-repo, start with `npx proteum orient <query>` before reading large parts of the codebase.
23
+ - If the user reports an issue, or the agent encounters one during exploration, implementation, verification, or runtime reproduction, load and follow root-level `diagnostics.md`.
24
+ - If the task touches client-side files, especially `client/**` and page files, load and apply root-level `optimizations.md` only after implementation for post-implementation checking and optimization. Skip it at task start and skip it for server-only, test-only, doc-only, and non-client refactor tasks unless the user explicitly asks for optimization work.
25
+ - If the task changes UX, copy, onboarding, pricing, product semantics, or commercial positioning, read the relevant files under `./docs/` first, especially `docs/PERSONAS.md`, `docs/PRODUCT.md`, and `docs/MARKETING.md` when they exist. If a dev server is already running, print the dev server URL.
26
+ - If the task needs new app or artifact boilerplate, prefer `npx proteum init ...` and `npx proteum create ...` before creating files by hand. Use `--dry-run --json` when an agent needs a machine-readable plan before writing files.
27
+ - If you changed `schema.prisma`, do not start testing or validation yet. Ask the user to run the following command in the affected worktree directory, replacing the placeholders, and wait for the user to reply exactly `continue` before resuming validation or tests:
28
+ ```
29
+ cd <worktree path>
30
+ npx prisma migrate dev --config ./prisma.config.ts --name <migration name>
31
+ ```
32
+ - If you encounter `runtime/provider-hook-outside-provider`, `runtime/client-only-hook-in-ssr`, `runtime/router-context-outside-router`, or `runtime/connected-boundary-mismatch`, treat it as a framework contract failure first. Fix the provider, SSR/client, router, or connected boundary before assuming a local leaf-component bug.
33
+ - If the change is runtime-visible, request-time, router, SSR, browser-visible, or controller-behavior, use running-app verification.
34
+ - If the change is docs-only, wording-only, type-only, test-only, generated-output cleanup, or a clearly local non-runtime refactor, use static verification only unless the user explicitly asks for runtime verification or the agent finds a real issue.
35
+ - If the user replies exactly `commit`, generate one top-level short (up to 100 characters) sentence covering all changes made since the last `commit` and, if there has been no prior `commit`, since the beginning of the whole conversation, strictly using the Conventional Commits specification:
36
+ ```
37
+ <type>[optional scope]: <description>
38
+
39
+ [optional body]
40
+ ```
41
+ Then use that generated message, stage the task-related changed files with `git add` while avoiding unrelated user changes or incidental untracked files, and create the commit by running `git commit`. Do not stop at only suggesting the message.
42
+ After providing a commit message or after creating a commit, immediately follow it with this exact prompt and obey it:
43
+ `Explain in short minimalistic and few bullet points what we changed in this thread, like you would do to your grandma. Start with a verb in the past.`
44
+
45
+ ## Task Lifecycle
46
+
47
+ ### Before Editing
48
+
49
+ - Before changing any file, load root-level `CODING_STYLE.md` and any narrower area `AGENTS.md` that applies to the touched files. Do not spend response space explicitly acknowledging those reads unless the user asks.
50
+
51
+ ### During Implementation
32
52
 
33
- ## Project Shape
53
+ - After running `npx proteum create ...`, adapt the generated code to the real feature instead of leaving placeholder logic in place.
54
+ - When starting a long-lived dev server for an agent task, always request elevated permissions and run `npx proteum dev` outside the sandbox. Use an explicit task/thread-scoped session file such as `var/run/proteum/dev/agents/<task>.json`, inspect `npx proteum dev list --json` plus current listeners first, for example with `lsof -nP -iTCP -sTCP:LISTEN`, then choose a port that is not currently used before starting `npx proteum dev --session-file <path> --port <port>`.
55
+ - Use `--replace-existing` only when restarting the exact session file started by the current thread/task. Never replace another live session that belongs to a user, another thread, or an unknown owner.
56
+ - If the current app depends on local `file:` connected projects, boot every connected producer app too, each with its own task-scoped session file and free port, and run every one of those `proteum dev` processes with elevated permissions outside the sandbox before starting or verifying the consumer app.
57
+ - For raw browser automation, use `npx proteum verify browser` when it matches the task, or direct Playwright with a disposable profile when lower-level control is required. Bootstrap protected browser state through `npx proteum session`.
58
+ - Current CLI banner contract: only the bare `proteum build` and bare `proteum dev` commands print the welcome banner and include the active Proteum installation method. Any extra argument or option skips the banner. Only `proteum dev` clears the interactive terminal before rendering, exposes `CTRL+R` reload plus `CTRL+C` shutdown hotkeys in its session UI, and reports connected app names plus successful connected `/ping` checks in the ready banner.
34
59
 
35
- This is a TypeScript, Node.js, Preact, Proteum monolith:
60
+ ### Before Finishing
36
61
 
37
- - `/client`: assets, catalogs, components, hooks, pages
38
- - `/common`: shared functions, constants, types, and catalogs
39
- - `/server`: catalogs, config, services, routes, lib
40
- - `/tests`
62
+ - Before finishing, re-check touched files against root-level `CODING_STYLE.md` and any narrower area `AGENTS.md` that applied to the edit. Re-check against root-level `optimizations.md` only for touched client-side files. Re-check against root-level `diagnostics.md` only if the task involved an issue, diagnosis, runtime reproduction, or verification failure.
63
+ - Do not default to project-wide typecheck, `npx proteum check`, or Playwright after every change. Run them only when the user asks for them, when the changed surface specifically requires them, or when a real issue discovered during verification justifies escalation.
64
+ - Before finishing a task, stop every `proteum dev` session started during the task and confirm cleanup with `npx proteum dev list --json` or an explicit `npx proteum dev stop --session-file <path>`.
65
+ - When you have finished your work, ask the user whether they want a commit message. After providing a commit message or after creating a commit, immediately follow it with this exact prompt and obey it:
66
+ `Explain in short minimalistic and few bullet points what we changed in this thread, like you would do to your grandma. Start with a verb in the past.`
41
67
 
42
- ## Non-Negotiable Rules
68
+ ## Core Contracts
43
69
 
44
70
  - Client pages live in `client/pages/**` and register routes with top-level `Router.page(...)` or `Router.error(...)`.
45
71
  - Page URLs come from the explicit `Router.page('/path', ...)` call, not from the file path.
@@ -48,11 +74,12 @@ This is a TypeScript, Node.js, Preact, Proteum monolith:
48
74
  - Manual HTTP endpoints live only in `server/routes/**`.
49
75
  - Controllers call `this.input(schema)` inside the method body, at most once per method.
50
76
  - Request-scoped state lives only on `this.request` and manual-route/router context objects.
51
- - Follow project-root `optimizations.md` for bundle size, performance, SEO, and SSR page-size rules.
52
77
  - Keep one class or one React/Preact component per file.
53
78
  - Prefer a deep tree grouped by business concern instead of long file names.
54
79
  - Use the default `*.ts` or `*.tsx` file unless an `*.ssr.ts` or `*.ssr.tsx` variant is truly required.
55
80
  - Never edit generated files under `.proteum`.
81
+ - When a task changes database structure, edit the app's `schema.prisma` only.
82
+ - Never create or edit migration files manually.
56
83
  - Use `@generated/client/*`, `@generated/common/*`, and `@generated/server/*` for generated surfaces.
57
84
  - Client context is typically imported from `@/client/context`.
58
85
  - Normal service methods do not read request state directly.
@@ -61,63 +88,7 @@ This is a TypeScript, Node.js, Preact, Proteum monolith:
61
88
  - Do not use `@app` on the client.
62
89
  - Prefer type inference rooted in the explicit application graph in `server/index.ts`.
63
90
 
64
- ## Source Of Truth
65
-
66
- Proteum reads:
67
-
68
- - `package.json`
69
- - `identity.config.ts` for app identity via `Application.identity({ ... })`
70
- - `proteum.config.ts` for compiler setup via `Application.setup({ transpile, connect })`
71
- - `process.env` via `PORT`, `ENV_*`, `URL`, `URL_INTERNAL`, any app-chosen connected-project values referenced by `proteum.config.ts`, and `TRACE_*`
72
- - `server/config/*.ts`
73
- - `server/index.ts`
74
- - `commands/**/*.ts`
75
- - `server/controllers/**/*.ts`
76
- - `server/routes/**/*.ts`
77
- - `client/pages/**/*.ts(x)`
78
- - `client/pages/**/_layout/index.tsx`
79
- - `public/**`
80
-
81
- Proteum owns:
82
-
83
- - `.proteum/manifest.json`
84
- - `.proteum/client/*`
85
- - `.proteum/common/*`
86
- - `.proteum/server/*`
87
-
88
- Project code should consume:
89
-
90
- - `@generated/client/*`
91
- - `@generated/common/*`
92
- - `@generated/server/*`
93
- - `@/client/context` as the generated client context entrypoint
94
-
95
- Prefer structured CLI surfaces over re-deriving framework facts from source:
96
-
97
- - `npx proteum connect --json`
98
- - `npx proteum connect --controllers --strict`
99
- - `npx proteum explain --json`
100
- - `npx proteum explain --connected --controllers`
101
- - `npx proteum explain owner <query>`
102
- - `npx proteum doctor --json`
103
- - `npx proteum doctor --contracts --json`
104
- - `npx proteum diagnose <path> --port <port>`
105
- - `npx proteum perf ...`
106
- - `npx proteum trace ...`
107
- - `npx proteum command ...`
108
- - `npx proteum session ...`
109
- - `npx proteum create ... --dry-run --json`
110
- - `npx proteum dev list --json`
111
- - `npx proteum dev stop --session-file <path>`
112
-
113
- Prefer scaffold commands before hand-writing boilerplate:
114
-
115
- - Use `npx proteum init <directory> --name <name>` for new apps.
116
- - Use `npx proteum init ... --dry-run --json` when an agent needs a machine-readable app plan before writing files.
117
- - Use `npx proteum create page|controller|command|route|service <target>` for new app artifacts before creating the files manually.
118
- - Use `npx proteum create ... --dry-run --json` when an agent needs a machine-readable artifact plan before writing files.
119
-
120
- ## File Contracts
91
+ ## Surface Contracts
121
92
 
122
93
  ### App Bootstrap And Services
123
94
 
@@ -138,6 +109,7 @@ Prefer scaffold commands before hand-writing boilerplate:
138
109
  - Declare connected namespaces in `proteum.config.ts` with explicit values such as `connect: { Product: { source: PRODUCT_CONNECTED_SOURCE, urlInternal: PRODUCT_URL_INTERNAL } }`.
139
110
  - Proteum does not infer connected env key names from the namespace. The source and internal URL must be provided explicitly in `proteum.config.ts`.
140
111
  - Use `npx proteum connect` to inspect configured connect values, cached contract state, and imported controllers for the current app.
112
+ - Before launching a consumer app that depends on local `file:` connected sources, launch every connected producer app too, assign each one a free port, run each `proteum dev` outside the sandbox with elevated permissions, and make sure `connect.<Namespace>.urlInternal` resolves to those live producer URLs.
141
113
  - `file:` connected sources point at another Proteum app root and keep strong connected typings.
142
114
  - Non-local connected sources provide runtime helper generation but are intentionally typed loosely.
143
115
 
@@ -164,14 +136,14 @@ Prefer scaffold commands before hand-writing boilerplate:
164
136
 
165
137
  - Proteum scans page files for top-level `Router.page(...)` and `Router.error(...)` calls.
166
138
  - File path controls chunk identity and layout discovery; route path comes from the explicit `Router.page(...)` string.
167
- - Supported page signatures are `Router.page(path, render)`, `Router.page(path, setup, render)`, `Router.page(path, options, render)`, and `Router.page(path, options, setup, render)`.
168
- - For new work, prefer `Router.page(path, setup, render)` or `Router.page(path, options, setup, render)`.
169
- - `setup` returns one flat object. Reserved keys like `_auth`, `_layout`, `_static`, and `_redirectLogged` are route options; all other keys are SSR data.
170
- - Controller fetchers and promises returned from `setup` resolve before render.
171
- - `render` consumes resolved setup data and uses generated controller methods from render args or `@/client/context`.
172
- - Use `api.reload(...)` or `api.set(...)` only when intentionally mutating active page setup state.
139
+ - The only supported page signature is `Router.page(path, options, data, render)`.
140
+ - `options` is always required. `data` is the only nullable argument and must be `null` when the page has no SSR data loader.
141
+ - `data` returns one flat object. Route-option keys such as `auth`, `layout`, `static`, and `_static` are forbidden in page data and must live in `options`.
142
+ - Controller fetchers and promises returned from `data` resolve before render.
143
+ - `render` consumes resolved page data and uses generated controller methods from render args or `@/client/context`.
144
+ - Use `api.reload(...)` or `api.set(...)` only when intentionally mutating active page data state.
173
145
  - Error pages use `Router.error(code, options, render)` in `client/pages/_messages/**`.
174
- - Prefer `proteum create page ...` for new page boilerplate, then review the explicit route path and setup payload.
146
+ - Prefer `proteum create page ...` for new page boilerplate, then review the explicit route path, options object, and data payload.
175
147
 
176
148
  ### Manual Routes
177
149
 
@@ -193,15 +165,31 @@ Prefer scaffold commands before hand-writing boilerplate:
193
165
  - `@app`: server-side application services for manual routes only
194
166
  - `@generated/*`: generated app surfaces
195
167
 
196
- ## Dependency Selection
168
+ ## Verification Matrix
169
+
170
+ Verify at the correct layer:
171
+
172
+ - Default: use the cheapest trustworthy verification for the changed surface first, then escalate only if the changed surface justifies it.
173
+ - Route additions: boot the app and hit the real URL.
174
+ - Controller changes: exercise the generated client call or generated `/api/...` endpoint.
175
+ - SSR changes: load the real page and inspect rendered HTML plus browser console.
176
+ - Router or plugin changes: verify request context, auth, redirects, metrics, and validation on a running app.
177
+ - Generated, connected, or ownership-ambiguous changes: start with `npx proteum orient <query>` and prefer `npx proteum verify owner <query>` before broad global checks.
178
+ - Browser-visible issues: prefer `npx proteum verify browser <path>` or the narrowest targeted Playwright pass only after request-level verification is insufficient.
179
+ - Raw browser execution beyond `npx proteum verify browser`: use direct Playwright with a disposable profile, and keep that step for the final verifier agent unless a narrower surface cannot reproduce the issue.
180
+ - For trace-first reproduction, session-based auth setup, temporary logs, and post-fix surface checks, follow root-level `diagnostics.md`.
181
+
182
+ ## Implementation Rules
183
+
184
+ ### Dependency Selection
197
185
 
198
186
  - Before implementing a feature or change, first check whether the repo already includes a suitable dependency.
199
187
  - If not, search npm before building a new utility, abstraction, component primitive, parser, formatter, or integration from scratch.
200
188
  - Prefer the most popular, flexible, maintained packages that fit the project constraints.
201
- - Follow project-root `optimizations.md` when deciding whether custom infrastructure is justified over an existing package.
189
+ - When the task explicitly involves client-side optimization work, use root-level `optimizations.md` to decide whether custom infrastructure is justified over an existing package.
202
190
  - When you choose custom over a package, explain the reason briefly.
203
191
 
204
- ## Catalogs And Typing
192
+ ### Catalogs And Typing
205
193
 
206
194
  - Keep one canonical catalog or registry file and import it everywhere else.
207
195
  - Client-only catalogs live in `/client/catalogs/**`, server-only catalogs in `/server/catalogs/**`, and shared catalogs in `/common/catalogs/**`.
@@ -211,7 +199,7 @@ Prefer scaffold commands before hand-writing boilerplate:
211
199
  - Fix typing issues only on code you wrote.
212
200
  - Never cast with `as any` or `as unknown`; fix the contract or add an explicit typed adapter.
213
201
 
214
- ## Design Rules
202
+ ### Design Rules
215
203
 
216
204
  - Prefer explicit `server/index.ts` bootstrap over hidden registration.
217
205
  - Prefer controller-backed app APIs over ad hoc manual `/api/...` routes.
@@ -219,25 +207,93 @@ Prefer scaffold commands before hand-writing boilerplate:
219
207
  - Keep one canonical source of truth for catalogs, registries, and shared types.
220
208
  - Reuse shared Shadcn-based UI primitives when the project already provides them.
221
209
 
222
- ## Discouraged Patterns
210
+ ### Discouraged Patterns
223
211
 
224
212
  - request-scoped state inside normal service methods
225
213
  - hiding route registration behind abstractions that remove the top-level `Router.page(...)` call
226
214
  - editing `.proteum` directly
227
215
 
228
- ## Verification
216
+ ## Hard Stops
229
217
 
230
- Verify at the correct layer:
218
+ - Never run schema-mutating SQL such as `ALTER TABLE`, `CREATE TABLE`, `DROP TABLE`, or `CREATE INDEX` to change database structure.
219
+ - Do not run `prisma *` yourself. If a schema change requires migration, ask the user to run `npx prisma migrate dev --config ./prisma.config.ts --name <migration name>` and wait for `continue`.
220
+ - Do not run `git restore` or `git reset`.
221
+ - Do not run write-mode git commands by default. The built-in exception is an exact `commit` reply, which allows only task-scoped `git add` and `git commit`. Any other write-mode git action requires an explicit user request.
231
222
 
232
- - route additions: boot the app and hit the real URL
233
- - controller changes: exercise the generated client call or generated `/api/...` endpoint
234
- - SSR changes: load the real page and inspect rendered HTML plus browser console
235
- - router or plugin changes: verify request context, auth, redirects, metrics, and validation on a running app
236
- - For trace-first reproduction, session-based auth setup, temporary logs, and post-fix surface checks, follow project-root `diagnostics.md`.
223
+ ## Appendix
237
224
 
238
- Useful commands: `npx proteum init <dir> --name <name>`, `npx proteum create <kind> <target>`, `proteum dev`, `proteum dev list --json`, `proteum dev stop --session-file <path>`, `npx proteum refresh`, `npx proteum typecheck`, `npx proteum lint`, `npx proteum check`, `npx proteum build prod`, `npx proteum build --prod --analyze`, `npx proteum build --prod --analyze --analyze-serve --analyze-port auto`, `npx proteum perf top`, `npx proteum perf request <requestId|path>`, `npx proteum perf compare --baseline yesterday --target today`, `npx proteum command <path>`, `npx proteum session <email> --role <role>`.
225
+ ### Project Shape
239
226
 
240
- ## High-Impact Files
227
+ This is a TypeScript, Node.js, Preact, Proteum monolith:
228
+
229
+ - `/client`: assets, catalogs, components, hooks, pages
230
+ - `/common`: shared functions, constants, types, and catalogs
231
+ - `/server`: catalogs, config, services, routes, lib
232
+ - `/tests`
233
+
234
+ ### Source Of Truth
235
+
236
+ Proteum reads:
237
+
238
+ - `package.json`
239
+ - `identity.config.ts` for app identity via `Application.identity({ ... })`
240
+ - `proteum.config.ts` for compiler setup via `Application.setup({ transpile, connect })`
241
+ - `process.env` via `PORT`, `ENV_*`, `URL`, `URL_INTERNAL`, any app-chosen connected-project values referenced by `proteum.config.ts`, and `TRACE_*`
242
+ - `server/config/*.ts`
243
+ - `server/index.ts`
244
+ - `commands/**/*.ts`
245
+ - `server/controllers/**/*.ts`
246
+ - `server/routes/**/*.ts`
247
+ - `client/pages/**/*.ts(x)`
248
+ - `client/pages/**/_layout/index.tsx`
249
+ - `public/**`
250
+
251
+ Proteum owns:
252
+
253
+ - `.proteum/manifest.json`
254
+ - `.proteum/client/*`
255
+ - `.proteum/common/*`
256
+ - `.proteum/server/*`
257
+
258
+ Project code should consume:
259
+
260
+ - `@generated/client/*`
261
+ - `@generated/common/*`
262
+ - `@generated/server/*`
263
+ - `@/client/context` as the generated client context entrypoint
264
+
265
+ ### Useful Commands
266
+
267
+ Prefer structured CLI surfaces over re-deriving framework facts from source:
268
+
269
+ - `npx proteum connect --json`
270
+ - `npx proteum connect --controllers --strict`
271
+ - `npx proteum orient <query>`
272
+ - `npx proteum explain --json`
273
+ - `npx proteum explain --connected --controllers`
274
+ - `npx proteum explain owner <query>`
275
+ - `npx proteum doctor --json`
276
+ - `npx proteum doctor --contracts --json`
277
+ - `npx proteum diagnose <path> --port <port>`
278
+ - `npx proteum verify owner <query>`
279
+ - `npx proteum verify request <path>`
280
+ - `npx proteum verify browser <path>`
281
+ - `npx proteum perf ...`
282
+ - `npx proteum trace ...`
283
+ - `npx proteum command ...`
284
+ - `npx proteum session ...`
285
+ - `npx proteum create ... --dry-run --json`
286
+ - `npx proteum dev list --json`
287
+ - `npx proteum dev stop --session-file <path>`
288
+
289
+ Prefer scaffold commands before hand-writing boilerplate:
290
+
291
+ - `npx proteum init <directory> --name <name>`
292
+ - `npx proteum init ... --dry-run --json`
293
+ - `npx proteum create page|controller|command|route|service <target>`
294
+ - `npx proteum create ... --dry-run --json`
295
+
296
+ ### High-Impact Files
241
297
 
242
298
  Edit these only when required, and keep changes minimal and explicit:
243
299
 
@@ -245,14 +301,3 @@ Edit these only when required, and keep changes minimal and explicit:
245
301
  - `PORT`, `ENV_*`, `URL`, and `TRACE_*` env setup
246
302
  - Prisma-generated files
247
303
  - symbolic links
248
-
249
- ## Commands Not To Run
250
-
251
- - `git restore`
252
- - `git reset`
253
- - `prisma *`
254
- - any write-mode git command
255
-
256
- ## Product And UX Docs
257
-
258
- If the task changes UX, copy, onboarding, pricing, product semantics, or commercial positioning, read the relevant files under `./docs/` first, especially `docs/PERSONAS.md`, `docs/PRODUCT.md`, and `docs/MARKETING.md` when they exist.
@@ -17,7 +17,7 @@ This file is the source of truth for codex coding style instructions in Proteum-
17
17
  - Keep short arrow functions and short returned object literals compact when they are easy to scan.
18
18
  - Keep JSX multiline only when it is clearly more readable; otherwise keep short JSX compact.
19
19
  - Avoid staircase formatting and unnecessary blank lines inside short callbacks.
20
- - Keep `Router.page(...)` and `Router.error(...)` registrations in the compact inline-call shape when possible, for example `Router.page('/path', setup, render);`.
20
+ - Keep `Router.page(...)` and `Router.error(...)` registrations in the compact inline-call shape when possible, for example `Router.page('/path', {}, null, render);`.
21
21
 
22
22
  ## File organization
23
23
 
@@ -0,0 +1,16 @@
1
+ # Proteum App-Root Addendum
2
+
3
+ This file is the app-root-only addendum for a Proteum app that lives inside a larger monorepo.
4
+ Keep the reusable Proteum contract in the nearest ancestor root `AGENTS.md`, and keep this file only for instructions that depend on the current directory being the Proteum app root.
5
+ Role: keep only app-root workflow and local project-semantic rules here.
6
+ Do not put here: reusable Proteum architecture contracts, shared verification rules, diagnostics workflow, optimization checklists, coding-style details, or area-specific rules already covered by broader `AGENTS.md` files or the root-level `diagnostics.md`, `optimizations.md`, and `CODING_STYLE.md`.
7
+
8
+ ## App-Root Triggers
9
+
10
+ - If you are working in a newly created Proteum worktree, before following the rest of these instructions:
11
+ - Copy `.env` from the main worktree.
12
+ - Run `npx proteum refresh`.
13
+ - Read and acknowledge the applicable `AGENTS.md` files.
14
+ - Run `npm i`.
15
+ - Run the dev server with the task-safe elevated-permissions launch workflow from the reusable root `AGENTS.md`, and keep it running so user can see the results by himself.
16
+ - If the task changes UX, copy, onboarding, pricing, product semantics, or commercial positioning, read the relevant files under `./docs/` first, especially `docs/PERSONAS.md`, `docs/PRODUCT.md`, and `docs/MARKETING.md` when they exist. If a dev server is already running, print the dev server URL.