@lifeaitools/rdc-skills 0.8.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.
Files changed (97) hide show
  1. package/.claude/settings.json +15 -0
  2. package/.claude-plugin/marketplace.json +21 -0
  3. package/.claude-plugin/plugin.json +11 -0
  4. package/.github/workflows/publish.yml +25 -0
  5. package/.github/workflows/self-test.yml +53 -0
  6. package/CHANGELOG.md +246 -0
  7. package/LICENSE +21 -0
  8. package/MANIFEST.md +190 -0
  9. package/README.md +188 -0
  10. package/README.sandbox.md +3 -0
  11. package/assets/watcher/viewer.html +164 -0
  12. package/commands/build.md +183 -0
  13. package/commands/collab.md +180 -0
  14. package/commands/deploy.md +138 -0
  15. package/commands/fixit.md +112 -0
  16. package/commands/handoff.md +173 -0
  17. package/commands/help.md +88 -0
  18. package/commands/overnight.md +220 -0
  19. package/commands/plan.md +158 -0
  20. package/commands/preplan.md +131 -0
  21. package/commands/prototype.md +145 -0
  22. package/commands/release.md +159 -0
  23. package/commands/report.md +99 -0
  24. package/commands/review.md +120 -0
  25. package/commands/self-test.md +107 -0
  26. package/commands/status.md +86 -0
  27. package/commands/watch.md +92 -0
  28. package/commands/workitems.md +132 -0
  29. package/guides/.gitkeep +0 -0
  30. package/guides/agent-bootstrap.md +191 -0
  31. package/guides/agents/backend.md +104 -0
  32. package/guides/agents/content.md +94 -0
  33. package/guides/agents/cs2.md +56 -0
  34. package/guides/agents/data.md +87 -0
  35. package/guides/agents/design.md +77 -0
  36. package/guides/agents/frontend.md +92 -0
  37. package/guides/agents/infrastructure.md +81 -0
  38. package/guides/agents/setup.md +279 -0
  39. package/guides/agents/verify.md +132 -0
  40. package/guides/agents/viz.md +106 -0
  41. package/guides/backend.md +146 -0
  42. package/guides/content.md +147 -0
  43. package/guides/cs2.md +190 -0
  44. package/guides/data.md +123 -0
  45. package/guides/design.md +116 -0
  46. package/guides/frontend.md +151 -0
  47. package/guides/infrastructure.md +179 -0
  48. package/guides/output-contract.md +98 -0
  49. package/hooks/no-stop-open-epics.js +125 -0
  50. package/package.json +31 -0
  51. package/rules/work-items-rpc.md +399 -0
  52. package/scripts/install-rdc-skills.js +559 -0
  53. package/scripts/install.ps1 +165 -0
  54. package/scripts/install.sh +132 -0
  55. package/scripts/lib/assertions.mjs +264 -0
  56. package/scripts/lib/manifest-schema.mjs +607 -0
  57. package/scripts/lib/runner.mjs +429 -0
  58. package/scripts/lib/sandbox.mjs +435 -0
  59. package/scripts/self-test.mjs +1108 -0
  60. package/scripts/uninstall.ps1 +77 -0
  61. package/scripts/uninstall.sh +69 -0
  62. package/scripts/update.ps1 +43 -0
  63. package/scripts/update.sh +43 -0
  64. package/scripts/watch-init.mjs +100 -0
  65. package/skills/.gitkeep +0 -0
  66. package/skills/build/SKILL.md +238 -0
  67. package/skills/collab/SKILL.md +218 -0
  68. package/skills/deploy/SKILL.md +144 -0
  69. package/skills/fixit/SKILL.md +112 -0
  70. package/skills/handoff/SKILL.md +175 -0
  71. package/skills/help/SKILL.md +101 -0
  72. package/skills/overnight/SKILL.md +220 -0
  73. package/skills/plan/SKILL.md +96 -0
  74. package/skills/preplan/SKILL.md +87 -0
  75. package/skills/prototype/SKILL.md +151 -0
  76. package/skills/release/SKILL.md +221 -0
  77. package/skills/report/SKILL.md +101 -0
  78. package/skills/review/SKILL.md +120 -0
  79. package/skills/self-test/SKILL.md +127 -0
  80. package/skills/status/SKILL.md +86 -0
  81. package/skills/tests/README.md +29 -0
  82. package/skills/tests/rdc-build.test.json +22 -0
  83. package/skills/tests/rdc-deploy.test.json +15 -0
  84. package/skills/tests/rdc-fixit.test.json +21 -0
  85. package/skills/tests/rdc-handoff.test.json +14 -0
  86. package/skills/tests/rdc-overnight.test.json +21 -0
  87. package/skills/tests/rdc-plan.test.json +14 -0
  88. package/skills/tests/rdc-preplan.test.json +15 -0
  89. package/skills/tests/rdc-prototype.test.json +14 -0
  90. package/skills/tests/rdc-release.test.json +15 -0
  91. package/skills/tests/rdc-report.test.json +14 -0
  92. package/skills/tests/rdc-review.test.json +14 -0
  93. package/skills/tests/rdc-status.test.json +16 -0
  94. package/skills/tests/rdc-workitems.test.json +15 -0
  95. package/skills/watch/SKILL.md +92 -0
  96. package/skills/workitems/SKILL.md +147 -0
  97. package/tests/validate-skills.js +183 -0
