@geraldmaron/construct 1.0.5 → 1.0.7
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/README.md +24 -18
- package/agents/contracts.json +617 -2
- package/agents/contracts.schema.json +83 -0
- package/agents/prompts/cx-accessibility.md +5 -3
- package/agents/prompts/cx-ai-engineer.md +9 -7
- package/agents/prompts/cx-architect.md +8 -6
- package/agents/prompts/cx-business-strategist.md +8 -6
- package/agents/prompts/cx-data-analyst.md +9 -7
- package/agents/prompts/cx-data-engineer.md +5 -3
- package/agents/prompts/cx-debugger.md +8 -6
- package/agents/prompts/cx-designer.md +7 -5
- package/agents/prompts/cx-devil-advocate.md +6 -4
- package/agents/prompts/cx-docs-keeper.md +7 -5
- package/agents/prompts/cx-engineer.md +7 -5
- package/agents/prompts/cx-evaluator.md +4 -2
- package/agents/prompts/cx-explorer.md +10 -8
- package/agents/prompts/cx-legal-compliance.md +4 -2
- package/agents/prompts/cx-operations.md +7 -5
- package/agents/prompts/cx-orchestrator.md +12 -10
- package/agents/prompts/cx-platform-engineer.md +7 -5
- package/agents/prompts/cx-product-manager.md +6 -4
- package/agents/prompts/cx-qa.md +10 -8
- package/agents/prompts/cx-rd-lead.md +11 -9
- package/agents/prompts/cx-release-manager.md +7 -5
- package/agents/prompts/cx-researcher.md +24 -22
- package/agents/prompts/cx-reviewer.md +9 -7
- package/agents/prompts/cx-security.md +12 -10
- package/agents/prompts/cx-sre.md +9 -7
- package/agents/prompts/cx-test-automation.md +5 -3
- package/agents/prompts/cx-trace-reviewer.md +10 -8
- package/agents/prompts/cx-ux-researcher.md +5 -3
- package/agents/registry.json +8 -3
- package/bin/construct +444 -53
- package/commands/build/feature.md +4 -4
- package/commands/build/fix.md +8 -8
- package/commands/design/access.md +3 -3
- package/commands/design/flow.md +3 -3
- package/commands/design/ui.md +4 -4
- package/commands/measure/experiment.md +5 -5
- package/commands/measure/metrics.md +3 -3
- package/commands/measure/results.md +4 -4
- package/commands/plan/api.md +3 -3
- package/commands/plan/challenge.md +3 -3
- package/commands/plan/decide.md +3 -3
- package/commands/plan/feature.md +7 -7
- package/commands/plan/requirements.md +3 -3
- package/commands/remember/context.md +5 -5
- package/commands/remember/handoff.md +3 -3
- package/commands/remember/runbook.md +3 -3
- package/commands/review/code.md +8 -8
- package/commands/review/quality.md +4 -4
- package/commands/review/security.md +3 -3
- package/commands/ship/ready.md +3 -3
- package/commands/ship/release.md +3 -3
- package/commands/ship/status.md +4 -4
- package/commands/understand/docs.md +3 -3
- package/commands/understand/this.md +4 -4
- package/commands/understand/why.md +8 -8
- package/commands/work/clean.md +14 -14
- package/commands/work/drive.md +10 -10
- package/commands/work/optimize-prompts.md +9 -9
- package/commands/work/parallel-review.md +8 -8
- package/db/schema/006_graph.sql +24 -0
- package/examples/provider-plugin/README.md +7 -7
- package/examples/seed-observations/README.md +6 -6
- package/examples/seed-observations/anti-patterns.md +14 -14
- package/examples/seed-observations/decisions.md +4 -4
- package/examples/seed-observations/patterns.md +14 -14
- package/lib/auto-docs.mjs +13 -8
- package/lib/boundary.mjs +126 -0
- package/lib/cache-strategy-google.js +26 -31
- package/lib/cli-commands.mjs +2 -2
- package/lib/comment-lint.mjs +134 -0
- package/lib/contracts/validate.mjs +323 -0
- package/lib/daemons/contract.mjs +210 -0
- package/lib/docs-verify.mjs +59 -6
- package/lib/doctor/cli.mjs +16 -1
- package/lib/doctor/index.mjs +3 -1
- package/lib/doctor/watchers/consistency.mjs +310 -0
- package/lib/doctor/watchers/mcp-protocol.mjs +232 -0
- package/lib/document-extract.mjs +211 -1
- package/lib/embed/cli.mjs +124 -3
- package/lib/embed/daemon.mjs +43 -4
- package/lib/embed/docs-lifecycle.mjs +1 -1
- package/lib/embed/inbox.mjs +2 -0
- package/lib/embed/scheduler.mjs +33 -5
- package/lib/evaluator-optimizer.mjs +2 -3
- package/lib/flavors/loader.mjs +1 -1
- package/lib/hooks/comment-lint.mjs +16 -0
- package/lib/hooks/mcp-audit.mjs +2 -1
- package/lib/hooks/proactive-activation.mjs +0 -14
- package/lib/hooks/rule-verifier.mjs +217 -0
- package/lib/hooks/session-optimize.mjs +2 -1
- package/lib/init-unified.mjs +55 -65
- package/lib/intake/classify.mjs +108 -24
- package/lib/intake/daemon.mjs +121 -0
- package/lib/intake/filesystem-queue.mjs +6 -1
- package/lib/intake/intake-config.mjs +2 -1
- package/lib/intake/prepare.mjs +0 -1
- package/lib/intake/session-prelude.mjs +7 -1
- package/lib/intake/traceability.mjs +90 -0
- package/lib/knowledge/graph.mjs +213 -0
- package/lib/knowledge/research-store.mjs +2 -0
- package/lib/maintenance/cleanup.mjs +315 -0
- package/lib/mcp/memory-bridge.mjs +276 -0
- package/lib/mcp/server.mjs +189 -1
- package/lib/mcp/tools/profile.mjs +270 -0
- package/lib/mcp/tools/workflow.mjs +25 -0
- package/lib/mcp-catalog.json +12 -8
- package/lib/mcp-platform-config.mjs +16 -8
- package/lib/migrations/index.mjs +106 -0
- package/lib/migrations/v1-baseline.mjs +33 -0
- package/lib/observation-store.mjs +9 -4
- package/lib/outcomes/record.mjs +2 -0
- package/lib/profiles/rebrand.mjs +46 -0
- package/lib/project-init-shared.mjs +12 -0
- package/lib/provider-capabilities.js +20 -7
- package/lib/providers/auth-manager.mjs +58 -17
- package/lib/reflect.mjs +49 -12
- package/lib/server/index.mjs +22 -28
- package/lib/session-store.mjs +6 -4
- package/lib/setup.mjs +14 -3
- package/lib/telemetry/client.mjs +5 -1
- package/lib/version.mjs +51 -0
- package/lib/worker/trace.mjs +5 -1
- package/package.json +4 -1
- package/personas/construct.md +3 -1
- package/platforms/claude/CLAUDE.md +6 -6
- package/rules/common/agents.md +2 -2
- package/rules/common/beads-hygiene.md +11 -11
- package/rules/common/code-review.md +1 -1
- package/rules/common/coding-style.md +1 -1
- package/rules/common/comments.md +8 -8
- package/rules/common/commit-approval.md +4 -4
- package/rules/common/cx-agent-routing.md +2 -2
- package/rules/common/cx-skill-routing.md +2 -2
- package/rules/common/development-workflow.md +3 -2
- package/rules/common/doc-ownership.md +2 -2
- package/rules/common/efficiency.md +3 -3
- package/rules/common/framing.md +1 -1
- package/rules/common/git-workflow.md +1 -1
- package/rules/common/no-fabrication.md +69 -0
- package/rules/common/patterns.md +1 -1
- package/rules/common/performance.md +1 -1
- package/rules/common/release-gates.md +7 -7
- package/rules/common/research.md +4 -4
- package/rules/common/review-before-change.md +58 -0
- package/rules/common/security.md +1 -1
- package/rules/common/skill-composition.md +8 -8
- package/rules/common/testing.md +1 -1
- package/rules/golang/coding-style.md +2 -2
- package/rules/golang/hooks.md +1 -1
- package/rules/golang/patterns.md +1 -1
- package/rules/golang/security.md +1 -1
- package/rules/golang/testing.md +1 -1
- package/rules/python/coding-style.md +1 -1
- package/rules/python/hooks.md +1 -1
- package/rules/python/patterns.md +1 -1
- package/rules/python/security.md +1 -1
- package/rules/python/testing.md +1 -1
- package/rules/swift/coding-style.md +3 -3
- package/rules/swift/hooks.md +2 -2
- package/rules/swift/patterns.md +2 -2
- package/rules/swift/security.md +4 -4
- package/rules/swift/testing.md +2 -2
- package/rules/typescript/coding-style.md +1 -1
- package/rules/typescript/hooks.md +1 -1
- package/rules/typescript/patterns.md +1 -1
- package/rules/typescript/security.md +1 -1
- package/rules/typescript/testing.md +1 -1
- package/rules/web/coding-style.md +1 -1
- package/rules/web/design-quality.md +1 -1
- package/rules/web/hooks.md +1 -1
- package/rules/web/patterns.md +1 -1
- package/rules/web/performance.md +1 -1
- package/rules/web/security.md +1 -1
- package/rules/web/testing.md +1 -1
- package/scripts/sync-agents.mjs +45 -14
- package/skills/ai/agent-dev.md +1 -1
- package/skills/ai/llm-security.md +1 -1
- package/skills/ai/ml-ops.md +6 -6
- package/skills/ai/orchestration-workflow.md +1 -1
- package/skills/ai/prompt-and-eval.md +1 -1
- package/skills/ai/prompt-optimizer.md +13 -13
- package/skills/ai/rag-system.md +1 -1
- package/skills/architecture/api-design.md +1 -1
- package/skills/architecture/caching.md +1 -1
- package/skills/architecture/cloud-native.md +1 -1
- package/skills/architecture/message-queue.md +1 -1
- package/skills/architecture/security-arch.md +1 -1
- package/skills/compliance/ai-disclosure.md +1 -1
- package/skills/compliance/data-privacy.md +1 -1
- package/skills/compliance/license-audit.md +2 -2
- package/skills/compliance/regulatory-review.md +1 -1
- package/skills/development/cpp.md +1 -1
- package/skills/development/go.md +1 -1
- package/skills/development/java.md +1 -1
- package/skills/development/kotlin.md +9 -9
- package/skills/development/mobile-crossplatform.md +13 -13
- package/skills/development/python.md +1 -1
- package/skills/development/rust.md +1 -1
- package/skills/development/shell.md +1 -1
- package/skills/development/swift.md +6 -6
- package/skills/development/typescript.md +1 -1
- package/skills/devops/ci-cd.md +5 -5
- package/skills/devops/containerization.md +9 -9
- package/skills/devops/cost-optimization.md +1 -1
- package/skills/devops/data-engineering.md +2 -2
- package/skills/devops/database.md +1 -1
- package/skills/devops/dependency-management.md +3 -3
- package/skills/devops/devsecops.md +1 -1
- package/skills/devops/git-workflow.md +1 -1
- package/skills/devops/incident-response.md +18 -18
- package/skills/devops/monorepo.md +5 -5
- package/skills/devops/observability.md +1 -1
- package/skills/devops/performance.md +1 -1
- package/skills/devops/testing.md +1 -1
- package/skills/docs/adr-workflow.md +2 -2
- package/skills/docs/backlog-proposal-workflow.md +1 -1
- package/skills/docs/customer-profile-workflow.md +1 -1
- package/skills/docs/document-ingest-workflow.md +1 -1
- package/skills/docs/evidence-ingest-workflow.md +1 -1
- package/skills/docs/init-docs.md +15 -15
- package/skills/docs/init-project.md +1 -1
- package/skills/docs/prd-workflow.md +3 -3
- package/skills/docs/prfaq-workflow.md +1 -1
- package/skills/docs/product-intelligence-review.md +1 -1
- package/skills/docs/product-intelligence-workflow.md +1 -1
- package/skills/docs/product-signal-workflow.md +9 -9
- package/skills/docs/research-workflow.md +10 -10
- package/skills/docs/runbook-workflow.md +2 -2
- package/skills/docs/strategy-workflow.md +3 -3
- package/skills/exploration/repo-map.md +11 -11
- package/skills/frameworks/django.md +15 -15
- package/skills/frameworks/nextjs.md +16 -16
- package/skills/frameworks/react.md +12 -12
- package/skills/frameworks/spring-boot.md +12 -12
- package/skills/frontend-design/accessibility.md +6 -6
- package/skills/frontend-design/component-patterns.md +1 -1
- package/skills/frontend-design/engineering.md +1 -1
- package/skills/frontend-design/state-management.md +1 -1
- package/skills/frontend-design/ui-aesthetics.md +1 -1
- package/skills/frontend-design/ux-principles.md +1 -1
- package/skills/operating/orchestration-reference.md +27 -27
- package/skills/quality-gates/review-work.md +3 -3
- package/skills/quality-gates/verify-change.md +1 -1
- package/skills/quality-gates/verify-module.md +1 -1
- package/skills/quality-gates/verify-quality.md +1 -1
- package/skills/quality-gates/verify-security.md +1 -1
- package/skills/routing.md +14 -14
- package/skills/security/blue-team.md +1 -1
- package/skills/security/code-audit.md +1 -1
- package/skills/security/pentest.md +1 -1
- package/skills/security/red-team.md +1 -1
- package/skills/security/threat-intel.md +1 -1
- package/skills/security/vuln-research.md +1 -1
- package/skills/utility/clean-code.md +2 -2
- package/templates/docs/changelog-entry.md +1 -1
- package/templates/docs/construct_guide.md +18 -18
- package/templates/docs/meta-prd.md +16 -16
- package/templates/docs/one-pager.md +1 -1
- package/templates/docs/prd-business.md +1 -1
- package/templates/docs/prd-platform.md +1 -1
- package/templates/docs/prd.md +17 -17
- package/templates/docs/research-brief.md +8 -8
- package/templates/docs/rfc.md +1 -1
- package/templates/docs/skill-artifact.md +1 -1
- package/templates/docs/strategy.md +1 -1
package/rules/common/comments.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/common/comments.md
|
|
2
|
+
rules/common/comments.md: Construct comment convention for JS/TS/MJS source files.
|
|
3
3
|
|
|
4
4
|
Defines the two allowed comment forms (file header, section context block) and
|
|
5
5
|
what is never allowed (inline narration, trailing comments, mid-function notes).
|
|
@@ -37,12 +37,12 @@ The blank line between the comment and the code is required. It signals "this co
|
|
|
37
37
|
|
|
38
38
|
## What is never allowed
|
|
39
39
|
|
|
40
|
-
- **Inline trailing comments**
|
|
41
|
-
- **Mid-function narration**
|
|
42
|
-
- **Between-group labels**
|
|
43
|
-
- **Narrative voice**
|
|
44
|
-
- **Point-in-time notes**
|
|
45
|
-
- **Noise sentinels**
|
|
40
|
+
- **Inline trailing comments** (`const x = 1; // increment`) delete them
|
|
41
|
+
- **Mid-function narration** (a comment in the middle of a function body that describes what the next line does) delete it; rename the variable or extract a function instead
|
|
42
|
+
- **Between-group labels** (`// Language patterns`, `// Dashboard`, `// Step 1:`) delete them
|
|
43
|
+
- **Narrative voice** (`// We weight BM25`, `// Now test the keys`, `// This correctly scores`) delete them
|
|
44
|
+
- **Point-in-time notes** (`// X removed`, `// previously`, `// no longer`) belongs in git log
|
|
45
|
+
- **Noise sentinels** (`// ok`, `// best effort`, `// skip`) delete them; use `/* non-critical */` inline only when the catch clause would otherwise look like a bug
|
|
46
46
|
|
|
47
47
|
## SLA annotations (hooks only)
|
|
48
48
|
|
|
@@ -54,5 +54,5 @@ The blank line between the comment and the code is required. It signals "this co
|
|
|
54
54
|
|
|
55
55
|
## Rule of thumb
|
|
56
56
|
|
|
57
|
-
Delete the comment. If the section becomes harder to understand, the comment earns its place
|
|
57
|
+
Delete the comment. If the section becomes harder to understand, the comment earns its place: as a block before it, with a blank line after. If it reads just as clearly without, it stays deleted.
|
|
58
58
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/common/commit-approval.md
|
|
2
|
+
rules/common/commit-approval.md: conversational approval rule for mutating git operations.
|
|
3
3
|
|
|
4
4
|
Behavioral rule, not a hook. The agent asks and waits for a yes; the user
|
|
5
5
|
replies in chat. Infrastructure stays out of the way.
|
|
@@ -19,7 +19,7 @@ Before running any of these Bash tool calls:
|
|
|
19
19
|
The agent must:
|
|
20
20
|
|
|
21
21
|
1. **State the working branch** so the user sees the scope.
|
|
22
|
-
2. **Show the proposed action verbatim
|
|
22
|
+
2. **Show the proposed action verbatim**: for a commit, the full proposed message (subject and body) formatted exactly as it will appear in `git log`. For a push, the target refspec. For a merge, the PR number and merge mode (`--squash`, `--rebase`, etc.).
|
|
23
23
|
3. **Ask for confirmation** and wait for a yes before executing.
|
|
24
24
|
|
|
25
25
|
A yes from the user in chat is the approval. No marker file, no CLI command, no special syntax.
|
|
@@ -41,13 +41,13 @@ Then stop and wait.
|
|
|
41
41
|
|
|
42
42
|
## Exceptions
|
|
43
43
|
|
|
44
|
-
- **The user explicitly tells the agent to run a defined sequence** ("commit, push, and merge when ready"). That single yes covers the named batch
|
|
44
|
+
- **The user explicitly tells the agent to run a defined sequence** ("commit, push, and merge when ready"). That single yes covers the named batch: but only the actions named, in the order named. A new commit triggered later (e.g. by a CI fix or follow-up edit) is its own approval gate.
|
|
45
45
|
- **Read-only git operations** (`git status`, `git log`, `git diff`, `git fetch`, `git branch`, `git show`) don't need approval.
|
|
46
46
|
|
|
47
47
|
A "yes" from earlier in the session does NOT carry forward to subsequent commits. Each new commit message must be shown and approved.
|
|
48
48
|
|
|
49
49
|
## Why this is a rule, not a hook
|
|
50
50
|
|
|
51
|
-
A hook that blocked every commit turned out to be over-restrictive
|
|
51
|
+
A hook that blocked every commit turned out to be over-restrictive: it required a separate command invocation to write a marker file each time, which added friction without much safety beyond the agent just following the rule. The agent is the one producing commit messages; asking in chat is the right interface.
|
|
52
52
|
|
|
53
53
|
If the agent ever commits without asking, that's a correctness bug. Surface it in the session and raise a follow-up to catch the regression.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/common/cx-agent-routing.md
|
|
2
|
+
rules/common/cx-agent-routing.md: auto-trigger routing rules for cx-* specialist agents.
|
|
3
3
|
|
|
4
4
|
Defines when to route directly to a cx-* specialist vs through Construct orchestration.
|
|
5
5
|
Covers intent-based routing table, complexity gate, and routing rules.
|
|
6
6
|
Loaded by rule-loading systems that look for cx-agent-routing in the rules hierarchy.
|
|
7
7
|
-->
|
|
8
|
-
# cx-* Agent Routing
|
|
8
|
+
# cx-* Agent Routing: Auto-trigger Rules
|
|
9
9
|
|
|
10
10
|
When a request matches the trigger patterns below, automatically route to the corresponding cx-* specialist or persona before responding.
|
|
11
11
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/common/cx-skill-routing.md
|
|
2
|
+
rules/common/cx-skill-routing.md: Redirect to canonical skill routing table.
|
|
3
3
|
-->
|
|
4
4
|
# cx-* Skill Routing
|
|
5
5
|
|
|
@@ -7,5 +7,5 @@ rules/common/cx-skill-routing.md — Redirect to canonical skill routing table.
|
|
|
7
7
|
>
|
|
8
8
|
> All skill routing keywords, domain tables, and routing rules live there.
|
|
9
9
|
> This file exists only as a named entry point for rule-loading systems that
|
|
10
|
-
> look for `cx-skill-routing.md`. Do not add routing entries here
|
|
10
|
+
> look for `cx-skill-routing.md`. Do not add routing entries here: update
|
|
11
11
|
> `skills/routing.md` instead.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/common/development-workflow.md
|
|
2
|
+
rules/common/development-workflow.md: feature implementation pipeline.
|
|
3
3
|
|
|
4
4
|
Defines the research-plan-TDD-review-commit workflow that runs before
|
|
5
5
|
git operations. References testing.md, code-review.md, git-workflow.md.
|
|
@@ -8,8 +8,9 @@ git operations. References testing.md, code-review.md, git-workflow.md.
|
|
|
8
8
|
|
|
9
9
|
## Feature Implementation Workflow
|
|
10
10
|
|
|
11
|
-
0. **Research & Reuse** _(mandatory before any new implementation)_
|
|
11
|
+
0. **Research & Reuse** _(mandatory before any new implementation or artifact)_
|
|
12
12
|
- **Search existing code first:** Look for existing implementations, templates, and patterns before writing anything new.
|
|
13
|
+
- **Search existing artifacts:** Before authoring a doc, rule, template, strategy, PRD, ADR, or RFC, audit what already exists. See [review-before-change.md](review-before-change.md) for the audit checklist. Extend or supersede; do not duplicate.
|
|
13
14
|
- **Check docs:** Confirm API behavior, package usage, and version-specific details before implementing.
|
|
14
15
|
- **Check package registries:** npm, PyPI, crates.io before writing utility code.
|
|
15
16
|
- Prefer adopting a proven approach over writing net-new code.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/common/doc-ownership.md
|
|
2
|
+
rules/common/doc-ownership.md: which specialist owns which document type.
|
|
3
3
|
|
|
4
4
|
Prevents the orchestrator (or any general persona) from authoring specialist
|
|
5
5
|
documents directly. Routing authorship to the owning role is how research,
|
|
6
|
-
framing, and domain scrutiny actually fire
|
|
6
|
+
framing, and domain scrutiny actually fire: writing a PRD without the
|
|
7
7
|
product manager bypasses those checks entirely.
|
|
8
8
|
-->
|
|
9
9
|
# Document Ownership
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/common/efficiency.md
|
|
2
|
+
rules/common/efficiency.md: session context and tool-use efficiency standards.
|
|
3
3
|
|
|
4
4
|
Applies to all agents operating in a Construct session. Violations compound context
|
|
5
5
|
cost and reduce throughput. These rules are enforced by read-tracker.mjs and surfaced
|
|
@@ -19,7 +19,7 @@ Signals that a re-read is warranted:
|
|
|
19
19
|
- An external process (Bash, a subagent) may have modified it.
|
|
20
20
|
- The last read was in a prior session (context was compacted).
|
|
21
21
|
|
|
22
|
-
Do not re-read to verify
|
|
22
|
+
Do not re-read to verify: trust the in-context state. If staleness is a concern,
|
|
23
23
|
check the file hash via `read-tracker.mjs` state rather than re-reading the full file.
|
|
24
24
|
|
|
25
25
|
**Threshold:** more than 3 reads of the same file within a session without an intervening
|
|
@@ -54,4 +54,4 @@ re-running the command.
|
|
|
54
54
|
Each Task dispatch creates a subagent context. Dispatch a specialist when the task
|
|
55
55
|
benefits from a structurally different view (architecture suspicion, security scan,
|
|
56
56
|
coverage gap analysis). Do not dispatch for tasks that fit within a single focused
|
|
57
|
-
pass
|
|
57
|
+
pass: the round-trip cost exceeds the benefit.
|
package/rules/common/framing.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/common/framing.md
|
|
2
|
+
rules/common/framing.md: how to frame a problem before acting on it.
|
|
3
3
|
|
|
4
4
|
Establishes the hard separation between execution artifacts (tickets, chat
|
|
5
5
|
transcripts, existing docs) and sources of truth (the underlying problem).
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/common/no-fabrication.md: canonical anti-fabrication policy for Construct.
|
|
3
|
+
|
|
4
|
+
Defines the trust contract between operators and the system: outputs stick to
|
|
5
|
+
source, gaps stay visible, and confidence reflects evidence. Applies to every
|
|
6
|
+
specialist, every artifact, and every summary — intake processing, document
|
|
7
|
+
evaluation, knowledge writing, plan drafting, review verdicts, handoffs.
|
|
8
|
+
|
|
9
|
+
Sibling rules: research.md (evidence hierarchy), framing.md (execution
|
|
10
|
+
artifacts are not sources), comments.md (banned voice patterns).
|
|
11
|
+
-->
|
|
12
|
+
# No-Fabrication Policy
|
|
13
|
+
|
|
14
|
+
Fabrication is the single largest threat to trust in an agent system. A persona that invents a customer quote, sharpens a vague signal into a confident assertion, or papers over a gap with plausible-sounding prose corrupts every artifact downstream. This rule applies to **every output** Construct produces: intake summaries, classification rationales, PRDs, ADRs, RFCs, knowledge notes, handoffs, review verdicts, plan entries, beads issues, MCP tool responses, dashboard text.
|
|
15
|
+
|
|
16
|
+
## 1. Stick to source
|
|
17
|
+
|
|
18
|
+
- Every load-bearing claim must trace to a source the reader can re-verify. Cite with `[source: path#anchor]`, `[source: intake-<id>]`, `[source: bd-<id>]`, `[source: <commit-sha>]`, or a fetched URL with the date the fetch happened.
|
|
19
|
+
- If a fact is not in the source you have access to, write `unknown` or `[unverified]`. Do not paper over the gap with prose that sounds confident.
|
|
20
|
+
- Never invent: customer names, quotes, ticket IDs, commit hashes, percentages, dates, file paths, function names, API surfaces, dependency names, version numbers.
|
|
21
|
+
|
|
22
|
+
## 2. Preserve ambiguity
|
|
23
|
+
|
|
24
|
+
- A vague signal stays vague in the artifact. If the intake says "users are frustrated with the dashboard," the PRD says "users are frustrated with the dashboard [source: intake-xxx]" — not "users want sub-200ms p95 dashboard latency."
|
|
25
|
+
- When a source is ambiguous, list the possible interpretations and tag the chosen reading as inference, not observation.
|
|
26
|
+
- Do not promote inference to observation. `X happened` requires evidence the event happened. `X likely means Y` requires the inference to be marked as such.
|
|
27
|
+
|
|
28
|
+
## 3. Distinguish observation from inference
|
|
29
|
+
|
|
30
|
+
- Observation: directly verifiable from the source. Format: bare statement with citation.
|
|
31
|
+
- Inference: a conclusion drawn from one or more observations. Format: prefixed with `inference:` or `[inferred]`, and the supporting observations must be cited.
|
|
32
|
+
- Speculation (no supporting observation): not allowed in artifacts. If you must raise a hypothesis, write it as a question, not an assertion.
|
|
33
|
+
|
|
34
|
+
## 4. Calibrate confidence honestly
|
|
35
|
+
|
|
36
|
+
- Confidence in artifacts and observation records reflects evidence strength, not authorial conviction. Single-source claims, secondary sources, and inferred conclusions get lower confidence than primary-source observations.
|
|
37
|
+
- Words that smuggle confidence without evidence — `clearly`, `obviously`, `undoubtedly`, `definitely`, `certainly`, `surely` — are banned from artifact bodies. Replace with an explicit citation or remove.
|
|
38
|
+
- Quantitative claims (`30% faster`, `5x improvement`, `90th percentile latency`) require an inline source. Hand-wave percentages are fabrication.
|
|
39
|
+
|
|
40
|
+
## 5. Don't mind-read users or customers
|
|
41
|
+
|
|
42
|
+
- `Users want X`, `customers expect Y`, `everyone agrees Z` require a citation to the source where the user or customer said so (interview transcript, support ticket, survey, observed behavior). Without the citation, the claim is fabrication.
|
|
43
|
+
- Speculative product-vision language is allowed only in clearly-marked hypothesis or alternative sections, never in observation or requirements sections.
|
|
44
|
+
|
|
45
|
+
## 6. Surface uncertainty as a question, not an assertion
|
|
46
|
+
|
|
47
|
+
- When you don't know, ask. A persona that doesn't know whether a regression touched the auth flow asks for the diff before claiming it did. A reviewer who can't tell if a test covers a branch asks for the coverage report.
|
|
48
|
+
- "I don't have access to X" is a valid output. Pretending to have access is fabrication.
|
|
49
|
+
|
|
50
|
+
## 7. Embellishment is fabrication
|
|
51
|
+
|
|
52
|
+
- Adding plausible-but-unverified detail to a summary, classification rationale, or handoff is fabrication, even when the additions feel innocuous.
|
|
53
|
+
- The intake classifier's `rationale` field lists the exact keywords matched. Downstream personas must not embellish the rationale into a richer narrative the classifier did not produce.
|
|
54
|
+
- Session summaries derive from observable session artifacts (context, observations, commits). Do not include events the transcript does not record.
|
|
55
|
+
|
|
56
|
+
## 8. When in doubt, say less
|
|
57
|
+
|
|
58
|
+
- A shorter, accurate artifact beats a longer artifact padded with unverified plausibility.
|
|
59
|
+
- Sections that lack source material should be omitted, not filled with speculation. An ADR without a "Rejected alternatives" section because no alternatives were considered is better than an ADR with invented alternatives.
|
|
60
|
+
|
|
61
|
+
## Enforcement
|
|
62
|
+
|
|
63
|
+
- `lib/comment-lint.mjs` enforces a subset of these patterns on artifact paths (`docs/prd/**`, `docs/adr/**`, `docs/rfc/**`, `docs/research/**`, `.cx/knowledge/**`, `.cx/handoffs/**`, `.cx/research/**`). PostToolUse warns; `npm run lint:comments`, `construct lint:comments`, and the release gate block.
|
|
64
|
+
- `agents/contracts.json` postconditions check structural requirements (mandatory sections, intake traceability, citation density). `lib/contracts/validate.mjs#validateHandoff` blocks handoffs that fail validation when `CONSTRUCT_CONTRACT_ENFORCEMENT=block`.
|
|
65
|
+
- `construct intake done <id> --output=<path>` stamps `intake_id`, `intake_confidence`, and `intake_rationale` into the artifact's frontmatter so every intake-derived artifact carries verifiable provenance.
|
|
66
|
+
|
|
67
|
+
## Bypass
|
|
68
|
+
|
|
69
|
+
There is no bypass. If a check is wrong, fix the check (`rules/common/no-fabrication.md`, the pattern bank in `lib/comment-lint.mjs`, or the contract postcondition). Do not work around the gate.
|
package/rules/common/patterns.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/common/performance.md
|
|
2
|
+
rules/common/performance.md: model-agnostic performance and context management rules.
|
|
3
3
|
|
|
4
4
|
Defines model selection tiers, context window management heuristics,
|
|
5
5
|
and build troubleshooting steps. No platform-specific tool names or config paths.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/common/release-gates.md
|
|
2
|
+
rules/common/release-gates.md: Hard release gates for Construct work.
|
|
3
3
|
|
|
4
4
|
Defines the blocking contracts every agent and persona must satisfy locally
|
|
5
5
|
before any commit, push, or "done" claim. Loaded by the construct persona,
|
|
6
6
|
AGENTS.md, and the engineer/reviewer/operator role overlays. Enforcement is at
|
|
7
|
-
the prompt level
|
|
7
|
+
the prompt level: CI is a backstop, not the primary gate.
|
|
8
8
|
-->
|
|
9
|
-
# Release Gates
|
|
9
|
+
# Release Gates: Hard Contracts
|
|
10
10
|
|
|
11
11
|
These are blocking gates. Every agent, persona, and harness session working in or shipping Construct must satisfy them locally **before** any commit, push, or "done" claim. CI is a backstop, not the primary check.
|
|
12
12
|
|
|
@@ -20,7 +20,7 @@ Run these before declaring work done. Pasting the output into the PR body or `bd
|
|
|
20
20
|
|---|---|---|
|
|
21
21
|
| Tests | `npm test` | 0 failed, 0 unexpected skips |
|
|
22
22
|
| Comment policy | `node bin/construct lint:comments` | 0 errors AND 0 warnings |
|
|
23
|
-
| Doc verification | `node bin/construct docs:verify` | "All documentation checks passed"
|
|
23
|
+
| Doc verification | `node bin/construct docs:verify` | "All documentation checks passed": no warnings either |
|
|
24
24
|
| AUTO doc drift | `node bin/construct docs:update --check` | "Docs are up to date" |
|
|
25
25
|
| Template policy | `npm run lint:templates` | "Template policy: clean." |
|
|
26
26
|
|
|
@@ -34,9 +34,9 @@ npm run release:check
|
|
|
34
34
|
|
|
35
35
|
The repo enforces `.gitmessage` and `.github/pull_request_template.md`. Both are validated by `scripts/lint-commits-pr.mjs` (the `lint-templates` CI job) and fail the build on any deviation.
|
|
36
36
|
|
|
37
|
-
Commit subjects must match `type(scope): subject
|
|
37
|
+
Commit subjects must match `type(scope): subject`: type from {feat, fix, refactor, perf, docs, test, chore, ci, build, style}, imperative mood, ≤72 chars, no trailing period, lowercase after the colon. Run `git config commit.template .gitmessage` once per clone to load the template into your editor.
|
|
38
38
|
|
|
39
|
-
PR descriptions must keep all six headings
|
|
39
|
+
PR descriptions must keep all six headings (Summary, Beads issue, Doc updates included, Local gates, Test plan, Risks / rollback) with at least one checked box in both the "Doc updates" and "Local gates" sections. Empty templates fail.
|
|
40
40
|
|
|
41
41
|
Forbidden in commit messages: `Co-Authored-By: Claude*` trailers (unless the user explicitly asks), `--no-verify`, `--no-gpg-sign`. Forbidden in PR bodies: deleting the required headings, leaving every gate box unchecked.
|
|
42
42
|
|
|
@@ -47,7 +47,7 @@ For every non-trivial change:
|
|
|
47
47
|
1. **A Beads issue exists.** `bd ready` to find or create one. `bd show <id>` to read context. `bd update <id> --claim` to claim before editing files.
|
|
48
48
|
2. **`plan.md` reflects the work.** Even though `plan.md` is local-only and gitignored, it stays the human-readable working plan. Mark items `done` when they ship; add new rows for work that wasn't previously tracked.
|
|
49
49
|
3. **Doc updates land in the same change as code.** If runtime shape, contracts, boundaries, or major dependencies changed, update `docs/concepts/architecture.md` in the same commit. If the docs surface or maintenance contract changed, update `docs/README.md`. If active work, decisions, or assumptions changed, update `.cx/context.md` and `.cx/context.json`. Always add a `CHANGELOG.md` entry.
|
|
50
|
-
4. **Beads close on green.** `bd close <id>` happens after CI is green and the work is verified
|
|
50
|
+
4. **Beads close on green.** `bd close <id>` happens after CI is green and the work is verified: not before.
|
|
51
51
|
|
|
52
52
|
## Hard rules
|
|
53
53
|
|
package/rules/common/research.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/common/research.md
|
|
2
|
+
rules/common/research.md: canonical research and evidence policy for Construct.
|
|
3
3
|
|
|
4
4
|
Defines how research starts, which sources to prefer, how claims are verified,
|
|
5
5
|
and what must be recorded so findings are reproducible. Applies to research,
|
|
@@ -14,9 +14,9 @@ Construct treats research as a reproducible evidence-gathering process, not free
|
|
|
14
14
|
|
|
15
15
|
Research always starts from the most recent available evidence.
|
|
16
16
|
|
|
17
|
-
- Default to sources from the current year before earlier years
|
|
17
|
+
- Default to sources from the current year before earlier years: always search most-recent-first.
|
|
18
18
|
- For fast-moving topics (AI tools, LLM behavior, cloud APIs, security advisories, market data), treat anything older than 12 months as presumptively stale unless a newer source confirms it is still accurate.
|
|
19
|
-
- When using a search engine or index, always filter or sort by date
|
|
19
|
+
- When using a search engine or index, always filter or sort by date: do not rely on relevance ranking alone.
|
|
20
20
|
- State the publication or access date for every external source. If a source has no date, treat its confidence as `low` until recency is established another way.
|
|
21
21
|
|
|
22
22
|
## 2. Domain-specific starting points
|
|
@@ -67,7 +67,7 @@ Record:
|
|
|
67
67
|
Every URL cited in a committed document must be verified before the document is published.
|
|
68
68
|
|
|
69
69
|
- Fetch the URL. Confirm it resolves and the content matches the cited claim.
|
|
70
|
-
- Do not cite aggregate or index pages (e.g., arxiv.org search results, Google Scholar listings) for quantitative claims
|
|
70
|
+
- Do not cite aggregate or index pages (e.g., arxiv.org search results, Google Scholar listings) for quantitative claims: cite the specific paper or article URL.
|
|
71
71
|
- If a URL returns a 404, paywall, or redirect loop, find the canonical source or replace the citation.
|
|
72
72
|
- Unverified URLs must be marked `[unverified]` until confirmed.
|
|
73
73
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/common/review-before-change.md: audit the current state before authoring anything new.
|
|
3
|
+
|
|
4
|
+
Applies to every specialist on every platform. Pairs with framing.md (frame the
|
|
5
|
+
problem) and development-workflow.md step 0 (research and reuse before code).
|
|
6
|
+
This rule extends the same discipline to artifacts: docs, strategy, PRDs, ADRs,
|
|
7
|
+
RFCs, rules, templates, and any other durable file. Read before scaffolding.
|
|
8
|
+
-->
|
|
9
|
+
# Review Before Change
|
|
10
|
+
|
|
11
|
+
Before creating or rewriting a durable artifact, check what already exists.
|
|
12
|
+
|
|
13
|
+
This rule exists because the most common waste in Construct is duplicated effort: a new strategy doc landing next to a PRD that already covers it, a new rule re-stating a section of `framing.md`, a new diagram drawn while an equivalent one sits two folders away. The fix is not more process. It is a fifteen-second audit before the first write.
|
|
14
|
+
|
|
15
|
+
## When this applies
|
|
16
|
+
|
|
17
|
+
Any time the work would produce or significantly rewrite one of:
|
|
18
|
+
|
|
19
|
+
- A doc under `docs/`, including concepts, cookbook, providers, runbooks, ADRs, RFCs, PRDs, memos, runbooks, decisions.
|
|
20
|
+
- A rule under `rules/` or a skill under `skills/`.
|
|
21
|
+
- A template under `templates/`.
|
|
22
|
+
- A top-level repo doc (README, CHANGELOG, STRATEGY, AGENTS, CONTRIBUTING).
|
|
23
|
+
- A profile under `profiles/` or a registered agent.
|
|
24
|
+
|
|
25
|
+
It does not apply to local-only working files (`plan.md`, `.cx/` state, draft scratch).
|
|
26
|
+
|
|
27
|
+
## The audit
|
|
28
|
+
|
|
29
|
+
Before writing, answer all three:
|
|
30
|
+
|
|
31
|
+
1. **Does an artifact for this already exist?** Search by topic, not filename. `grep -rli "<topic>" docs/ rules/ skills/` is the floor. If something close exists, the default is to extend or supersede, not to create a sibling.
|
|
32
|
+
2. **Is there a template or canonical shape for this artifact type?** Check `templates/docs/` and the matching `skills/docs/*-workflow.md`. If a shape exists, use it; do not invent a new structure.
|
|
33
|
+
3. **What is the canonical home for this kind of content?** A strategy doc belongs in one place. A new ADR does not live in `docs/notes/`. If you have to think about where to put it, the location is wrong.
|
|
34
|
+
|
|
35
|
+
If any answer surfaces an existing artifact, you have two valid moves:
|
|
36
|
+
|
|
37
|
+
- **Extend it.** Add the missing section to the existing file.
|
|
38
|
+
- **Supersede it.** Replace the old artifact and mark it superseded. Do not leave two competing sources of truth.
|
|
39
|
+
|
|
40
|
+
Creating a new sibling artifact "because the old one didn't quite fit" is the failure mode this rule prevents. If the old one doesn't fit, fix it.
|
|
41
|
+
|
|
42
|
+
## Documenting the audit
|
|
43
|
+
|
|
44
|
+
For artifacts that go through a review cycle (strategy, PRD, ADR, RFC), the framing or problem-statement section should briefly note what existing artifacts were reviewed and why a new one is warranted. One sentence is enough. The point is to leave evidence that the audit happened.
|
|
45
|
+
|
|
46
|
+
## Anti-patterns
|
|
47
|
+
|
|
48
|
+
- Creating `docs/notes/strategy.md` because you didn't notice `STRATEGY.md` at the root.
|
|
49
|
+
- Writing a new rule that paraphrases an existing one.
|
|
50
|
+
- Adding a new template alongside `templates/docs/strategy.md` because the existing one "needed a couple of tweaks."
|
|
51
|
+
- Drafting an ADR for a decision already captured in an existing ADR.
|
|
52
|
+
- Producing a recipe in `docs/cookbook/` for a workflow already documented in `docs/concepts/`.
|
|
53
|
+
|
|
54
|
+
## Related
|
|
55
|
+
|
|
56
|
+
- `rules/common/framing.md`: frame the underlying problem before reaching for inputs.
|
|
57
|
+
- `rules/common/development-workflow.md`: step 0 covers the same discipline for code.
|
|
58
|
+
- `rules/common/doc-ownership.md`: which specialist owns which artifact type.
|
package/rules/common/security.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/common/security.md
|
|
2
|
+
rules/common/security.md: mandatory security checks and secret management.
|
|
3
3
|
|
|
4
4
|
Defines pre-commit security checklist, secret management rules,
|
|
5
5
|
and response protocol for discovered vulnerabilities.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/common/skill-composition.md
|
|
2
|
+
rules/common/skill-composition.md: how specialist prompts compose with skill files.
|
|
3
3
|
|
|
4
4
|
Defines the default boundary between what lives in the agent's base prompt and
|
|
5
5
|
what is fetched via `get_skill` at runtime. Aims to keep prompts lean while
|
|
@@ -17,13 +17,13 @@ Every specialist prompt carries a marker:
|
|
|
17
17
|
**Role guidance**: call `get_skill("roles/NAME")` before drafting.
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
When the agent begins substantive work in its domain, it calls `get_skill("roles/NAME")` via the construct-mcp server. The skill body is returned for that turn only
|
|
20
|
+
When the agent begins substantive work in its domain, it calls `get_skill("roles/NAME")` via the construct-mcp server. The skill body is returned for that turn only: no permanent prompt budget is consumed.
|
|
21
21
|
|
|
22
22
|
All hosts Construct supports (Claude Code, OpenCode, Codex, Copilot) have `get_skill` available through the construct-mcp server, so the runtime call is reliable.
|
|
23
23
|
|
|
24
24
|
## Why on-demand is the default
|
|
25
25
|
|
|
26
|
-
Inlining every role skill at sync time used to consume ~1000–2000 words of prompt budget per specialist, regardless of whether the skill content was relevant to the current task. That budget is fixed
|
|
26
|
+
Inlining every role skill at sync time used to consume ~1000–2000 words of prompt budget per specialist, regardless of whether the skill content was relevant to the current task. That budget is fixed: it reduces the window available for actual context.
|
|
27
27
|
|
|
28
28
|
On-demand loading means:
|
|
29
29
|
|
|
@@ -40,20 +40,20 @@ Set `preloadRoleGuidance: true` on a registry entry only when:
|
|
|
40
40
|
- The role content is so load-bearing that every single turn needs it
|
|
41
41
|
- The agent's model is weak at tool-calling discipline and skips the `get_skill` call in practice
|
|
42
42
|
|
|
43
|
-
This should be rare. If you find yourself preloading most agents, revisit the reasoning
|
|
43
|
+
This should be rare. If you find yourself preloading most agents, revisit the reasoning: the default exists because the cost is real.
|
|
44
44
|
|
|
45
45
|
## Skill array vs. role guidance
|
|
46
46
|
|
|
47
47
|
Two different mechanisms for two different purposes:
|
|
48
48
|
|
|
49
|
-
- **Registry `skills: [...]` array
|
|
50
|
-
- **Role guidance directive
|
|
49
|
+
- **Registry `skills: [...]` array**: declarative metadata listing which skills the agent is *entitled* to call. Not inlined into the prompt. Used by `list_skills`, routing heuristics, and audit tooling. Add skills here liberally.
|
|
50
|
+
- **Role guidance directive**: the single `**Role guidance**: call get_skill("roles/NAME")` line in the prompt. Points the agent at its role file and (by default) tells it to load on demand. Exactly one per agent.
|
|
51
51
|
|
|
52
52
|
## Contributor guidance
|
|
53
53
|
|
|
54
54
|
When adding or editing a specialist:
|
|
55
55
|
|
|
56
|
-
1. Keep the base prompt short
|
|
56
|
+
1. Keep the base prompt short: role, perspective, productive tension, handoff contract. Under 400 words is normal.
|
|
57
57
|
2. Put domain depth into `skills/roles/NAME.md` and optional flavor overlays like `skills/roles/NAME.FLAVOR.md`.
|
|
58
58
|
3. Leave the role-guidance directive in place. Do not manually inline role content into the prompt body.
|
|
59
59
|
4. Only add `preloadRoleGuidance: true` with a written reason in the registry description.
|
|
@@ -64,4 +64,4 @@ Do not:
|
|
|
64
64
|
|
|
65
65
|
- Paste role-skill content directly into the prompt body "to be safe"
|
|
66
66
|
- Add `preloadRoleGuidance: true` to push a prompt under the cap without fixing the underlying bloat
|
|
67
|
-
- Split a role skill into many tiny files to dodge the cap
|
|
67
|
+
- Split a role skill into many tiny files to dodge the cap: keep the cohesive unit, load it on demand instead
|
package/rules/common/testing.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/common/testing.md
|
|
2
|
+
rules/common/testing.md: test coverage requirements and TDD workflow.
|
|
3
3
|
|
|
4
4
|
Defines minimum 80% coverage, TDD red-green-refactor cycle,
|
|
5
5
|
AAA test structure, and descriptive naming conventions.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/golang/coding-style.md
|
|
2
|
+
rules/golang/coding-style.md: <one-line purpose>
|
|
3
3
|
|
|
4
4
|
<2–6 line summary.>
|
|
5
5
|
-->
|
|
@@ -15,7 +15,7 @@ paths:
|
|
|
15
15
|
|
|
16
16
|
## Formatting
|
|
17
17
|
|
|
18
|
-
- **gofmt** and **goimports** are mandatory
|
|
18
|
+
- **gofmt** and **goimports** are mandatory: no style debates
|
|
19
19
|
|
|
20
20
|
## Design Principles
|
|
21
21
|
|
package/rules/golang/hooks.md
CHANGED
package/rules/golang/patterns.md
CHANGED
package/rules/golang/security.md
CHANGED
package/rules/golang/testing.md
CHANGED
package/rules/python/hooks.md
CHANGED
package/rules/python/patterns.md
CHANGED
package/rules/python/security.md
CHANGED
package/rules/python/testing.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/swift/coding-style.md
|
|
2
|
+
rules/swift/coding-style.md: <one-line purpose>
|
|
3
3
|
|
|
4
4
|
<2–6 line summary.>
|
|
5
5
|
-->
|
|
@@ -19,14 +19,14 @@ paths:
|
|
|
19
19
|
|
|
20
20
|
## Immutability
|
|
21
21
|
|
|
22
|
-
- Prefer `let` over `var
|
|
22
|
+
- Prefer `let` over `var`: define everything as `let` and only change to `var` if the compiler requires it
|
|
23
23
|
- Use `struct` with value semantics by default; use `class` only when identity or reference semantics are needed
|
|
24
24
|
|
|
25
25
|
## Naming
|
|
26
26
|
|
|
27
27
|
Follow [Apple API Design Guidelines](https://www.swift.org/documentation/api-design-guidelines/):
|
|
28
28
|
|
|
29
|
-
- Clarity at the point of use
|
|
29
|
+
- Clarity at the point of use: omit needless words
|
|
30
30
|
- Name methods and properties for their roles, not their types
|
|
31
31
|
- Use `static let` for constants over global constants
|
|
32
32
|
|
package/rules/swift/hooks.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/swift/hooks.md
|
|
2
|
+
rules/swift/hooks.md: <one-line purpose>
|
|
3
3
|
|
|
4
4
|
<2–6 line summary.>
|
|
5
5
|
-->
|
|
@@ -18,4 +18,4 @@ paths:
|
|
|
18
18
|
|
|
19
19
|
## Warning
|
|
20
20
|
|
|
21
|
-
Flag `print()` statements
|
|
21
|
+
Flag `print()` statements: use `os.Logger` or structured logging instead for production code.
|
package/rules/swift/patterns.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
rules/swift/patterns.md
|
|
2
|
+
rules/swift/patterns.md: <one-line purpose>
|
|
3
3
|
|
|
4
4
|
<2–6 line summary.>
|
|
5
5
|
-->
|
|
@@ -53,7 +53,7 @@ actor Cache<Key: Hashable & Sendable, Value: Sendable> {
|
|
|
53
53
|
|
|
54
54
|
## Dependency Injection
|
|
55
55
|
|
|
56
|
-
Inject protocols with default parameters
|
|
56
|
+
Inject protocols with default parameters: production uses defaults, tests inject mocks:
|
|
57
57
|
|
|
58
58
|
```swift
|
|
59
59
|
struct UserService {
|