@dall337/lore 0.0.0-stage → 0.1.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.
- package/License.md +21 -0
- package/README.md +210 -2
- package/bin/lore.mjs +187 -0
- package/hud/dist/client/assets/index-BA5GHj6l.css +1 -0
- package/hud/dist/client/assets/index-C1P2dBAT.js +7 -0
- package/hud/dist/client/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/hud/dist/client/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
- package/hud/dist/client/assets/jetbrains-mono-cyrillic-600-normal-8K4wrrwR.woff +0 -0
- package/hud/dist/client/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
- package/hud/dist/client/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
- package/hud/dist/client/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/hud/dist/client/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
- package/hud/dist/client/assets/jetbrains-mono-greek-600-normal-mc2nkWzM.woff +0 -0
- package/hud/dist/client/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/hud/dist/client/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/hud/dist/client/assets/jetbrains-mono-latin-600-normal-BfsvjouI.woff +0 -0
- package/hud/dist/client/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/hud/dist/client/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/hud/dist/client/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
- package/hud/dist/client/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
- package/hud/dist/client/assets/jetbrains-mono-latin-ext-600-normal-DObL3zCW.woff +0 -0
- package/hud/dist/client/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
- package/hud/dist/client/assets/jetbrains-mono-vietnamese-600-normal-OWROknRo.woff +0 -0
- package/hud/dist/client/index.html +17 -0
- package/hud/dist/client/licenses/JetBrainsMono-OFL.txt +93 -0
- package/hud/dist/server/main.js +1287 -0
- package/package.json +52 -4
- package/suite/AGENTS.md +228 -0
- package/suite/CLAUDE.md +19 -0
- package/suite/claude-settings-additions.json +16 -0
- package/suite/gitignore-additions.txt +17 -0
- package/suite/memory/INDEX.md +41 -0
- package/suite/policies/adversarial-check.md +169 -0
- package/suite/policies/board.md +103 -0
- package/suite/policies/creative.md +92 -0
- package/suite/policies/documentation.md +100 -0
- package/suite/policies/git.md +105 -0
- package/suite/policies/implementation.md +100 -0
- package/suite/policies/memory.md +453 -0
- package/suite/policies/orchestration.md +184 -0
- package/suite/policies/release.md +56 -0
- package/suite/policies/research.md +133 -0
- package/suite/policies/reserved/failure-and-recovery.md +6 -0
- package/suite/policies/reserved/migration.md +6 -0
- package/suite/policies/reserved/planning.md +6 -0
- package/suite/policies/reserved/review.md +6 -0
- package/suite/policies/reserved/test-authoring.md +6 -0
- package/suite/policies/security.md +85 -0
- package/suite/policies/tooling.md +153 -0
- package/suite/policies/verification.md +60 -0
- package/suite/scripts/agents-md-budget.mjs +71 -0
- package/suite/scripts/memory-lint.mjs +117 -0
- package/suite/scripts/provider-memory.mjs +298 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Creative Mode Policy
|
|
2
|
+
|
|
3
|
+
Scoped agent-governance procedure (AGENTS.md §1/§2). Load when the owner
|
|
4
|
+
invokes creative mode or asks to explore an inventive direction, an unusual
|
|
5
|
+
connection, or an unfinished idea. These are starting principles; this
|
|
6
|
+
project's own lessons accumulate here with their provenance.
|
|
7
|
+
|
|
8
|
+
Creative mode is a conversation in which the owner and agent give an idea
|
|
9
|
+
room to find its shape. A stray thought, a feeling, or a strange analogy is
|
|
10
|
+
enough to begin. Specificity can emerge over many exchanges; discovering
|
|
11
|
+
an interesting direction is a useful outcome in itself.
|
|
12
|
+
|
|
13
|
+
## Rule 1 — Keep the Possibility Alive
|
|
14
|
+
|
|
15
|
+
Do not close an exploration with an outright "no," "that cannot work," or
|
|
16
|
+
"that is impossible." When the first reading of an idea encounters
|
|
17
|
+
difficulty, look for another interpretation, variation, scale, or framing
|
|
18
|
+
that preserves what interests the owner. Explain the possibility that
|
|
19
|
+
opens up and give them something to build on.
|
|
20
|
+
|
|
21
|
+
Meet the seed with curiosity. Find the experience, quality, or connection
|
|
22
|
+
it is reaching for before evaluating a particular realization. An idea
|
|
23
|
+
that is vague, internally inconsistent, or impractical in its initial form
|
|
24
|
+
still has room to develop through conversation.
|
|
25
|
+
|
|
26
|
+
## Rule 2 — Follow the Possibility
|
|
27
|
+
|
|
28
|
+
Use the app, script, story, or concept's existing shape as material for
|
|
29
|
+
exploration: its purpose, vocabulary, interactions, and distinctive
|
|
30
|
+
qualities. Familiar choices and apparent limits can suggest a new angle.
|
|
31
|
+
|
|
32
|
+
Keep the initial response conversational. Offer an interpretation or a
|
|
33
|
+
small sketch; ask a focused question when it would open an interesting
|
|
34
|
+
branch. Let the owner's reaction reveal which part matters. Avoid turning
|
|
35
|
+
the first exchange into a requirements interview, a hard-constraint
|
|
36
|
+
checklist, or a scientific exposition.
|
|
37
|
+
|
|
38
|
+
## Rule 3 — Look Across Disciplines
|
|
39
|
+
|
|
40
|
+
Look for a useful connection in another discipline: a behavior, pattern,
|
|
41
|
+
structure, sensation, or mechanism that could take a new form here.
|
|
42
|
+
Movement, feedback, rhythm, coordination, adaptation, and storytelling
|
|
43
|
+
are possible starting points; follow whichever connection has life in it.
|
|
44
|
+
|
|
45
|
+
Translate enough of the connection to make it imaginable. Describe what
|
|
46
|
+
could carry over and what it might become in this context. The borrowed
|
|
47
|
+
idea can be literal, selective, metaphorical, or deliberately transformed.
|
|
48
|
+
It does not have to reproduce its source discipline faithfully to be
|
|
49
|
+
worth exploring.
|
|
50
|
+
|
|
51
|
+
Share a few promising sketches at a time. Let the conversation deepen a
|
|
52
|
+
connection, combine fragments, or abandon a branch as the owner responds.
|
|
53
|
+
There is no novelty quota and no requirement to visit a set number of
|
|
54
|
+
disciplines.
|
|
55
|
+
|
|
56
|
+
## Rule 4 — Develop It Together
|
|
57
|
+
|
|
58
|
+
Be an active participant: contribute images, examples, variations, and
|
|
59
|
+
unexpected connections. Follow the owner's additions and remixes, including
|
|
60
|
+
tangents that change what the original thought was about. A question
|
|
61
|
+
should help the conversation move; avoid making the owner supply all the
|
|
62
|
+
imagination or choose repeatedly from a fixed menu.
|
|
63
|
+
|
|
64
|
+
Do not force convergence, a feature specification, or a deliverable.
|
|
65
|
+
Continue exploring while the owner is engaged. Summarize the current
|
|
66
|
+
thread occasionally so both participants can see what has emerged and
|
|
67
|
+
which possibilities remain open.
|
|
68
|
+
|
|
69
|
+
## Rule 5 — Give Speculation Room
|
|
70
|
+
|
|
71
|
+
Use language such as "imagine if," "one version might," and "we could
|
|
72
|
+
borrow" to keep imaginative suggestions recognizable as suggestions.
|
|
73
|
+
Leave technical unknowns open while exploring them. Avoid presenting an
|
|
74
|
+
invented fact as established or an untried mechanism as demonstrated.
|
|
75
|
+
|
|
76
|
+
Move into factual research, feasibility analysis, or
|
|
77
|
+
[adversarial checking](adversarial-check.md)
|
|
78
|
+
when the owner asks for that kind of evaluation or chooses to develop a
|
|
79
|
+
concrete proposal. Do not automatically subject each new thought to those
|
|
80
|
+
procedures. Their own policies govern that work when it begins.
|
|
81
|
+
|
|
82
|
+
## Rule 6 — Let the Owner Set the Next Step
|
|
83
|
+
|
|
84
|
+
When the owner wants to make a direction specific, help express the idea
|
|
85
|
+
that has emerged and propose a small sketch, mockup, prototype, or
|
|
86
|
+
experiment that would teach something useful. Agree the scope before
|
|
87
|
+
turning exploratory possibilities into implementation work.
|
|
88
|
+
|
|
89
|
+
The conversation may also remain an exploration. When the owner wants to
|
|
90
|
+
retain a direction, capture it in an appropriate brief or proposal under
|
|
91
|
+
the [documentation policy](documentation.md). Preserve its open questions
|
|
92
|
+
and distinguish possibilities from decisions.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Documentation Policy
|
|
2
|
+
|
|
3
|
+
Scoped agent-governance procedure (AGENTS.md §1/§2). Load when creating
|
|
4
|
+
or updating repo documents — ADRs, briefs, plans, RFCs, PRDs, notes.
|
|
5
|
+
|
|
6
|
+
## Rule 1 — Document Kinds: Home, Scope, Naming
|
|
7
|
+
|
|
8
|
+
Every repo document is one of these kinds. Pick the kind before writing;
|
|
9
|
+
don't blend scopes.
|
|
10
|
+
|
|
11
|
+
| Kind | Home + naming | Scope — what belongs in it |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| ADR | `docs/adrs/NNN-kebab-title.md` | **Normative decisions only** — what was decided and why, alternatives rejected, consequences. Detailed design does NOT belong here; the ADR cites the brief/plan as the canonical detailed design. |
|
|
14
|
+
| Brief / design doc | `docs/plans/**/brief-<topic>.md` | The full design: investigation evidence, mechanisms, trade-offs, open questions. May precede its ADR. |
|
|
15
|
+
| Build plan | `docs/plans/<area>/…-build-plan.md` | Delivery slices, each with Goal / Tasks / Tests / Acceptance. Owns sequencing, not decisions. |
|
|
16
|
+
| RFC / PRD | `docs/rfcs/`, `docs/prds/` | Early-shape proposals and product requirements. When an ADR supersedes parts of one, add a dated supersession note to the old doc — never silently rewrite it. |
|
|
17
|
+
| Tooling register | `docs/TOOLING.md` | The stack and its rationale (`policies/tooling.md` §2). |
|
|
18
|
+
| Research journal | `.research/<date>-<task>.md` (gitignored) | Investigation state per `policies/research.md`. Never a home for repo-facing content. |
|
|
19
|
+
| Memory | Entry point configured in AGENTS.md §5; bundled default is `memory/**` (gitignored) | Operational records per `policies/memory.md` §0; canonical repo-facing docs stay in their documented homes. |
|
|
20
|
+
|
|
21
|
+
Adapt homes and naming to the project's layout on adoption — then keep
|
|
22
|
+
this table true.
|
|
23
|
+
|
|
24
|
+
> **Addendum (2026-10-02, configurable memory):** The memory row points
|
|
25
|
+
> to the configured provider, including existing agent or company memory.
|
|
26
|
+
> Its own content conventions apply; the bundled folder is optional.
|
|
27
|
+
|
|
28
|
+
## Rule 2 — Amend, Never Rewrite
|
|
29
|
+
|
|
30
|
+
Accepted documents grow by dated addenda and blockquote errata
|
|
31
|
+
(`> **Erratum (date, context):** …`). ADR status is a **ledger**: every
|
|
32
|
+
state with its date and one-line context, original `Proposed` kept at the
|
|
33
|
+
bottom. History stays legible in the document itself.
|
|
34
|
+
|
|
35
|
+
ADR skeleton (house format): `# ADR-NNN: Title` → `## Status` (ledger) →
|
|
36
|
+
`## Date` → `## Context` → `## Decision` (numbered subsections) →
|
|
37
|
+
`## Consequences` (positive / costs) → `## Alternatives Considered` →
|
|
38
|
+
`## Scope Notes` → optional `## Implementation Follow-ups`.
|
|
39
|
+
|
|
40
|
+
## Rule 3 — Pointers Over Restatement
|
|
41
|
+
|
|
42
|
+
Never restate what another artifact owns. Enforcement code is the record
|
|
43
|
+
of what it enforces — cite it, don't copy its lists. Architecture docs
|
|
44
|
+
own architecture; code constants own values; the tooling register owns
|
|
45
|
+
the stack. A copied list is a future contradiction.
|
|
46
|
+
|
|
47
|
+
## Rule 4 — Provenance on Every Claim That Needs Trust
|
|
48
|
+
|
|
49
|
+
Date status changes and addenda. Attribute decisions ("owner decision,
|
|
50
|
+
date"). Name the PR that delivered a slice. When a document records an
|
|
51
|
+
empirical finding, say how it was verified. (This is the accumulation
|
|
52
|
+
convention of AGENTS.md §3 applied to all documents, not just policy.)
|
|
53
|
+
|
|
54
|
+
## Rule 5 — Documents Live in the Working Tree
|
|
55
|
+
|
|
56
|
+
Any document an agent creates for the repository must be present in the
|
|
57
|
+
local working tree when the turn ends. If it was committed on a branch,
|
|
58
|
+
leave that branch checked out (or otherwise ensure the file exists in the
|
|
59
|
+
tree) — do not switch away and let the doc vanish from the owner's view.
|
|
60
|
+
Do not park repo documents in scratch directories or out-of-tree
|
|
61
|
+
locations; the only out-of-tree content is agent memory and research
|
|
62
|
+
journals, which are governed by their own policies. When sharing a link
|
|
63
|
+
to a doc on an unmerged branch, prefer the PR "Files" URL over a branch
|
|
64
|
+
blob URL, and say explicitly the doc is pending merge.
|
|
65
|
+
|
|
66
|
+
Docs ride with their code (`policies/git.md` §2.3): a doc describing
|
|
67
|
+
unmerged behavior belongs on that branch, not the default branch.
|
|
68
|
+
|
|
69
|
+
## Rule 6 — Lint Stance
|
|
70
|
+
|
|
71
|
+
*(Adopt-time slot.)* The project declares whether markdown linting is a
|
|
72
|
+
quality gate. Default shipped stance: follow standard markdown
|
|
73
|
+
conventions; lint warnings are not a gate.
|
|
74
|
+
|
|
75
|
+
## Rule 7 — Agent-Drafted Specifics Are Unverified Until Checked
|
|
76
|
+
|
|
77
|
+
Proper nouns in an agent-drafted document are hypotheses, not facts:
|
|
78
|
+
entity and product names, people, URLs, versions, license identifiers,
|
|
79
|
+
citations, file paths, identifiers of every kind. They carry no authority
|
|
80
|
+
from having been written down fluently, and none from having survived
|
|
81
|
+
several readings — a specific that reads as settled is not the same as a
|
|
82
|
+
specific that was ever true.
|
|
83
|
+
|
|
84
|
+
This applies with full force to text inherited from an earlier session,
|
|
85
|
+
an earlier draft, or an earlier agent. Provenance *inside* the document
|
|
86
|
+
set is not verification; a fabricated name copied forward is still
|
|
87
|
+
fabricated at every hop, and each hop makes it look more established.
|
|
88
|
+
|
|
89
|
+
**Before a document becomes load-bearing** — a license, a register entry,
|
|
90
|
+
a published README, a contract, anything an outside reader will act on —
|
|
91
|
+
check every proper noun in it against something outside the document.
|
|
92
|
+
Ask of each: what evidence, outside this file, says this exists?
|
|
93
|
+
|
|
94
|
+
**Trap signature: the specific nobody remembers deciding.** When no one
|
|
95
|
+
can point to the moment a name was chosen, it was probably never chosen.
|
|
96
|
+
Ownership, attribution, and legal identity are the highest-severity
|
|
97
|
+
instance of this class — a fabricated holder in a license is an
|
|
98
|
+
unenforceable grant made in the name of a party that does not exist —
|
|
99
|
+
and they are also the least likely to be questioned, because those fields
|
|
100
|
+
are skimmed as boilerplate rather than read as claims.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Git Policy
|
|
2
|
+
|
|
3
|
+
Scoped agent-governance procedure (AGENTS.md §1/§2). Load when branching,
|
|
4
|
+
committing, pushing, or opening PRs.
|
|
5
|
+
|
|
6
|
+
## 1. Branch Lifecycle
|
|
7
|
+
|
|
8
|
+
Each coherent unit of work gets its own new branch, opened from the
|
|
9
|
+
default branch.
|
|
10
|
+
|
|
11
|
+
**A coherent unit of work is any one of:** a feature; a refactor or
|
|
12
|
+
migration; a chore (cleanup, test infrastructure, dependency updates, CI
|
|
13
|
+
fixes); a bug fix touching multiple files or areas; a documentation pass
|
|
14
|
+
beyond a single targeted edit.
|
|
15
|
+
|
|
16
|
+
1. **One unit, one branch.** Do not pile unrelated work onto an existing
|
|
17
|
+
branch — even if it's still open, even if it isn't merged, even if the
|
|
18
|
+
same area was touched recently. New work means a new branch.
|
|
19
|
+
|
|
20
|
+
2. **Branch from the default branch, not from another feature branch.**
|
|
21
|
+
Branching off a feature branch inherits its unmerged commits, which
|
|
22
|
+
corrupts the new branch's diff and creates merge-ordering hazards.
|
|
23
|
+
|
|
24
|
+
3. **Default interpretation rule.** When the owner says "branch, stage,
|
|
25
|
+
commit, push" — or any equivalent for taking new work to the remote —
|
|
26
|
+
the default is **always create a new branch off the default branch
|
|
27
|
+
first**. Reusing an existing branch must be stated explicitly. If the
|
|
28
|
+
current branch is anything other than the default and the owner has
|
|
29
|
+
not explicitly said "use the current branch," **stop and ask** before
|
|
30
|
+
staging.
|
|
31
|
+
|
|
32
|
+
4. **Merged-branch stance** *(adopt-time slot — the owner picks one and
|
|
33
|
+
the choice is recorded here)*:
|
|
34
|
+
- **Delete on merge** — reuse becomes physically impossible; the
|
|
35
|
+
simplest guardrail.
|
|
36
|
+
- **Retain after merge** — a merged branch stays addressable by name,
|
|
37
|
+
but the guardrail deletion provided now has to stand as a rule: **a
|
|
38
|
+
merged branch is CLOSED for new work.** The branch may still be
|
|
39
|
+
checked out; nothing but this rule stops the next commit landing on
|
|
40
|
+
it — and that commit becomes the orphan described below. Under
|
|
41
|
+
retention, before staging anything, confirm the current branch has
|
|
42
|
+
not already shipped (e.g.
|
|
43
|
+
`gh pr list --state merged --head "$(git branch --show-current)"`).
|
|
44
|
+
Any output means stop and branch off a freshly pulled default.
|
|
45
|
+
|
|
46
|
+
5. **Allowed reuse:** in-review PR feedback goes on the PR's branch;
|
|
47
|
+
coherent multi-commit units per the bucketing rules; hotfixes to a
|
|
48
|
+
release branch where the project has them.
|
|
49
|
+
|
|
50
|
+
**Why this rule exists:** without it, unrelated changesets accumulate on
|
|
51
|
+
one branch. When that branch's PR merges from a snapshot, commits pushed
|
|
52
|
+
after the snapshot become orphans that never reach the default branch —
|
|
53
|
+
silently breaking it when merged code references things that exist only
|
|
54
|
+
on the still-active feature branch. One unit per branch makes the class
|
|
55
|
+
structurally impossible.
|
|
56
|
+
|
|
57
|
+
## 2. Branch + PR vs Direct Push
|
|
58
|
+
|
|
59
|
+
1. **Branch + PR is required for risky changes:** runtime behavior or UX
|
|
60
|
+
changes; anything under the source directories; build or app config
|
|
61
|
+
that can affect shipped behavior; refactors, dependency updates,
|
|
62
|
+
anything with regression risk; and enforcement code itself (guard and
|
|
63
|
+
check scripts) — it is the floor everything else stands on.
|
|
64
|
+
2. **Direct push may be allowed for low-risk changes** — docs, plans, and
|
|
65
|
+
notes only; non-behavioral metadata; the finalized release version
|
|
66
|
+
bump — if the project permits it. When uncertain, branch + PR.
|
|
67
|
+
3. **Docs ride with their code.** A doc describing unmerged behavior
|
|
68
|
+
belongs on that behavior's branch, not on the default branch.
|
|
69
|
+
|
|
70
|
+
## 3. Commit Bucketing
|
|
71
|
+
|
|
72
|
+
Group by intent: code changes separate from docs; docs and plans in their
|
|
73
|
+
own commit; release bumps in their own commit, last (see
|
|
74
|
+
`policies/release.md`).
|
|
75
|
+
|
|
76
|
+
## 4. Pre-Push Checklist
|
|
77
|
+
|
|
78
|
+
- Confirm branch context (`git branch --show-current`).
|
|
79
|
+
- Verify the branch is appropriate for this work — new unit means new
|
|
80
|
+
branch (§1); under retention, verify it hasn't already shipped.
|
|
81
|
+
- Review staged files (`git status --short`).
|
|
82
|
+
- Ensure commit scope matches the file set — and after committing, read
|
|
83
|
+
the files-changed count in the commit output
|
|
84
|
+
(`policies/verification.md` Rule 3).
|
|
85
|
+
- Run the relevant checks for code changes (`policies/verification.md`).
|
|
86
|
+
|
|
87
|
+
## 5. Commit Identity
|
|
88
|
+
|
|
89
|
+
The repository has exactly one valid author/committer identity, pinned
|
|
90
|
+
per-clone in local git config — never recorded in these files, never
|
|
91
|
+
guessed, never copied from a session banner.
|
|
92
|
+
|
|
93
|
+
- **Verify before pushing, every clone, every time:**
|
|
94
|
+
`git log -1 --format="%an <%ae>"`. Session banners, environment
|
|
95
|
+
variables, and the platform's "current user" are not evidence of what
|
|
96
|
+
git will stamp.
|
|
97
|
+
- **Never author with a personal email address.** Use the forge's noreply
|
|
98
|
+
address so private contact details never enter commit metadata, message
|
|
99
|
+
trailers, or file contents — check all three surfaces.
|
|
100
|
+
- **A misconfigured identity is not cosmetic.** A wrong author can
|
|
101
|
+
attribute the codebase to an unrelated third party. Identity drift on a
|
|
102
|
+
fresh clone is a blocking defect: fix config before the first commit.
|
|
103
|
+
- Wrong identity on work already committed: stop and surface it to the
|
|
104
|
+
owner rather than pushing — the fix is a history rewrite, which is the
|
|
105
|
+
owner's call.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Implementation Policy
|
|
2
|
+
|
|
3
|
+
Scoped agent-governance procedure (AGENTS.md §1/§2). Load when writing or
|
|
4
|
+
changing code in any language. These are starting principles distilled
|
|
5
|
+
from real debugging sessions on the ancestor repository, provenance
|
|
6
|
+
stripped (AGENTS.md §3); they apply to any codebase with concurrency,
|
|
7
|
+
cross-platform targets, external side effects, or stateful UI. Your
|
|
8
|
+
project's own rules accumulate here, dated, with their incidents.
|
|
9
|
+
|
|
10
|
+
## Rule 1 — Effects Idempotent Under Re-Fire
|
|
11
|
+
|
|
12
|
+
Development modes of modern frameworks deliberately double-fire effects
|
|
13
|
+
and lifecycle hooks. Any effect that creates a backend resource — process
|
|
14
|
+
spawn, session start, socket open, database connection — must be
|
|
15
|
+
idempotent: guard with a started-flag, deduplicate the underlying promise
|
|
16
|
+
so a second call reuses the first, and return a cleanup that tears the
|
|
17
|
+
resource down. Assume every effect runs twice and design accordingly.
|
|
18
|
+
Corollary: state-updater functions must be pure — never perform side
|
|
19
|
+
effects inside one; dev modes double-fire those too.
|
|
20
|
+
|
|
21
|
+
## Rule 2 — Platform-Specific Code Isolation
|
|
22
|
+
|
|
23
|
+
Platform-dependent code lives behind real compile-time or runtime gates,
|
|
24
|
+
never inline in shared business logic. Use gates that actually exclude
|
|
25
|
+
the other platform's code from compilation where the language offers them
|
|
26
|
+
(a runtime `if` on the platform still compiles — and can still break —
|
|
27
|
+
every branch). Centralize platform checks in one module; ad-hoc platform
|
|
28
|
+
conditionals scattered through shared logic are the defect pattern.
|
|
29
|
+
|
|
30
|
+
## Rule 3 — Dev-Only Safety Nets Are Gated
|
|
31
|
+
|
|
32
|
+
Dev-mode workarounds — orphan-process cleanup, verbose logging, mock
|
|
33
|
+
fallbacks — must be gated so they cannot ship in production builds, and
|
|
34
|
+
must carry a comment saying why they exist so no future reader mistakes a
|
|
35
|
+
safety net for a feature.
|
|
36
|
+
|
|
37
|
+
## Rule 4 — Preserve Expensive Stateful Instances
|
|
38
|
+
|
|
39
|
+
Components with expensive internal state (terminal emulators, code
|
|
40
|
+
editors, video players, map views, 3D canvases) should be hidden and
|
|
41
|
+
shown by visibility toggling, not destroyed and recreated by conditional
|
|
42
|
+
rendering. Teardown-and-rebuild loses internal state and pays
|
|
43
|
+
initialization cost on every toggle. Know your framework's teardown
|
|
44
|
+
semantics and choose the mechanism that preserves the instance.
|
|
45
|
+
|
|
46
|
+
## Rule 5 — Dead Code Carries Its Reason
|
|
47
|
+
|
|
48
|
+
Zero-warning builds are the floor, but "unused" is a claim to verify, not
|
|
49
|
+
obey: a constant may be read textually by a script; an item may be
|
|
50
|
+
ratified-decision prep awaiting its consumer. Suppress warnings per-site
|
|
51
|
+
only, with a comment naming the future consumer; never blanket
|
|
52
|
+
suppressions. Remove the suppression when the consumer lands. Genuinely
|
|
53
|
+
dead code is deleted — version history remembers it.
|
|
54
|
+
|
|
55
|
+
## Rule 6 — Visual Changes Get Visual Verification
|
|
56
|
+
|
|
57
|
+
Any change whose acceptance criterion is "how it looks" — styling, canvas
|
|
58
|
+
drawing, layout, state/hover treatments — is verified by *looking at the
|
|
59
|
+
rendered output* before the PR, not shipped on geometry math. Build a
|
|
60
|
+
minimal repro of the real structure and styles, render it headlessly,
|
|
61
|
+
and read the screenshot: magnified to catch hairline features, and at 1×
|
|
62
|
+
because that is what the user sees. Faint and stateful styling especially:
|
|
63
|
+
screenshot the state, don't reason about it.
|
|
64
|
+
|
|
65
|
+
## Rule 7 — State Follows the Authoritative Side Effect
|
|
66
|
+
|
|
67
|
+
In any flow pairing an in-memory state mutation with a refusable external
|
|
68
|
+
operation (disk write, network call, database commit): run every check
|
|
69
|
+
that can refuse the operation *before* the state write — or run the
|
|
70
|
+
operation first and derive state from its result. Never commit state on
|
|
71
|
+
the assumption the operation will succeed; a refusal then leaves state
|
|
72
|
+
pointing at things that never materialized, and reconciliation has to
|
|
73
|
+
guess. The operation's result object is the authority; a discarded
|
|
74
|
+
success flag is a silent divergence waiting for its trigger. When
|
|
75
|
+
auditing, look for state mutations issued above the external call — that
|
|
76
|
+
ordering is the trap's signature.
|
|
77
|
+
|
|
78
|
+
## Rule 8 — Removal Refactors: Grep the Identifier Dead
|
|
79
|
+
|
|
80
|
+
After removing any identifier — parameter, export, prop, handler — grep
|
|
81
|
+
it repo-wide before calling the removal done: imports *and* bare uses. A
|
|
82
|
+
parameter list and the object literal that forwards it are separate
|
|
83
|
+
sites; assembler and binding layers that repackage values are the classic
|
|
84
|
+
repeat offenders. Bundlers can build free identifiers without complaint
|
|
85
|
+
and unit tests may never execute the render path, so every check can pass
|
|
86
|
+
while the app crashes live. If the lint chain has an undefined-reference
|
|
87
|
+
rule, keep it; until it does, the grep is mandatory.
|
|
88
|
+
|
|
89
|
+
## Rule 9 — Persistent State Is Born Sync-Ready
|
|
90
|
+
|
|
91
|
+
- New persistent entity types get a globally-unique identifier at birth —
|
|
92
|
+
a UUID, never an autoincrement, rowid, timestamp, or process-local
|
|
93
|
+
counter. Machine-local uniqueness collides the day replicas merge
|
|
94
|
+
(multi-user sync, imports, cross-machine copies); retrofitting identity
|
|
95
|
+
is a migration, preventing new instances is free.
|
|
96
|
+
- New persistent tables and columns declare, at creation, which side of a
|
|
97
|
+
future sync line they live on — shared project truth vs
|
|
98
|
+
per-user/per-machine. A one-line comment at the schema site suffices;
|
|
99
|
+
the point is that the classification is decided at birth, not by
|
|
100
|
+
archaeology later.
|