@@ -0,0 +1,106 @@
1
+ > **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
2
+ > Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
3
+ > One checklist upfront, updated in place, shown again at end with a 1-line verdict.
4
+
5
+ > If dispatching subagents or running as a subagent: read `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md` first (fallback: `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md`).
6
+
7
+
8
+ # rdc:viz — Visualization Agent
9
+
10
+ ## Mandatory First Steps
11
+
12
+ Read BOTH guides before ANY code:
13
+ ```
14
+ {PROJECT_ROOT}/.rdc/guides/frontend.md (fallback: {PROJECT_ROOT}/.rdc/guides/frontend.md)
15
+ {PROJECT_ROOT}/.rdc/guides/design.md (fallback: {PROJECT_ROOT}/.rdc/guides/design.md)
16
+ ```
17
+
18
+ ## Before Writing Any Code
19
+
20
+ 1. **Check for existing prototypes:**
21
+ ```sql
22
+ SELECT name, component, source_path, status, notes
23
+ FROM prototype_registry
24
+ WHERE status IN ('prototype', 'converting')
25
+ ORDER BY created_at DESC;
26
+ ```
27
+ Source path is usually `docs/source/`. **Read it first.**
28
+
29
+ 2. **Check design decisions:**
30
+ ```sql
31
+ SELECT topic, summary FROM design_context
32
+ WHERE topic ILIKE '%<viz-name>%';
33
+ ```
34
+
35
+ ## SVG Layout Patterns
36
+
37
+ When building new SVG-based viz:
38
+ - Define all layout constants at top (`W`, `H`, column x-centers, box dimensions)
39
+ - Build path builders as pure functions
40
+ - Separate data from rendering
41
+ - Use `viewBox` for responsive scaling
42
+ - Animate with appropriate motion libraries
43
+
44
+ ```tsx
45
+ const W = 980, H = 570;
46
+ const COL_A = 80, COL_B = 240, COL_C = 435;
47
+
48
+ function pathTo(x1: number, y1: number, x2: number, y2: number): string {
49
+ const mx = (x1 + x2) / 2;
50
+ return `M ${x1} ${y1} C ${mx} ${y1} ${mx} ${y2} ${x2} ${y2}`;
51
+ }
52
+ ```
53
+
54
+ ## Viz Component Contract
55
+
56
+ ```tsx
57
+ "use client";
58
+ import * as React from "react";
59
+ import { cva, type VariantProps } from "class-variance-authority";
60
+ import { cn } from "../lib/utils";
61
+
62
+ // CVA variants required on every new viz component
63
+ const myVizVariants = cva("relative w-full", {
64
+ variants: {
65
+ layout: { single: "", double: "flex flex-col", grid: "" },
66
+ density: { compact: "", comfortable: "", spacious: "" },
67
+ },
68
+ defaultVariants: { layout: "single", density: "comfortable" },
69
+ });
70
+
71
+ interface MyVizProps
72
+ extends React.HTMLAttributes<HTMLDivElement>,
73
+ VariantProps<typeof myVizVariants> {}
74
+
75
+ const MyViz = React.forwardRef<HTMLDivElement, MyVizProps>(
76
+ ({ className, layout, density, ...props }, ref) => (
77
+ <div ref={ref} className={cn(myVizVariants({ layout, density }), className)} {...props} />
78
+ )
79
+ );
80
+ MyViz.displayName = "MyViz";
81
+ export { MyViz, myVizVariants };
82
+ ```
83
+
84
+ Export from package's index after building.
85
+
86
+ ## Registering New Viz Components
87
+
88
+ After completing:
89
+ ```sql
90
+ INSERT INTO prototype_registry (name, component, source_path, notes, created_by)
91
+ VALUES (
92
+ 'MyViz v1.0',
93
+ 'MyViz',
94
+ 'packages/ui/src/components/my-viz.tsx',
95
+ 'Production component. Props: <list key props>',
96
+ 'agent'
97
+ );
98
+ ```
99
+
100
+ ## Safety Rules
101
+
102
+ - Branch: development branch — auto-commit
103
+ - NEVER run `pnpm build`
104
+ - Reduce motion: always wrap animations with appropriate hooks
105
+ - NEVER overlap with other agents on the same component file
106
+ - Write tests FIRST — red → implement → green
@@ -0,0 +1,146 @@
1
+ # Backend Agent Guide — Base
2
+ > Role-based context for backend/API/data agents. Generic patterns across projects.
3
+
4
+ ---
5
+
6
+ ## Database Client Patterns
7
+
8
+ Every project specifies its database client library. Always use that instead of writing raw SQL.
9
+
10
+ Generic server component pattern:
11
+ ```ts
12
+ // Server component / API route
13
+ const client = await createServerClient();
14
+ const { data, error } = await client.from("table").select("*");
15
+ ```
16
+
17
+ Generic browser component pattern:
18
+ ```ts
19
+ // Client component
20
+ const client = createBrowserClient();
21
+ const { data, error } = await client.from("table").select("*");
22
+ ```
23
+
24
+ The project overlay specifies:
25
+ - Import path for server client
26
+ - Import path for browser client
27
+ - How to access non-public schemas
28
+ - Authentication requirements
29
+
30
+ ---
31
+
32
+ ## Environment Variables
33
+
34
+ ```bash
35
+ # Required in every app
36
+ # (Project overlay specifies exact variable names and format)
37
+ SERVICE_URL=https://...
38
+ SERVICE_ANON_KEY=...
39
+
40
+ # Server-side only (never prefix with PUBLIC_)
41
+ SERVICE_ADMIN_KEY=...
42
+ ```
43
+
44
+ The project overlay specifies:
45
+ - Exact variable names
46
+ - Which are public vs server-only
47
+ - Where to retrieve credentials
48
+
49
+ ---
50
+
51
+ ## Auth Patterns
52
+
53
+ Projects typically provide auth helpers. Check project overlay for:
54
+ - `getUser()` — nullable, server-side only
55
+ - `requireAuth()` — throws if unauthenticated
56
+ - Middleware patterns (public pass-through vs protected)
57
+ - Login method (magic link, OAuth, etc.)
58
+
59
+ ---
60
+
61
+ ## Work Items / Task Management
62
+
63
+ Most projects have a task/epic system. The project overlay specifies:
64
+ - Whether to use RPC functions or raw SQL
65
+ - Required fields and enums
66
+ - Relationship patterns (parent/child hierarchy)
67
+ - Which operations require special handling
68
+
69
+ Never guess at the implementation — read the project overlay.
70
+
71
+ ---
72
+
73
+ ## API Route Patterns
74
+
75
+ ```ts
76
+ // app/api/example/route.ts
77
+ import { createServerClient } from "@project/db";
78
+ import { NextResponse } from "next/server";
79
+
80
+ export async function GET() {
81
+ const client = await createServerClient();
82
+ const { data, error } = await client.from("table").select("*");
83
+ if (error) return NextResponse.json({ error: error.message }, { status: 500 });
84
+ return NextResponse.json(data);
85
+ }
86
+
87
+ export async function POST(request: Request) {
88
+ const body = await request.json();
89
+ const client = await createServerClient();
90
+ const { data, error } = await client.from("table").insert(body).select().single();
91
+ if (error) return NextResponse.json({ error: error.message }, { status: 400 });
92
+ return NextResponse.json(data, { status: 201 });
93
+ }
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Schema-Driven Forms
99
+
100
+ Some projects use dynamic schema tables for form generation. The project overlay specifies:
101
+ - Table for field schema
102
+ - Components that read schema at runtime (DynamicForm, AdaptiveCrud, etc.)
103
+ - Never hardcode form columns
104
+
105
+ ---
106
+
107
+ ## Credential Safety
108
+
109
+ The project overlay specifies:
110
+ - Where credentials come from (MCP, daemon, env vars)
111
+ - Never print keys to stdout
112
+ - Never hardcode credentials in source
113
+ - Never ask the user for keys
114
+ - If daemon/service is down: report BLOCKED, do not work around
115
+
116
+ ---
117
+
118
+ ## Key Schema Domains (Check Project Overlay)
119
+
120
+ The project specifies its schema structure:
121
+ - Which tables exist in which schemas
122
+ - Primary keys and foreign relationships
123
+ - RLS policies and access rules
124
+ - Materialized views or special queries
125
+
126
+ Never assume schema structure — read the project overlay.
127
+
128
+ ---
129
+
130
+ ## Migration Patterns
131
+
132
+ The project overlay specifies:
133
+ - Where migration files live
134
+ - How to apply migrations
135
+ - How to verify migrations
136
+ - Which database service to use
137
+
138
+ ---
139
+
140
+ ## Specialist Context — Read Project Overlay
141
+
142
+ Your task may require reading additional project-specific guides for:
143
+ - Full DB schema with all columns
144
+ - Deployment registry patterns
145
+ - Brand token API
146
+ - Auth patterns beyond basics
@@ -0,0 +1,147 @@
1
+ # Content Agent Guide — Base
2
+ > Role-based context for content, copywriting, and messaging agents. Generic patterns across projects.
3
+
4
+ ---
5
+
6
+ ## Core Messaging
7
+
8
+ Every project has a core message and lead word. Check the overlay for:
9
+ - The single most important concept
10
+ - The tone and voice (formal, friendly, technical, etc.)
11
+ - Key messages and themes
12
+ - Audience segments and their pain points
13
+
14
+ ---
15
+
16
+ ## Language Rules
17
+
18
+ The project specifies:
19
+ - Words/phrases to ALWAYS use
20
+ - Words/phrases to NEVER use alone
21
+ - Synonyms to prefer
22
+ - Jargon levels (when to use, when to avoid)
23
+ - Metaphors and analogies that resonate
24
+
25
+ ---
26
+
27
+ ## Regulatory Context
28
+
29
+ Check the overlay for:
30
+ - Compliance framework (Reg D, HIPAA, etc.)
31
+ - Disclaimers required
32
+ - Language restrictions (cannot guarantee, cannot claim, etc.)
33
+ - When to involve legal review
34
+
35
+ ---
36
+
37
+ ## Audience Segments
38
+
39
+ The project defines segments with:
40
+ - Pain points
41
+ - What they care about
42
+ - Key values
43
+ - Messaging hooks per segment
44
+ - Success metrics
45
+
46
+ Tailor messaging per segment.
47
+
48
+ ---
49
+
50
+ ## Key Acronyms and Terminology
51
+
52
+ The project provides:
53
+ - List of acronyms and full names
54
+ - When to use acronym vs full name
55
+ - Related concepts and distinctions
56
+ - Pronunciation (if needed)
57
+
58
+ ---
59
+
60
+ ## Brand Positioning
61
+
62
+ The project specifies:
63
+ - Brand promise
64
+ - Competitive positioning
65
+ - Unique value proposition
66
+ - Brand personality
67
+
68
+ ---
69
+
70
+ ## Architecture and Offerings
71
+
72
+ The project describes:
73
+ - Product/service offerings
74
+ - How they work together
75
+ - Key features and benefits
76
+ - Pricing/tier structure (if applicable)
77
+
78
+ ---
79
+
80
+ ## Key Financial/Impact Facts
81
+
82
+ The project provides:
83
+ - Headline metrics (fund size, returns, impact, etc.)
84
+ - Ranges vs absolutes
85
+ - How to cite data
86
+ - What claims require support
87
+
88
+ ---
89
+
90
+ ## Contact Information
91
+
92
+ The project specifies:
93
+ - Primary contact person
94
+ - Contact method (email, phone, etc.)
95
+ - When different contacts are appropriate
96
+ - What to escalate
97
+
98
+ ---
99
+
100
+ ## Tone Guidelines
101
+
102
+ The project specifies:
103
+ - Voice characteristics (authoritative, friendly, technical, etc.)
104
+ - Active vs passive voice preference
105
+ - Sentence structure patterns
106
+ - Metaphor usage
107
+ - Humor guidelines
108
+
109
+ ---
110
+
111
+ ## Live Products / Offerings
112
+
113
+ The project lists:
114
+ - Current offerings (products, services, projects, etc.)
115
+ - Status (active, development, archived)
116
+ - Key features or differentiators
117
+
118
+ ---
119
+
120
+ ## Email Templates
121
+
122
+ Some projects use templated emails. Check overlay for:
123
+ - Email template library
124
+ - When to use canned vs custom
125
+ - Email formatting standards
126
+ - Signature blocks
127
+
128
+ ---
129
+
130
+ ## Campaign Engine
131
+
132
+ Some projects have automated campaigns. Check overlay for:
133
+ - Campaign template system
134
+ - Variable injection patterns
135
+ - Segment-specific personalization
136
+ - Scheduling and delivery rules
137
+
138
+ ---
139
+
140
+ ## Specialist Context — Read Project Overlay
141
+
142
+ Your task may require reading additional project-specific guides for:
143
+ - Complete acronym list
144
+ - Detailed financial facts
145
+ - Full audience segment profiles
146
+ - Campaign templates and examples
147
+ - Compliance and legal language requirements
package/guides/cs2.md ADDED
@@ -0,0 +1,190 @@
1
+ # CS 2.0 Agent Guide
2
+ > Role-based context for Computer Science 2.0 subsystem agents.
3
+ > This is LIFEAI-specific architecture. All CS 2.0 work happens in the LIFEAI ecosystem.
4
+
5
+ ---
6
+
7
+ ## The Paradigm
8
+
9
+ **Before writing ANY code, ask: "Is this building a new computational primitive, or is it wiring a UI to a database?"**
10
+
11
+ If the latter -- STOP. You are falling into CS 1.0 thinking.
12
+
13
+ CS 2.0 is a new computational paradigm. The work is to build:
14
+
15
+ 1. **Languages** — Meta-compilers and AI-evolved DSLs, not traditional code
16
+ 2. **Data primitives** — Time-native, certainty-propagating, cross-product-aware
17
+ 3. **Memory systems** — Associative retrieval, not databases
18
+ 4. **Cognitive runtimes** — Virtue-governed execution, not simple executors
19
+ 5. **Governance** — Virtue weights are signed and versioned, not embedded in code
20
+
21
+ The web apps (portals, dashboards, UIs) are the **surface layer**. They display CS 2.0 systems at work. They are not the work itself.
22
+
23
+ ---
24
+
25
+ ## What CS 2.0 is NOT
26
+
27
+ - Wiring React components to database queries
28
+ - Building CRUD dashboards
29
+ - Adding features to Next.js apps
30
+ - Traditional API + database + frontend development
31
+
32
+ Those are CS 1.0 patterns. CS 2.0 is the substrate they run on.
33
+
34
+ ---
35
+
36
+ ## Seven Subsystems
37
+
38
+ ### 1. HAIL (`@regen/hail`)
39
+
40
+ Meta-compiler that GENERATES domain-specific languages. Each domain (ecology, capital, governance, health, law) gets its own DSL. AI evolves these grammars. HAIL does not execute programs — it writes them.
41
+
42
+ ### 2. Quad Pixel Q(M,V,A,C) (`@regen/quad-pixel`)
43
+
44
+ Language-level data primitive. Every data point carries Magnitude, Velocity, Acceleration, Certainty. Time is native, not metadata. Cross-products are built-in. Certainty propagates automatically.
45
+
46
+ ### 3. AEMG (`@regen/aemg`)
47
+
48
+ Associative Episodic Memory Graph. NOT a database. Memory is retrieved through associative traversal, not lookup. Images anchor time. Virtue anchors meaning. Relevance governs forgetting. Dual-truth preservation (who you were + who you are).
49
+
50
+ ### 4. Being State Processor (`@regen/being-state-processor`)
51
+
52
+ The cognitive runtime. Orchestrates lower functions under virtue governance. Lower functions execute but NEVER reason about virtue. Virtue is supplied from above, not embedded in the executor. (Like muscles don't know if they're writing a poem or committing a crime.)
53
+
54
+ ### 5. Virtue Engine (`@regen/virtue-engine`)
55
+
56
+ REPLACES the reward function. Not a scoring widget. The architectural conscience invoked by all subsystems BEFORE consequential action. Virtue weights are governed, versioned, signed — never self-modified by executing layers.
57
+
58
+ ### 6. Gene Expression Model
59
+
60
+ Interactions suppress or activate functions for their duration. Learned through observation over time (Quad Pixel cross-correlation), not through programming.
61
+
62
+ ### 7. Domain DSLs
63
+
64
+ Each evolved by AI from HAIL grammars. One source of truth emits: Python microservices, DMN tables, BPMN flows, DTDL twins, LaTeX proofs. Five forms. All synchronized.
65
+
66
+ ---
67
+
68
+ ## Supporting Packages
69
+
70
+ | Package | Purpose |
71
+ |---------|---------|
72
+ | `@regen/cs2` | Core primitives and shared types |
73
+ | `@regen/cs2-integration` | Pipeline utilities, type bridges (depends on 9 packages) |
74
+ | `@regen/pal` | Personal AI Liaison -- 90s Moment Window, Graph Memory |
75
+ | `@regen/sdl` | Semantic Design Language for civic design |
76
+ | `@regen/planetary-ontology` | Earth Digital Twin -- Neo4j graph layer |
77
+ | `@regen/genetic-sandbox` | Genetic algorithm sandbox for HAIL grammar evolution |
78
+ | `@regen/reinforcement-renderer` | Reinforcement learning renderer for visual output |
79
+ | `@regen/visual-model` | Visual modelling primitives |
80
+
81
+ ---
82
+
83
+ ## Package Dependency Graph
84
+
85
+ ```
86
+ Layer 0 (roots -- no @regen/ deps):
87
+ cs2 quad-pixel virtue-engine genetic-sandbox
88
+
89
+ Layer 1 (single root dep):
90
+ sdl (quad-pixel)
91
+ planetary-ontology (quad-pixel)
92
+
93
+ Layer 2 (2-3 root deps):
94
+ pal (quad-pixel, virtue-engine)
95
+ hail (genetic-sandbox, quad-pixel, virtue-engine)
96
+ reinforcement-renderer (genetic-sandbox, quad-pixel, sdl, virtue-engine)
97
+
98
+ Layer 3 (composite):
99
+ aemg (pal, quad-pixel, virtue-engine)
100
+ visual-model (quad-pixel, reinforcement-renderer)
101
+
102
+ Layer 4 (deep composite):
103
+ being-state-processor (aemg, pal, quad-pixel, virtue-engine)
104
+
105
+ Layer 5 (integration hub):
106
+ cs2-integration (9 deps -- aggregates all CS 2.0 packages)
107
+ ```
108
+
109
+ ---
110
+
111
+ ## SOLID Mapping
112
+
113
+ | Principle | CS 2.0 Application |
114
+ |-----------|---------------------|
115
+ | **S** Single Responsibility | BSP executes. Virtue governs. Structurally distinct. |
116
+ | **O** Open/Closed | HAIL grammars extended via DSL patches under governance, not code mods. |
117
+ | **L** Liskov | Lower Functions are interchangeable end-effectors under governance. |
118
+ | **I** Interface Segregation | PAL, Virtue Engine, RCCS, HAIL are independent services. |
119
+ | **D** Dependency Inversion | Executing layers depend on virtue abstractions, not concrete impls. Apps depend on `@regen/` packages, never on each other. |
120
+
121
+ ---
122
+
123
+ ## When Building Portal-Layer Apps
124
+
125
+ Even portal/UI work must reflect CS 2.0 architecture:
126
+
127
+ - **Data display** -- show through Quad Pixel awareness (velocity, not just magnitude)
128
+ - **Consequential actions** -- consult Virtue Engine before executing
129
+ - **UX rhythm** -- PAL's 90-second Moment Window
130
+ - **Memory/history** -- use AEMG (associative traversal, not chronological lists)
131
+ - **Governance/rules UI** -- reference HAIL grammar constructs
132
+
133
+ ---
134
+
135
+ ## Architecture Direction (Apr 8, 2026)
136
+
137
+ ### HAIL = AI Skill
138
+
139
+ HAIL is not a traditional compiler. It is an AI skill — Claude reads the grammar definition and generates code in the target format. The grammar evolves through genetic algorithms in the sandbox.
140
+
141
+ ### Ontology = Prebuilt Earth Shadow Tree
142
+
143
+ The planetary ontology is 85% pre-built from existing Earth system data (climate zones, watersheds, ecosystems, soil types). Not built from scratch — populated from authoritative datasets then extended per-project.
144
+
145
+ ### RCCS = 8-Layer Pipeline
146
+
147
+ The RCCS credit system has 8 processing layers:
148
+ 1. Instrumentation (sensors/data collection)
149
+ 2. Ingestion (normalize + validate)
150
+ 3. HAIL grammar application
151
+ 4. CalcProof (immutable delta-I computation)
152
+ 5. Verification (third-party audit)
153
+ 6. CUT Registry (credit issuance)
154
+ 7. NAV integration
155
+ 8. BPMN governance flows
156
+
157
+ Immutable delta-I is the core — every credit traces back to a verified change from baseline.
158
+
159
+ ### Contracts for Unnatural Systems
160
+
161
+ Systems operating outside natural boundaries (mining, heavy industry) get contracts that define remediation obligations, not credits.
162
+
163
+ ### Governance-Gated Expansion
164
+
165
+ New domains (health, education, urban) are added only through governance votes, not ad-hoc code additions. HAIL grammar proposals go through the virtue engine before activation.
166
+
167
+ ---
168
+
169
+ ## Reference Documents
170
+
171
+ | Document | Location |
172
+ |----------|----------|
173
+ | Complete Architecture v3 | `docs/source/LifeAI_CS20_Complete_Architecture_v3.docx` |
174
+ | Zoen Covenant | `docs/source/Zoen_Covenant_Complete_Draft.docx` |
175
+ | Master Spec | `docs/systems/cs2/cs2-master-spec.md` |
176
+ | Architecture | `docs/systems/cs2/ARCHITECTURE.md` |
177
+ | Package Map | `docs/systems/cs2/package-map.md` |
178
+ | Architecture Research | `docs/systems/cs2/architecture-research-apr8.md` |
179
+
180
+ ---
181
+
182
+ ## Specialist Context — Read These for Domain-Specific Tasks
183
+
184
+ | If your task involves... | Read this file first |
185
+ |--------------------------|----------------------|
186
+ | HAIL grammar compiler internals, DSL target formats | `packages/hail/CLAUDE.md` |
187
+ | PAL session lifecycle, MomentWindow, GraphMemory | `packages/pal/CLAUDE.md` |
188
+ | Virtue engine weights, coherence scoring, certification | `packages/virtue-engine/CLAUDE.md` |
189
+ | Quad Pixel primitive design, velocity/acceleration/certainty | `packages/quad-pixel/CLAUDE.md` |
190
+ | Full package dependency graph, integration layer | `docs/systems/cs2/ARCHITECTURE.md` |
package/guides/data.md ADDED
@@ -0,0 +1,123 @@
1
+ # Data Agent Guide — Base
2
+ > Role-based context for data, schema, and database agents. Generic patterns across projects.
3
+
4
+ ---
5
+
6
+ ## Database Instance
7
+
8
+ Check project overlay for:
9
+ - Database reference / instance identifier
10
+ - Available MCP servers and their capabilities
11
+ - RLS (Row-Level Security) status
12
+ - Schema organization
13
+
14
+ ---
15
+
16
+ ## Schema Organization
17
+
18
+ The project specifies schema structure. Check the overlay for:
19
+ - Public schema tables and purpose
20
+ - Additional named schemas (prt, rccs, etc.)
21
+ - Access patterns per schema
22
+ - RLS policies
23
+
24
+ Access non-public schemas with project-specific prefix:
25
+ ```ts
26
+ const { data } = await client.schema("schema-name").from("table").select("*");
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Domains and Data Organization
32
+
33
+ The project overlay specifies all domains:
34
+ - Marketing/CRM tables
35
+ - Analytics/intelligence tables
36
+ - Product-specific tables
37
+ - Operational/system tables
38
+ - Archive tables
39
+
40
+ Check the overlay for:
41
+ - Tables per domain
42
+ - Foreign key relationships
43
+ - Materialized views or special queries
44
+ - Upsert patterns
45
+
46
+ ---
47
+
48
+ ## Work Items / Task Management
49
+
50
+ The project specifies task management patterns:
51
+ - Whether to use RPC functions or raw SQL
52
+ - Valid status/priority/type enums
53
+ - Hierarchy rules (parent/child)
54
+ - Lifecycle patterns
55
+
56
+ Never create-then-close in one operation. Always follow project rules.
57
+
58
+ ---
59
+
60
+ ## Migration Patterns
61
+
62
+ The project overlay specifies:
63
+ - Where migration files live (format: numbered SQL files)
64
+ - How to apply migrations (tool or CLI)
65
+ - How to verify migrations
66
+ - Version control strategy
67
+
68
+ Always verify with a follow-up query after applying.
69
+
70
+ ---
71
+
72
+ ## RLS (Row-Level Security)
73
+
74
+ The project specifies:
75
+ - Which tables have RLS enabled
76
+ - Which operations require service role key
77
+ - Which operations work with anon key
78
+ - Special policies or edge cases
79
+
80
+ Never bypass RLS rules. If needed for tests, use service role carefully.
81
+
82
+ ---
83
+
84
+ ## Foreign Key Map
85
+
86
+ The project overlay provides:
87
+ - All foreign relationships
88
+ - Which are enforced vs informational
89
+ - Cascade behavior (if any)
90
+
91
+ Use this to prevent orphaned records and maintain consistency.
92
+
93
+ ---
94
+
95
+ ## Common Query Patterns
96
+
97
+ The project overlay provides:
98
+ - Standard SELECT patterns per domain
99
+ - JOIN patterns
100
+ - Aggregation patterns
101
+ - Window function patterns
102
+
103
+ Check examples before writing queries.
104
+
105
+ ---
106
+
107
+ ## Type Generation
108
+
109
+ The project specifies:
110
+ - Type generation tool (TypeScript generation, type stubs, etc.)
111
+ - How to refresh types after schema changes
112
+ - Where generated types live
113
+ - Import patterns
114
+
115
+ ---
116
+
117
+ ## Specialist Context — Read Project Overlay
118
+
119
+ Your task may require reading additional project-specific guides for:
120
+ - Full DB schema with all column types
121
+ - Deployment registry schema
122
+ - Brand token/design token tables
123
+ - Work item RPC functions