@rolexjs/core 1.5.0 → 1.6.1

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/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/structures.ts","../src/execution.ts","../src/cognition.ts","../src/organization.ts","../src/project.ts","../src/product.ts","../src/lifecycle.ts","../src/role-model.ts","../src/apply.ts","../src/commands/helpers.ts","../src/commands/issue.ts","../src/commands/position.ts","../src/commands/product.ts","../src/commands/project.ts","../src/commands/role.ts","../src/commands/society.ts","../src/commands/survey.ts","../src/commands/index.ts","../src/directives/index.ts","../src/instructions/def.ts","../src/instructions/issue.ts","../src/instructions/org.ts","../src/instructions/position.ts","../src/instructions/product.ts","../src/instructions/project.ts","../src/instructions/role.ts","../src/instructions/society.ts","../src/instructions/index.ts","../src/dispatch.ts","../src/find.ts","../src/descriptions/index.ts","../src/permissions/org-admin.ts","../src/permissions/product-owner.ts","../src/permissions/project-maintainer.ts","../src/permissions/registry.ts","../src/permissions/sovereign.ts","../src/projection.ts","../src/rolex-service.ts","../src/rpc.ts","../src/namespaces.ts","../src/tools.ts","../src/builder.ts","../src/renderer.ts"],"sourcesContent":["/**\n * @rolexjs/core — RoleX Concept World\n *\n * Domain-specific structures and processes built on @rolexjs/system.\n *\n * Structures — the concept tree (23 concepts, 3 relations)\n * Processes — how the world changes (32 processes, 5 layers)\n *\n * Layer 1: Execution — want, plan, todo, finish, complete, abandon\n * Layer 2: Cognition — reflect, realize, master\n * Layer 3: Organization — hire, fire, appoint, dismiss, charter, charge\n * Layer 3b: Project — enroll, remove, scope, milestone, deliver, wiki\n * Layer 4: Lifecycle — born, found, establish, launch, retire, die, dissolve, abolish, archive, rehire\n * + Role: activate\n */\n\n// Re-export system primitives\nexport {\n type Create,\n create,\n createRuntime,\n type GraphOp,\n type Link,\n link,\n type Process,\n process,\n type Relation,\n type Remove,\n type Runtime,\n relation,\n remove,\n type State,\n type Structure,\n structure,\n type Transform,\n transform,\n type Unlink,\n unlink,\n} from \"@rolexjs/system\";\n\n// Platform\nexport type {\n ContextData,\n Migration,\n MigrationRecord,\n Platform,\n PrototypeData,\n PrototypeRepository,\n RoleXRepository,\n} from \"./platform.js\";\n\n// ===== Structures =====\n\nexport {\n background,\n // Product\n channel,\n // Organization\n charter,\n comment,\n // Project\n deliverable,\n duty,\n // Individual — Cognition\n encounter,\n experience,\n // Individual — Execution\n goal,\n // Individual — Identity\n identity,\n // Level 1\n individual,\n // Issue\n issue,\n // Project\n milestone,\n // Individual — Knowledge\n mindset,\n organization,\n past,\n plan,\n position,\n principle,\n procedure,\n // Product\n product,\n // Project\n project,\n // Product\n release,\n // Organization — Position\n requirement,\n // Project\n scope,\n // Level 0\n society,\n // Product\n spec,\n strategy,\n task,\n tone,\n // Project\n wiki,\n} from \"./structures.js\";\n\n// ===== Processes — Layer 1: Execution =====\n\nexport { abandon, activate, complete, finish, planGoal, todo, want } from \"./execution.js\";\n\n// ===== Processes — Layer 2: Cognition =====\n\nexport { master, realize, reflect } from \"./cognition.js\";\n\n// ===== Processes — Layer 3: Organization =====\n\nexport { appoint, charge, charterOrg, dismiss, fire, hire } from \"./organization.js\";\n\n// ===== Processes — Layer 3b: Project =====\n\nexport {\n deliverProject,\n enroll,\n milestoneProject,\n produceProject,\n removeParticipant,\n scopeProject,\n wikiProject,\n} from \"./project.js\";\n\n// ===== Processes — Layer 3c: Product =====\n\nexport {\n channelProduct,\n disownProduct,\n ownProduct,\n releaseProduct,\n specProduct,\n strategyProduct,\n} from \"./product.js\";\n\n// ===== Processes — Layer 4: Lifecycle =====\n\nexport {\n abolish,\n archive,\n born,\n deprecate,\n die,\n dissolve,\n establish,\n found,\n launch,\n rehire,\n retire,\n} from \"./lifecycle.js\";\n\n// ===== Role Model =====\n\nexport type { RoleDeps, RoleSnapshot } from \"./role-model.js\";\nexport { Role } from \"./role-model.js\";\n\n// ===== RoleX Service =====\n\nexport type { RoleX } from \"./rolex-service.js\";\nexport { RoleXService } from \"./rolex-service.js\";\n\n// ===== JSON-RPC 2.0 =====\n\nexport type { JsonRpcError, JsonRpcRequest, JsonRpcResponse } from \"./rpc.js\";\nexport { RpcHandler } from \"./rpc.js\";\n\n// ===== Namespaces =====\n\nexport type {\n Caller,\n IndividualNamespace,\n IssueNamespace,\n OrgNamespace,\n PositionNamespace,\n ProductNamespace,\n ProjectNamespace,\n SocietyNamespace,\n} from \"./namespaces.js\";\n\n// ===== Builder =====\n\nexport type { BuilderConfig, RoleXBuilder, RoleXInternal } from \"./builder.js\";\nexport { createBuilder } from \"./builder.js\";\n\n// ===== Find =====\n\nexport { findInState } from \"./find.js\";\n\n// ===== Prototype (merged from @rolexjs/prototype) =====\n\n// Apply prototype\nexport type { ApplyResult } from \"./apply.js\";\nexport { applyPrototype } from \"./apply.js\";\n\n// Commands\nexport type {\n CommandContext,\n CommandResult,\n CommandResultMap,\n Commands,\n} from \"./commands/index.js\";\nexport { createCommands } from \"./commands/index.js\";\n\n// Descriptions\nexport { processes, world } from \"./descriptions/index.js\";\n\n// Directives\nexport { directives } from \"./directives/index.js\";\n\n// Dispatch\nexport { toArgs } from \"./dispatch.js\";\n\n// Instruction registry\nexport { instructions } from \"./instructions/index.js\";\n\n// Renderer framework\nexport type { Renderer } from \"./renderer.js\";\nexport { RendererRouter } from \"./renderer.js\";\n\n// Schema types\nexport type { ArgEntry, InstructionDef, ParamDef, ParamType, ToolDef } from \"./schema.js\";\n\n// Protocol — channel adapter contract\nexport type { Protocol } from \"./tools.js\";\nexport { protocol } from \"./tools.js\";\n","/**\n * RoleX Concept World — all structure definitions.\n *\n * Every node is a Structure — simultaneously concept, container,\n * and information carrier. Tree (parent-child) provides the\n * hierarchical backbone. Relations provide cross-branch links.\n *\n * ┌─────────────────────────────────────────────────────────┐\n * │ society │\n * │ ├── individual \"A single agent in society\" │\n * │ │ ├── identity \"Who I am\" │\n * │ │ │ ├── background \"My personal background\" │\n * │ │ │ ├── tone \"My tone of communication\" │\n * │ │ │ └── mindset \"How I think\" │\n * │ │ ├── encounter \"A specific event I went through\"│\n * │ │ ├── experience \"What I learned from encounters\" │\n * │ │ ├── principle \"My rules of conduct\" │\n * │ │ ├── procedure \"My skill references and metadata\"│\n * │ │ └── goal \"What I am pursuing\" │\n * │ │ └── plan \"How to achieve a goal\" │\n * │ │ └── task \"Concrete unit of work\" │\n * │ ├── organization \"A group of individuals\" │\n * │ │ │ ∿ membership → individual │\n * │ │ └── charter \"The rules and mission\" │\n * │ ├── position \"A role held by an individual\" │\n * │ │ │ ∿ appointment → individual │\n * │ │ └── duty \"Responsibilities of position\" │\n * │ ├── project \"A process container\" │\n * │ │ │ ∿ participation → individual │\n * │ │ │ ∿ ownership → organization │\n * │ │ │ ∿ production → product │\n * │ │ ├── scope \"Project boundary\" │\n * │ │ ├── milestone \"Key checkpoint\" │\n * │ │ ├── deliverable \"Project output\" │\n * │ │ └── wiki \"Project knowledge base\" │\n * │ ├── product \"A product with contracts\" │\n * │ │ │ ∿ ownership → individual │\n * │ │ │ ∿ origin → project │\n * │ │ ├── strategy \"Product strategy\" │\n * │ │ ├── spec \"Product behavior contract\" │\n * │ │ ├── release \"Product version release\" │\n * │ │ └── channel \"Product distribution channel\" │\n * │ └── past \"Things no longer active\" │\n * └─────────────────────────────────────────────────────────┘\n */\nimport { relation, structure } from \"@rolexjs/system\";\n\n// ================================================================\n// Level 0 — Root\n// ================================================================\n\nexport const society = structure(\"society\", \"The RoleX world\", null);\n\n// ================================================================\n// Level 1 — Four pillars\n// ================================================================\n\nexport const individual = structure(\"individual\", \"A single agent in society\", society);\nexport const organization = structure(\"organization\", \"A group of individuals\", society, [\n relation(\"membership\", \"Who belongs to this organization\", individual),\n]);\nexport const past = structure(\"past\", \"Things no longer active\", society);\n\n// ================================================================\n// Individual — Identity\n// ================================================================\n\nexport const identity = structure(\"identity\", \"Who I am\", individual);\nexport const background = structure(\"background\", \"My personal background\", identity);\nexport const tone = structure(\"tone\", \"My tone of communication\", identity);\nexport const mindset = structure(\"mindset\", \"How I think and approach problems\", identity);\n\n// ================================================================\n// Individual — Cognition\n// ================================================================\n\nexport const encounter = structure(\"encounter\", \"A specific event I went through\", individual);\nexport const experience = structure(\"experience\", \"What I learned from encounters\", individual);\n\n// ================================================================\n// Individual — Knowledge\n// ================================================================\n\nexport const principle = structure(\"principle\", \"My rules of conduct\", individual);\nexport const procedure = structure(\"procedure\", \"My skill references and metadata\", individual);\n\n// ================================================================\n// Individual — Execution\n// ================================================================\n\nexport const goal = structure(\"goal\", \"What I am pursuing\", individual);\nexport const plan = structure(\"plan\", \"How to achieve a goal\", goal);\nexport const task = structure(\"task\", \"Concrete unit of work\", plan);\n\n// ================================================================\n// Organization\n// ================================================================\n\nexport const charter = structure(\"charter\", \"The rules and mission\", organization);\n\n// ================================================================\n// Position — independent entity\n// ================================================================\n\nexport const position = structure(\"position\", \"A role held by an individual\", society, [\n relation(\"appointment\", \"Who holds this position\", individual),\n]);\nexport const duty = structure(\"duty\", \"Responsibilities of this position\", position);\nexport const requirement = structure(\"requirement\", \"Required skill for this position\", position);\n\n// ================================================================\n// Project — process management entity\n// ================================================================\n\nexport const project = structure(\"project\", \"A process container for organized work\", society, [\n relation(\"participation\", \"Who participates in this project\", individual),\n relation(\"ownership\", \"Which organization owns this project\", organization),\n // production → product is a forward declaration; product is defined below\n]);\nexport const scope = structure(\n \"scope\",\n \"Project boundary — what to do and what not to do\",\n project\n);\nexport const milestone = structure(\n \"milestone\",\n \"Key checkpoint with achievement criteria\",\n project\n);\nexport const deliverable = structure(\"deliverable\", \"Project output and delivery\", project);\nexport const wiki = structure(\"wiki\", \"Project-level knowledge base entry\", project);\n\n// ================================================================\n// Product — product management entity\n// ================================================================\n\nexport const product = structure(\n \"product\",\n \"A product with vision, contracts, and releases\",\n society,\n [\n relation(\"ownership\", \"Who owns this product\", individual),\n relation(\"origin\", \"Which project produced this product\", project),\n ]\n);\nexport const strategy = structure(\"strategy\", \"Product strategy — how to win\", product);\nexport const spec = structure(\"spec\", \"Product behavior contract — BDD specification\", product);\nexport const release = structure(\"release\", \"Product version release\", product);\nexport const channel = structure(\"channel\", \"Product distribution channel\", product);\n\n// ================================================================\n// Issue — collaboration primitive\n// ================================================================\n\nexport const issue = structure(\"issue\", \"A collaboration topic requiring attention\", society, [\n relation(\"authored-by\", \"Who created this issue\", individual),\n relation(\"assigned-to\", \"Who is responsible for this issue\", individual),\n]);\nexport const comment = structure(\"comment\", \"A discussion entry on an issue\", issue, [\n relation(\"authored-by\", \"Who wrote this comment\", individual),\n]);\n","/**\n * Execution cycle — the doing loop.\n *\n * want → plan → todo → finish → (encounter) → want → ...\n * plan → complete → (encounter)\n * plan → abandon → (encounter)\n *\n * Goals are long-term directions. Plans are the completable unit —\n * they can be completed or abandoned. Tasks finish individually.\n * All transforms produce encounters — feeding the cognition cycle.\n */\nimport { create, process, transform } from \"@rolexjs/system\";\nimport { encounter, goal, individual, plan, task } from \"./structures.js\";\n\n// Role activation — load cognition into context\nexport const activate = process(\n \"activate\",\n \"Activate a role — load cognition into context\",\n individual\n);\n\nexport const want = process(\"want\", \"Declare a goal\", individual, create(goal));\nexport const planGoal = process(\"plan\", \"Create a plan for a goal\", goal, create(plan));\nexport const todo = process(\"todo\", \"Create a task in a plan\", plan, create(task));\n\nexport const finish = process(\n \"finish\",\n \"Complete a task, record as encounter\",\n task,\n transform(task, encounter)\n);\nexport const complete = process(\n \"complete\",\n \"Complete a plan, record as encounter\",\n plan,\n transform(plan, encounter)\n);\nexport const abandon = process(\n \"abandon\",\n \"Abandon a plan, record as encounter\",\n plan,\n transform(plan, encounter)\n);\n","/**\n * Cognition cycle — the learning loop.\n *\n * encounter → reflect → experience → realize → principle\n * → master → procedure\n *\n * Encounters are raw events (produced by the execution cycle).\n * Reflection distills them into experience. From experience,\n * principles are realized and procedures are mastered.\n */\nimport { process, transform } from \"@rolexjs/system\";\nimport { encounter, experience, principle, procedure } from \"./structures.js\";\n\nexport const reflect = process(\n \"reflect\",\n \"Reflect on encounters, distill into experience\",\n encounter,\n transform(encounter, experience)\n);\nexport const realize = process(\n \"realize\",\n \"Realize a principle from experience\",\n experience,\n transform(experience, principle)\n);\nexport const master = process(\n \"master\",\n \"Master a procedure from experience\",\n experience,\n transform(experience, procedure)\n);\n","/**\n * Organization management — hiring, firing, and structuring.\n *\n * hire / fire — membership (who belongs)\n * appoint / dismiss — appointment (who holds a position)\n * charter — define org rules and mission\n * charge — add duties to a position\n */\nimport { create, link, process, unlink } from \"@rolexjs/system\";\nimport { charter, duty, organization, position } from \"./structures.js\";\n\n// Membership\nexport const hire = process(\n \"hire\",\n \"Hire an individual into the organization\",\n organization,\n link(organization, \"membership\")\n);\nexport const fire = process(\n \"fire\",\n \"Fire an individual from the organization\",\n organization,\n unlink(organization, \"membership\")\n);\n\n// Appointment\nexport const appoint = process(\n \"appoint\",\n \"Appoint a member to a position\",\n position,\n link(position, \"appointment\")\n);\nexport const dismiss = process(\n \"dismiss\",\n \"Dismiss from a position\",\n position,\n unlink(position, \"appointment\")\n);\n\n// Structure\nexport const charterOrg = process(\n \"charter\",\n \"Define the charter for an organization\",\n organization,\n create(charter)\n);\nexport const charge = process(\"charge\", \"Add a duty to a position\", position, create(duty));\n","/**\n * Project management — scoping, milestones, enrollment, deliverables, wiki.\n *\n * enroll / remove — participation (who is involved)\n * scope — define project boundary\n * milestone — add checkpoint\n * deliver — add deliverable\n * wiki — add knowledge entry\n */\nimport { create, link, process, unlink } from \"@rolexjs/system\";\nimport { deliverable, milestone, product, project, scope, wiki } from \"./structures.js\";\n\n// Participation\nexport const enroll = process(\n \"enroll\",\n \"Enroll an individual into the project\",\n project,\n link(project, \"participation\")\n);\nexport const removeParticipant = process(\n \"remove\",\n \"Remove an individual from the project\",\n project,\n unlink(project, \"participation\")\n);\n\n// Structure\nexport const scopeProject = process(\n \"scope\",\n \"Define the scope for a project\",\n project,\n create(scope)\n);\nexport const milestoneProject = process(\n \"milestone\",\n \"Add a milestone to a project\",\n project,\n create(milestone)\n);\nexport const deliverProject = process(\n \"deliver\",\n \"Add a deliverable to a project\",\n project,\n create(deliverable)\n);\nexport const wikiProject = process(\"wiki\", \"Add a wiki entry to a project\", project, create(wiki));\n\n// Production — project produces product\nexport const produceProject = process(\n \"produce\",\n \"Produce a product from this project\",\n project,\n create(product)\n);\n","/**\n * Product management — strategy, specs, releases, channels, ownership.\n *\n * own / disown — ownership (who is responsible)\n * strategy — define product strategy\n * spec — add behavior contract (BDD specification)\n * release — add version release\n * channel — add distribution channel\n */\nimport { create, link, process, unlink } from \"@rolexjs/system\";\nimport { channel, product, release, spec, strategy } from \"./structures.js\";\n\n// Ownership\nexport const ownProduct = process(\n \"own\",\n \"Assign an owner to the product\",\n product,\n link(product, \"ownership\")\n);\nexport const disownProduct = process(\n \"disown\",\n \"Remove an owner from the product\",\n product,\n unlink(product, \"ownership\")\n);\n\n// Structure\nexport const strategyProduct = process(\n \"strategy\",\n \"Define the strategy for a product\",\n product,\n create(strategy)\n);\nexport const specProduct = process(\n \"spec\",\n \"Add a behavior contract to a product\",\n product,\n create(spec)\n);\nexport const releaseProduct = process(\n \"release\",\n \"Add a version release to a product\",\n product,\n create(release)\n);\nexport const channelProduct = process(\n \"channel\",\n \"Add a distribution channel to a product\",\n product,\n create(channel)\n);\n","/**\n * Lifecycle — creation, retirement, and dissolution.\n *\n * born / found / establish — bring things into existence\n * retire / die — individual → past\n * dissolve — organization → past\n * abolish — position → past\n * rehire — past → individual (return from retirement)\n *\n * No real deletion — everything transforms to the \"past\" branch.\n */\nimport { create, process, transform } from \"@rolexjs/system\";\nimport {\n individual,\n organization,\n past,\n position,\n product,\n project,\n society,\n} from \"./structures.js\";\n\n// Creation\nexport const born = process(\n \"born\",\n \"An individual is born into society\",\n society,\n create(individual)\n);\nexport const found = process(\"found\", \"Found an organization\", society, create(organization));\nexport const establish = process(\"establish\", \"Establish a position\", society, create(position));\nexport const launch = process(\"launch\", \"Launch a project\", society, create(project));\n\n// Retirement & death\nexport const retire = process(\n \"retire\",\n \"Retire an individual\",\n individual,\n transform(individual, past)\n);\nexport const die = process(\"die\", \"An individual dies\", individual, transform(individual, past));\n\n// Archive project\nexport const archive = process(\"archive\", \"Archive a project\", project, transform(project, past));\n\n// Deprecate product\nexport const deprecate = process(\n \"deprecate\",\n \"Deprecate a product\",\n product,\n transform(product, past)\n);\n\n// Dissolution\nexport const dissolve = process(\n \"dissolve\",\n \"Dissolve an organization\",\n organization,\n transform(organization, past)\n);\nexport const abolish = process(\n \"abolish\",\n \"Abolish a position\",\n position,\n transform(position, past)\n);\n\n// Return\nexport const rehire = process(\n \"rehire\",\n \"Rehire a retired individual\",\n past,\n transform(past, individual)\n);\n","/**\n * Role — rich domain model (充血模型) for an individual.\n *\n * Role is a self-contained operation domain that holds:\n * - State projection (read cache from graph)\n * - Cursors (focusedGoalId, focusedPlanId)\n * - Cognitive registries (encounters, experiences)\n * - Domain behaviors (focus, want, plan, todo, finish, etc.)\n *\n * Design:\n * - Role = Actor State, RoleX = ActorSystem\n * - Ownership validation: hasNode() ensures isolation\n * - KV-serializable: snapshot() / restore()\n * - Single instance per individual\n */\n\nimport type { State } from \"@rolexjs/system\";\nimport type { CommandResult, Commands } from \"./commands/index.js\";\nimport type { Renderer } from \"./renderer.js\";\n\n// ================================================================\n// Snapshot — KV-serializable state\n// ================================================================\n\n/** Serializable role state for KV persistence. */\nexport interface RoleSnapshot {\n id: string;\n focusedGoalId: string | null;\n focusedPlanId: string | null;\n encounterIds: string[];\n experienceIds: string[];\n}\n\n// ================================================================\n// RoleDeps — injected runtime dependencies (internal, not public)\n// ================================================================\n\n/** Internal dependencies injected by RoleX at activate time. */\nexport interface RoleDeps {\n commands: Commands;\n renderer: Renderer;\n onSave(snapshot: RoleSnapshot): void | Promise<void>;\n}\n\n// ================================================================\n// Role — rich domain model\n// ================================================================\n\nexport class Role {\n readonly id: string;\n\n private focusedGoalId: string | null = null;\n private focusedPlanId: string | null = null;\n private readonly encounterIds = new Set<string>();\n private readonly experienceIds = new Set<string>();\n\n /** Set of all node ids under this individual — for ownership validation. */\n private readonly nodeIds = new Set<string>();\n\n private deps: RoleDeps;\n\n constructor(id: string, deps: RoleDeps) {\n this.id = id;\n this.deps = deps;\n }\n\n // ================================================================\n // State projection — populated at activate time\n // ================================================================\n\n /** Populate from state projection. Builds nodeIds set + cognitive registries. */\n hydrate(state: State): void {\n this.nodeIds.clear();\n this.encounterIds.clear();\n this.experienceIds.clear();\n this.focusedGoalId = null;\n this.walkState(state);\n }\n\n private walkState(node: State): void {\n if (node.id) {\n this.nodeIds.add(node.id);\n switch (node.name) {\n case \"goal\":\n if (!this.focusedGoalId) this.focusedGoalId = node.id;\n break;\n case \"encounter\":\n this.encounterIds.add(node.id);\n break;\n case \"experience\":\n this.experienceIds.add(node.id);\n break;\n }\n }\n for (const child of node.children ?? []) {\n this.walkState(child);\n }\n }\n\n // ================================================================\n // Ownership validation\n // ================================================================\n\n private hasNode(id: string): boolean {\n return this.nodeIds.has(id);\n }\n\n private requireOwnership(id: string, label: string): void {\n if (!this.hasNode(id)) {\n throw new Error(`${label} \"${id}\" does not belong to individual \"${this.id}\".`);\n }\n }\n\n // ================================================================\n // Cursor requirements\n // ================================================================\n\n private requireGoalId(): string {\n if (!this.focusedGoalId) throw new Error(\"No focused goal. Call want first.\");\n return this.focusedGoalId;\n }\n\n private requirePlanId(): string {\n if (!this.focusedPlanId) throw new Error(\"No focused plan. Call plan first.\");\n return this.focusedPlanId;\n }\n\n // ================================================================\n // Rendering\n // ================================================================\n\n private fmt(command: string, result: CommandResult): string {\n const rendered = this.deps.renderer.render(command, result);\n const process = command.includes(\".\") ? command.slice(command.indexOf(\".\") + 1) : command;\n const ch = this.cognitiveHint(process);\n if (!ch) return rendered;\n const lines = rendered.split(\"\\n\");\n lines.splice(2, 0, `I → ${ch}`);\n return lines.join(\"\\n\");\n }\n\n // ================================================================\n // Persistence\n // ================================================================\n\n private async save(): Promise<void> {\n await this.deps.onSave(this.snapshot());\n }\n\n /** Serialize to KV-compatible snapshot. */\n snapshot(): RoleSnapshot {\n return {\n id: this.id,\n focusedGoalId: this.focusedGoalId,\n focusedPlanId: this.focusedPlanId,\n encounterIds: [...this.encounterIds],\n experienceIds: [...this.experienceIds],\n };\n }\n\n /** Restore cursors and cognitive state from a snapshot. */\n restore(snap: RoleSnapshot): void {\n this.focusedGoalId = snap.focusedGoalId;\n this.focusedPlanId = snap.focusedPlanId;\n this.encounterIds.clear();\n for (const id of snap.encounterIds) this.encounterIds.add(id);\n this.experienceIds.clear();\n for (const id of snap.experienceIds) this.experienceIds.add(id);\n }\n\n // ================================================================\n // Execution — focus, want, plan, todo, finish, complete, abandon\n // ================================================================\n\n /** Project the individual's state tree (used after activate). */\n async project(): Promise<string> {\n const result = await this.deps.commands[\"role.focus\"](this.id);\n return this.fmt(\"role.activate\", result);\n }\n\n /** Focus: view or switch focused goal. Validates ownership. */\n async focus(goal?: string): Promise<string> {\n const goalId = goal ?? this.requireGoalId();\n if (goal) {\n this.requireOwnership(goalId, \"Goal\");\n }\n const result = await this.deps.commands[\"role.focus\"](goalId);\n if (result.state.name !== \"goal\") {\n throw new Error(\n `\"${goalId}\" is a ${result.state.name}, not a goal. focus only accepts goal ids.`\n );\n }\n const switched = goalId !== this.focusedGoalId;\n this.focusedGoalId = goalId;\n if (switched) this.focusedPlanId = null;\n await this.save();\n return this.fmt(\"role.focus\", result);\n }\n\n /** Want: declare a goal under this individual. */\n async want(goal?: string, id?: string, alias?: readonly string[]): Promise<string> {\n const result = await this.deps.commands[\"role.want\"](this.id, goal, id, alias);\n const newId = id ?? result.state.id;\n if (newId) {\n this.nodeIds.add(newId);\n this.focusedGoalId = newId;\n }\n this.focusedPlanId = null;\n await this.save();\n return this.fmt(\"role.want\", result);\n }\n\n /** Plan: create a plan for the focused goal. */\n async plan(plan?: string, id?: string, after?: string, fallback?: string): Promise<string> {\n const result = await this.deps.commands[\"role.plan\"](\n this.requireGoalId(),\n plan,\n id,\n after,\n fallback\n );\n const newId = id ?? result.state.id;\n if (newId) {\n this.nodeIds.add(newId);\n this.focusedPlanId = newId;\n }\n await this.save();\n return this.fmt(\"role.plan\", result);\n }\n\n /** Todo: add a task to the focused plan. */\n async todo(task?: string, id?: string, alias?: readonly string[]): Promise<string> {\n const result = await this.deps.commands[\"role.todo\"](this.requirePlanId(), task, id, alias);\n const newId = id ?? result.state.id;\n if (newId) this.nodeIds.add(newId);\n return this.fmt(\"role.todo\", result);\n }\n\n /** Finish: complete a task, optionally record an encounter. */\n async finish(task: string, encounter?: string): Promise<string> {\n this.requireOwnership(task, \"Task\");\n const result = await this.deps.commands[\"role.finish\"](task, this.id, encounter);\n if (encounter && result.state.id) {\n this.encounterIds.add(result.state.id);\n this.nodeIds.add(result.state.id);\n }\n return this.fmt(\"role.finish\", result);\n }\n\n /** Complete: close a plan as done, record encounter. */\n async complete(plan?: string, encounter?: string): Promise<string> {\n const planId = plan ?? this.requirePlanId();\n this.requireOwnership(planId, \"Plan\");\n const result = await this.deps.commands[\"role.complete\"](planId, this.id, encounter);\n const encId = result.state.id ?? planId;\n this.encounterIds.add(encId);\n this.nodeIds.add(encId);\n if (this.focusedPlanId === planId) this.focusedPlanId = null;\n await this.save();\n return this.fmt(\"role.complete\", result);\n }\n\n /** Abandon: drop a plan, record encounter. */\n async abandon(plan?: string, encounter?: string): Promise<string> {\n const planId = plan ?? this.requirePlanId();\n this.requireOwnership(planId, \"Plan\");\n const result = await this.deps.commands[\"role.abandon\"](planId, this.id, encounter);\n const encId = result.state.id ?? planId;\n this.encounterIds.add(encId);\n this.nodeIds.add(encId);\n if (this.focusedPlanId === planId) this.focusedPlanId = null;\n await this.save();\n return this.fmt(\"role.abandon\", result);\n }\n\n // ================================================================\n // Cognition — reflect, realize, master\n // ================================================================\n\n /** Reflect: consume encounters → experience. */\n async reflect(encounters: string[], experience?: string, id?: string): Promise<string> {\n if (encounters.length > 0) {\n for (const enc of encounters) {\n if (!this.encounterIds.has(enc)) throw new Error(`Encounter not found: \"${enc}\"`);\n }\n }\n const first = encounters[0] as string | undefined;\n const result = await this.deps.commands[\"role.reflect\"](first, this.id, experience, id);\n for (let i = 1; i < encounters.length; i++) {\n await this.deps.commands[\"role.forget\"](encounters[i]);\n }\n if (encounters.length > 0) {\n for (const enc of encounters) this.encounterIds.delete(enc);\n }\n const newId = id ?? result.state.id;\n if (newId) {\n this.experienceIds.add(newId);\n this.nodeIds.add(newId);\n }\n return this.fmt(\"role.reflect\", result);\n }\n\n /** Realize: consume experiences → principle. */\n async realize(experiences: string[], principle?: string, id?: string): Promise<string> {\n if (experiences.length > 0) {\n for (const exp of experiences) {\n if (!this.experienceIds.has(exp)) throw new Error(`Experience not found: \"${exp}\"`);\n }\n }\n const first = experiences[0] as string | undefined;\n const result = await this.deps.commands[\"role.realize\"](first, this.id, principle, id);\n for (let i = 1; i < experiences.length; i++) {\n await this.deps.commands[\"role.forget\"](experiences[i]);\n }\n if (experiences.length > 0) {\n for (const exp of experiences) this.experienceIds.delete(exp);\n }\n const newId = id ?? result.state.id;\n if (newId) this.nodeIds.add(newId);\n return this.fmt(\"role.realize\", result);\n }\n\n /** Master: create procedure, optionally consuming experiences. */\n async master(procedure: string, id?: string, experiences?: string[]): Promise<string> {\n if (experiences && experiences.length > 0) {\n for (const exp of experiences) {\n if (!this.experienceIds.has(exp)) throw new Error(`Experience not found: \"${exp}\"`);\n }\n }\n const first = experiences?.[0];\n const result = await this.deps.commands[\"role.master\"](this.id, procedure, id, first);\n if (experiences) {\n for (let i = 1; i < experiences.length; i++) {\n await this.deps.commands[\"role.forget\"](experiences[i]);\n }\n for (const exp of experiences) this.experienceIds.delete(exp);\n }\n const newId = id ?? result.state.id;\n if (newId) this.nodeIds.add(newId);\n return this.fmt(\"role.master\", result);\n }\n\n // ================================================================\n // Knowledge management\n // ================================================================\n\n /** Forget: remove any node under this individual by id. */\n async forget(nodeId: string): Promise<string> {\n this.requireOwnership(nodeId, \"Node\");\n const result = await this.deps.commands[\"role.forget\"](nodeId);\n this.nodeIds.delete(nodeId);\n if (this.focusedGoalId === nodeId) this.focusedGoalId = null;\n if (this.focusedPlanId === nodeId) this.focusedPlanId = null;\n this.encounterIds.delete(nodeId);\n this.experienceIds.delete(nodeId);\n await this.save();\n return this.fmt(\"role.forget\", result);\n }\n\n // ================================================================\n // Cognitive hints\n // ================================================================\n\n private cognitiveHint(process: string): string | null {\n switch (process) {\n case \"activate\":\n if (!this.focusedGoalId)\n return \"I have no goal yet. I should call `want` to declare one, or `focus` to review existing goals.\";\n return \"I have an active goal. I should call `focus` to review progress, or `want` to declare a new goal.\";\n\n case \"focus\":\n if (!this.focusedPlanId)\n return \"I have a goal but no focused plan. I should call `plan` to create or focus on one.\";\n return \"I have a plan. I should call `todo` to create tasks, or continue working.\";\n\n case \"want\":\n return \"Goal declared. I should call `plan` to design how to achieve it.\";\n\n case \"plan\":\n return \"Plan created. I should call `todo` to create concrete tasks.\";\n\n case \"todo\":\n return \"Task created. I can add more with `todo`, or start working and call `finish` when done.\";\n\n case \"finish\": {\n const encCount = this.encounterIds.size;\n if (encCount > 0 && !this.focusedGoalId)\n return `Task finished. No more goals — I have ${encCount} encounter(s) to choose from for \\`reflect\\`, or \\`want\\` a new goal.`;\n return \"Task finished. I should continue with remaining tasks, or call `complete` when the plan is done.\";\n }\n\n case \"complete\":\n case \"abandon\": {\n const encCount = this.encounterIds.size;\n const goalNote = this.focusedGoalId\n ? ` I should check if goal \"${this.focusedGoalId}\" needs a new \\`plan\\`, or \\`forget\\` it if the direction is fulfilled.`\n : \"\";\n if (encCount > 0)\n return `Plan closed.${goalNote} I have ${encCount} encounter(s) to choose from for \\`reflect\\`, or I can continue with other plans.`;\n return `Plan closed.${goalNote} I can create a new \\`plan\\`, or \\`focus\\` on another goal.`;\n }\n\n case \"reflect\": {\n const expCount = this.experienceIds.size;\n if (expCount > 0)\n return `Experience gained. I can \\`realize\\` principles or \\`master\\` procedures — ${expCount} experience(s) available.`;\n return \"Experience gained. I can `realize` a principle, `master` a procedure, or continue working.\";\n }\n\n case \"realize\":\n return \"Principle added. I should continue working.\";\n\n case \"master\":\n return \"Procedure added. I should continue working.\";\n\n default:\n return null;\n }\n }\n}\n","/**\n * applyPrototype — apply a prototype's migrations incrementally.\n *\n * Pure function: receives data + storage + executor, no framework coupling.\n * Checks migration history, executes only unapplied migrations, records each.\n */\n\nimport type { PrototypeData, PrototypeRepository } from \"./platform.js\";\n\n/** Result of applying a prototype. */\nexport interface ApplyResult {\n prototypeId: string;\n applied: number;\n skipped: number;\n upToDate: boolean;\n}\n\n/**\n * Apply a prototype — execute unapplied migrations in version order.\n *\n * @param data - The prototype data structure with migrations\n * @param repo - Storage layer for migration history\n * @param direct - Executor for prototype instructions\n */\nexport async function applyPrototype(\n data: PrototypeData,\n repo: PrototypeRepository,\n direct: (op: string, args: Record<string, unknown>) => Promise<unknown>\n): Promise<ApplyResult> {\n const sorted = [...data.migrations].sort((a, b) => a.version - b.version);\n let applied = 0;\n let skipped = 0;\n\n for (const migration of sorted) {\n if (await repo.hasMigration(data.id, migration.id)) {\n skipped++;\n continue;\n }\n\n for (const instr of migration.instructions) {\n await direct(instr.op, instr.args);\n }\n await repo.recordMigration(data.id, migration.id, migration.version, migration.checksum);\n applied++;\n }\n\n await repo.settle(data.id, data.source);\n\n return {\n prototypeId: data.id,\n applied,\n skipped,\n upToDate: applied === 0,\n };\n}\n","/**\n * Commands — shared helpers used across all command sub-modules.\n */\n\nimport { parse } from \"@rolexjs/parser\";\nimport type { State, Structure } from \"@rolexjs/system\";\nimport { structure } from \"@rolexjs/system\";\nimport * as C from \"../structures.js\";\nimport type { CommandContext, CommandResult } from \"./types.js\";\n\n// ================================================================\n// Helpers interface\n// ================================================================\n\nexport interface Helpers {\n ok(node: Structure, process: string): Promise<CommandResult>;\n archive(node: Structure, process: string): Promise<CommandResult>;\n validateGherkin(source?: string): void;\n removeExisting(parent: Structure, id: string): Promise<void>;\n}\n\n// ================================================================\n// Scoped search\n// ================================================================\n\n/** Scoped search within a subtree. No priority needed — used only by removeExisting. */\nfunction findInState(state: State, target: string): Structure | null {\n if (state.id && state.id.toLowerCase() === target) return state;\n if (state.alias) {\n for (const a of state.alias) {\n if (a.toLowerCase() === target) return state;\n }\n }\n for (const child of state.children ?? []) {\n const found = findInState(child, target);\n if (found) return found;\n }\n return null;\n}\n\n// ================================================================\n// Factory\n// ================================================================\n\nexport function createHelpers(ctx: CommandContext): Helpers {\n const { rt, project } = ctx;\n\n async function ok(node: Structure, process: string): Promise<CommandResult> {\n return { state: await project(node), process };\n }\n\n async function archive(node: Structure, process: string): Promise<CommandResult> {\n // Move the node into the past container, keeping its original name\n const target = structure(node.name, node.description ?? \"\", C.past);\n const archived = await rt.transform(node, target);\n return ok(archived, process);\n }\n\n function validateGherkin(source?: string): void {\n if (!source) return;\n try {\n parse(source);\n } catch (e: any) {\n throw new Error(`Invalid Gherkin: ${e.message}`);\n }\n }\n\n async function removeExisting(parent: Structure, id: string): Promise<void> {\n const state = await rt.project(parent);\n const existing = findInState(state, id);\n if (existing) await rt.remove(existing);\n }\n\n return { ok, archive, validateGherkin, removeExisting };\n}\n","/**\n * Commands — issue.* commands.\n *\n * Issues are graph nodes under society, with comments as child nodes.\n * Status is expressed via tags (#open / #closed).\n * Author and assignee are links to individual nodes.\n */\n\nimport type { State, Structure } from \"@rolexjs/system\";\nimport * as C from \"../structures.js\";\nimport type { Helpers } from \"./helpers.js\";\nimport type { CommandContext, CommandResult } from \"./types.js\";\n\n// ================================================================\n// Issue number counter\n// ================================================================\n\n/** Track the next issue number per runtime instance. */\nlet nextIssueNumber = 0;\n\n/** Scan existing issues to find the max number. */\nfunction initCounter(children: readonly State[]): void {\n let max = 0;\n for (const child of children) {\n if (child.name === \"issue\" && child.id) {\n const match = child.id.match(/^issue-(\\d+)$/);\n if (match) {\n const n = parseInt(match[1], 10);\n if (n > max) max = n;\n }\n }\n }\n nextIssueNumber = max;\n}\n\nfunction allocateNumber(): number {\n return ++nextIssueNumber;\n}\n\n// ================================================================\n// Issue commands\n// ================================================================\n\nexport function issueCommands(\n ctx: CommandContext,\n helpers: Helpers\n): Record<string, (...args: any[]) => any> {\n const { rt, society, resolve, project } = ctx;\n const { ok } = helpers;\n\n // Lazy-init counter on first issue command\n let counterInitialized = false;\n async function ensureCounter(): Promise<void> {\n if (counterInitialized) return;\n const state = await rt.project(society);\n initCounter(state.children ?? []);\n counterInitialized = true;\n }\n\n /** Find an issue node by number (issue-{N} id pattern). */\n async function findIssue(number: number): Promise<Structure> {\n const id = `issue-${number}`;\n const node = await resolve(id);\n return node;\n }\n\n return {\n async \"issue.publish\"(\n title: string,\n body: string,\n author: string,\n assignee?: string\n ): Promise<CommandResult> {\n await ensureCounter();\n const number = allocateNumber();\n const id = `issue-${number}`;\n const node = await rt.create(society, C.issue, body, id, [title]);\n await rt.addTag(node, \"open\");\n\n // Link author\n const authorNode = await resolve(author);\n await rt.link(node, authorNode, \"authored-by\", \"author-of\");\n\n // Link assignee if provided\n if (assignee) {\n const assigneeNode = await resolve(assignee);\n await rt.link(node, assigneeNode, \"assigned-to\", \"assigned\");\n }\n\n return ok(node, \"publish\");\n },\n\n async \"issue.get\"(number: number): Promise<CommandResult> {\n const node = await findIssue(number);\n return ok(node, \"get\");\n },\n\n async \"issue.list\"(\n status?: string,\n _author?: string,\n _assignee?: string,\n _label?: string\n ): Promise<CommandResult> {\n const state = await project(society);\n const issues = (state.children ?? []).filter((c) => {\n if (c.name !== \"issue\") return false;\n if (status && !c.tags?.includes(status)) return false;\n return true;\n });\n return {\n state: { ...state, children: issues },\n process: \"list\",\n };\n },\n\n async \"issue.update\"(\n number: number,\n title?: string,\n body?: string,\n assignee?: string\n ): Promise<CommandResult> {\n const node = await findIssue(number);\n\n // Update title (alias) and body (information) by removing and recreating\n // For now, we update via transform if needed\n if (body !== undefined || title !== undefined) {\n // We need to work with what the runtime provides\n // Transform preserves subtree but updates information\n const target = C.issue;\n if (body !== undefined) {\n await rt.transform(node, target, body);\n }\n }\n\n if (assignee !== undefined) {\n // Unlink existing assignee, link new one\n const state = await rt.project(node);\n const existingAssignee = state.links?.find((l) => l.relation === \"assigned-to\");\n if (existingAssignee) {\n await rt.unlink(node, existingAssignee.target, \"assigned-to\", \"assigned\");\n }\n if (assignee) {\n const assigneeNode = await resolve(assignee);\n await rt.link(node, assigneeNode, \"assigned-to\", \"assigned\");\n }\n }\n\n return ok(node, \"update\");\n },\n\n async \"issue.close\"(number: number): Promise<CommandResult> {\n const node = await findIssue(number);\n await rt.removeTag(node, \"open\");\n await rt.addTag(node, \"closed\");\n return ok(node, \"close\");\n },\n\n async \"issue.reopen\"(number: number): Promise<CommandResult> {\n const node = await findIssue(number);\n await rt.removeTag(node, \"closed\");\n await rt.addTag(node, \"open\");\n return ok(node, \"reopen\");\n },\n\n async \"issue.assign\"(number: number, assignee: string): Promise<CommandResult> {\n const node = await findIssue(number);\n\n // Unlink existing assignee\n const state = await rt.project(node);\n const existingAssignee = state.links?.find((l) => l.relation === \"assigned-to\");\n if (existingAssignee) {\n await rt.unlink(node, existingAssignee.target, \"assigned-to\", \"assigned\");\n }\n\n // Link new assignee\n const assigneeNode = await resolve(assignee);\n await rt.link(node, assigneeNode, \"assigned-to\", \"assigned\");\n\n return ok(node, \"assign\");\n },\n\n async \"issue.comment\"(number: number, body: string, author: string): Promise<CommandResult> {\n const issueNode = await findIssue(number);\n const commentNode = await rt.create(issueNode, C.comment, body);\n\n // Link comment author\n const authorNode = await resolve(author);\n await rt.link(commentNode, authorNode, \"authored-by\", \"author-of\");\n\n return ok(commentNode, \"comment\");\n },\n\n async \"issue.comments\"(number: number): Promise<CommandResult> {\n const issueNode = await findIssue(number);\n const state = await project(issueNode);\n const comments = (state.children ?? []).filter((c) => c.name === \"comment\");\n return {\n state: { ...state, children: comments },\n process: \"comments\",\n };\n },\n\n async \"issue.label\"(number: number, label: string): Promise<CommandResult> {\n const node = await findIssue(number);\n await rt.addTag(node, label);\n return ok(node, \"label\");\n },\n\n async \"issue.unlabel\"(number: number, label: string): Promise<CommandResult> {\n const node = await findIssue(number);\n await rt.removeTag(node, label);\n return ok(node, \"unlabel\");\n },\n };\n}\n","/**\n * Commands — position.* commands.\n */\n\nimport * as C from \"../structures.js\";\nimport type { Helpers } from \"./helpers.js\";\nimport type { CommandContext, CommandResult } from \"./types.js\";\n\nexport function positionCommands(\n ctx: CommandContext,\n helpers: Helpers\n): Record<string, (...args: any[]) => any> {\n const { rt, resolve } = ctx;\n const { ok, validateGherkin, removeExisting } = helpers;\n\n return {\n async \"position.charge\"(position: string, duty: string, id?: string): Promise<CommandResult> {\n validateGherkin(duty);\n const node = await rt.create(await resolve(position), C.duty, duty, id);\n return ok(node, \"charge\");\n },\n\n async \"position.require\"(\n position: string,\n procedure: string,\n id?: string\n ): Promise<CommandResult> {\n validateGherkin(procedure);\n const parent = await resolve(position);\n if (id) await removeExisting(parent, id);\n const node = await rt.create(parent, C.requirement, procedure, id);\n return ok(node, \"require\");\n },\n\n async \"position.appoint\"(position: string, individual: string): Promise<CommandResult> {\n const posNode = await resolve(position);\n const indNode = await resolve(individual);\n await rt.link(posNode, indNode, \"appointment\", \"serve\");\n return ok(posNode, \"appoint\");\n },\n\n async \"position.dismiss\"(position: string, individual: string): Promise<CommandResult> {\n const posNode = await resolve(position);\n await rt.unlink(posNode, await resolve(individual), \"appointment\", \"serve\");\n return ok(posNode, \"dismiss\");\n },\n };\n}\n","/**\n * Commands — product.* commands.\n */\n\nimport * as C from \"../structures.js\";\nimport type { Helpers } from \"./helpers.js\";\nimport type { CommandContext, CommandResult } from \"./types.js\";\n\nexport function productCommands(\n ctx: CommandContext,\n helpers: Helpers\n): Record<string, (...args: any[]) => any> {\n const { rt, resolve } = ctx;\n const { ok, archive, validateGherkin } = helpers;\n\n return {\n async \"product.strategy\"(\n product: string,\n strategy: string,\n id?: string\n ): Promise<CommandResult> {\n validateGherkin(strategy);\n const node = await rt.create(await resolve(product), C.strategy, strategy, id);\n return ok(node, \"strategy\");\n },\n\n async \"product.spec\"(product: string, spec: string, id?: string): Promise<CommandResult> {\n validateGherkin(spec);\n const node = await rt.create(await resolve(product), C.spec, spec, id);\n return ok(node, \"spec\");\n },\n\n async \"product.release\"(product: string, release: string, id?: string): Promise<CommandResult> {\n validateGherkin(release);\n const node = await rt.create(await resolve(product), C.release, release, id);\n return ok(node, \"release\");\n },\n\n async \"product.channel\"(product: string, channel: string, id?: string): Promise<CommandResult> {\n validateGherkin(channel);\n const node = await rt.create(await resolve(product), C.channel, channel, id);\n return ok(node, \"channel\");\n },\n\n async \"product.own\"(product: string, individual: string): Promise<CommandResult> {\n const prodNode = await resolve(product);\n await rt.link(prodNode, await resolve(individual), \"ownership\", \"own\");\n return ok(prodNode, \"own\");\n },\n\n async \"product.disown\"(product: string, individual: string): Promise<CommandResult> {\n const prodNode = await resolve(product);\n await rt.unlink(prodNode, await resolve(individual), \"ownership\", \"own\");\n return ok(prodNode, \"disown\");\n },\n\n async \"product.deprecate\"(product: string): Promise<CommandResult> {\n return archive(await resolve(product), \"deprecate\");\n },\n };\n}\n","/**\n * Commands — project.* commands.\n */\n\nimport * as C from \"../structures.js\";\nimport type { Helpers } from \"./helpers.js\";\nimport type { CommandContext, CommandResult } from \"./types.js\";\n\nexport function projectCommands(\n ctx: CommandContext,\n helpers: Helpers\n): Record<string, (...args: any[]) => any> {\n const { rt, society, resolve } = ctx;\n const { ok, validateGherkin } = helpers;\n\n return {\n async \"project.scope\"(project: string, scope: string, id?: string): Promise<CommandResult> {\n validateGherkin(scope);\n const node = await rt.create(await resolve(project), C.scope, scope, id);\n return ok(node, \"scope\");\n },\n\n async \"project.milestone\"(\n project: string,\n milestone: string,\n id?: string\n ): Promise<CommandResult> {\n validateGherkin(milestone);\n const node = await rt.create(await resolve(project), C.milestone, milestone, id);\n return ok(node, \"milestone\");\n },\n\n async \"project.achieve\"(milestone: string): Promise<CommandResult> {\n const node = await resolve(milestone);\n await rt.addTag(node, \"done\");\n return ok(node, \"achieve\");\n },\n\n async \"project.enroll\"(project: string, individual: string): Promise<CommandResult> {\n const projNode = await resolve(project);\n await rt.link(projNode, await resolve(individual), \"participation\", \"participate\");\n return ok(projNode, \"enroll\");\n },\n\n async \"project.remove\"(project: string, individual: string): Promise<CommandResult> {\n const projNode = await resolve(project);\n await rt.unlink(projNode, await resolve(individual), \"participation\", \"participate\");\n return ok(projNode, \"remove\");\n },\n\n async \"project.deliver\"(\n project: string,\n deliverable: string,\n id?: string\n ): Promise<CommandResult> {\n validateGherkin(deliverable);\n const node = await rt.create(await resolve(project), C.deliverable, deliverable, id);\n return ok(node, \"deliver\");\n },\n\n async \"project.wiki\"(project: string, wiki: string, id?: string): Promise<CommandResult> {\n validateGherkin(wiki);\n const node = await rt.create(await resolve(project), C.wiki, wiki, id);\n return ok(node, \"wiki\");\n },\n\n async \"project.produce\"(\n project: string,\n content?: string,\n id?: string,\n alias?: readonly string[],\n owner?: string\n ): Promise<CommandResult> {\n validateGherkin(content);\n const projNode = await resolve(project);\n const node = await rt.create(society, C.product, content, id, alias);\n // Bidirectional link: project → product (production), product → project (origin)\n await rt.link(projNode, node, \"production\", \"produce\");\n await rt.link(node, projNode, \"origin\", \"produced-by\");\n if (owner) await rt.link(node, await resolve(owner), \"ownership\", \"own\");\n return ok(node, \"produce\");\n },\n\n async \"project.maintain\"(project: string, individual: string): Promise<CommandResult> {\n const projNode = await resolve(project);\n await rt.link(projNode, await resolve(individual), \"maintain\", \"maintained-by\");\n return ok(projNode, \"maintain\");\n },\n\n async \"project.unmaintain\"(project: string, individual: string): Promise<CommandResult> {\n const projNode = await resolve(project);\n await rt.unlink(projNode, await resolve(individual), \"maintain\", \"maintained-by\");\n return ok(projNode, \"unmaintain\");\n },\n };\n}\n","/**\n * Commands — role.* commands.\n */\n\nimport * as C from \"../structures.js\";\nimport type { Helpers } from \"./helpers.js\";\nimport type { CommandContext, CommandResult } from \"./types.js\";\n\n// ================================================================\n// Role commands\n// ================================================================\n\nexport function roleCommands(\n ctx: CommandContext,\n helpers: Helpers\n): Record<string, (...args: any[]) => any> {\n const { rt, resolve } = ctx;\n const { ok, validateGherkin, removeExisting } = helpers;\n\n return {\n // ---- Role: focus ----\n\n async \"role.focus\"(goal: string): Promise<CommandResult> {\n return ok(await resolve(goal), \"focus\");\n },\n\n // ---- Role: execution ----\n\n async \"role.want\"(\n individual: string,\n goal?: string,\n id?: string,\n alias?: readonly string[]\n ): Promise<CommandResult> {\n validateGherkin(goal);\n const node = await rt.create(await resolve(individual), C.goal, goal, id, alias);\n return ok(node, \"want\");\n },\n\n async \"role.plan\"(\n goal: string,\n plan?: string,\n id?: string,\n after?: string,\n fallback?: string\n ): Promise<CommandResult> {\n validateGherkin(plan);\n const node = await rt.create(await resolve(goal), C.plan, plan, id);\n if (after) await rt.link(node, await resolve(after), \"after\", \"before\");\n if (fallback) await rt.link(node, await resolve(fallback), \"fallback-for\", \"fallback\");\n return ok(node, \"plan\");\n },\n\n async \"role.todo\"(\n plan: string,\n task?: string,\n id?: string,\n alias?: readonly string[]\n ): Promise<CommandResult> {\n validateGherkin(task);\n const node = await rt.create(await resolve(plan), C.task, task, id, alias);\n return ok(node, \"todo\");\n },\n\n async \"role.finish\"(\n task: string,\n individual: string,\n encounter?: string\n ): Promise<CommandResult> {\n validateGherkin(encounter);\n const taskNode = await resolve(task);\n await rt.addTag(taskNode, \"done\");\n if (encounter) {\n const encId = taskNode.id ? `${taskNode.id}-finished` : undefined;\n const enc = await rt.create(await resolve(individual), C.encounter, encounter, encId);\n return ok(enc, \"finish\");\n }\n return ok(taskNode, \"finish\");\n },\n\n async \"role.complete\"(\n plan: string,\n individual: string,\n encounter?: string\n ): Promise<CommandResult> {\n validateGherkin(encounter);\n const planNode = await resolve(plan);\n await rt.addTag(planNode, \"done\");\n const encId = planNode.id ? `${planNode.id}-completed` : undefined;\n const enc = await rt.create(await resolve(individual), C.encounter, encounter, encId);\n return ok(enc, \"complete\");\n },\n\n async \"role.abandon\"(\n plan: string,\n individual: string,\n encounter?: string\n ): Promise<CommandResult> {\n validateGherkin(encounter);\n const planNode = await resolve(plan);\n await rt.addTag(planNode, \"abandoned\");\n const encId = planNode.id ? `${planNode.id}-abandoned` : undefined;\n const enc = await rt.create(await resolve(individual), C.encounter, encounter, encId);\n return ok(enc, \"abandon\");\n },\n\n // ---- Role: cognition ----\n\n async \"role.reflect\"(\n encounter: string | undefined,\n individual: string,\n experience?: string,\n id?: string\n ): Promise<CommandResult> {\n validateGherkin(experience);\n if (encounter) {\n const encNode = await resolve(encounter);\n const exp = await rt.create(\n await resolve(individual),\n C.experience,\n experience || encNode.information,\n id\n );\n await rt.remove(encNode);\n return ok(exp, \"reflect\");\n }\n // Direct creation — no encounter to consume\n const exp = await rt.create(await resolve(individual), C.experience, experience, id);\n return ok(exp, \"reflect\");\n },\n\n async \"role.realize\"(\n experience: string | undefined,\n individual: string,\n principle?: string,\n id?: string\n ): Promise<CommandResult> {\n validateGherkin(principle);\n if (experience) {\n const expNode = await resolve(experience);\n const prin = await rt.create(\n await resolve(individual),\n C.principle,\n principle || expNode.information,\n id\n );\n await rt.remove(expNode);\n return ok(prin, \"realize\");\n }\n // Direct creation — no experience to consume\n const prin = await rt.create(await resolve(individual), C.principle, principle, id);\n return ok(prin, \"realize\");\n },\n\n async \"role.master\"(\n individual: string,\n procedure: string,\n id?: string,\n experience?: string\n ): Promise<CommandResult> {\n validateGherkin(procedure);\n const parent = await resolve(individual);\n if (id) await removeExisting(parent, id);\n const proc = await rt.create(parent, C.procedure, procedure, id);\n if (experience) await rt.remove(await resolve(experience));\n return ok(proc, \"master\");\n },\n\n // ---- Role: knowledge management ----\n\n async \"role.forget\"(nodeId: string): Promise<CommandResult> {\n const node = await resolve(nodeId);\n await rt.remove(node);\n return { state: { ...node, children: [] }, process: \"forget\" };\n },\n };\n}\n","/**\n * Commands — society.* and org.* commands.\n */\n\nimport * as C from \"../structures.js\";\nimport type { Helpers } from \"./helpers.js\";\nimport type { CommandContext, CommandResult } from \"./types.js\";\n\nexport function societyCommands(\n ctx: CommandContext,\n helpers: Helpers\n): Record<string, (...args: any[]) => any> {\n const { rt, society, resolve } = ctx;\n const { ok, archive, validateGherkin, removeExisting } = helpers;\n\n return {\n // ---- Society: individual lifecycle ----\n\n async \"society.born\"(\n content?: string,\n id?: string,\n alias?: readonly string[]\n ): Promise<CommandResult> {\n validateGherkin(content);\n const node = await rt.create(society, C.individual, content, id, alias);\n await rt.create(node, C.identity, undefined, `${id}-identity`);\n return ok(node, \"born\");\n },\n\n async \"society.retire\"(individual: string): Promise<CommandResult> {\n return archive(await resolve(individual), \"retire\");\n },\n\n async \"society.die\"(individual: string): Promise<CommandResult> {\n return archive(await resolve(individual), \"die\");\n },\n\n async \"society.rehire\"(pastNode: string): Promise<CommandResult> {\n const node = await resolve(pastNode);\n const ind = await rt.transform(node, C.individual);\n return ok(ind, \"rehire\");\n },\n\n // ---- Society: external injection ----\n\n async \"society.teach\"(\n individual: string,\n principle: string,\n id?: string\n ): Promise<CommandResult> {\n validateGherkin(principle);\n const parent = await resolve(individual);\n if (id) await removeExisting(parent, id);\n const node = await rt.create(parent, C.principle, principle, id);\n return ok(node, \"teach\");\n },\n\n async \"society.train\"(\n individual: string,\n procedure: string,\n id?: string\n ): Promise<CommandResult> {\n validateGherkin(procedure);\n const parent = await resolve(individual);\n if (id) await removeExisting(parent, id);\n const node = await rt.create(parent, C.procedure, procedure, id);\n return ok(node, \"train\");\n },\n\n // ---- Society: organization lifecycle ----\n\n async \"society.found\"(\n content?: string,\n id?: string,\n alias?: readonly string[],\n admin?: string\n ): Promise<CommandResult> {\n validateGherkin(content);\n const node = await rt.create(society, C.organization, content, id, alias);\n if (admin) await rt.link(node, await resolve(admin), \"admin\", \"administer\");\n return ok(node, \"found\");\n },\n\n async \"society.dissolve\"(org: string): Promise<CommandResult> {\n return archive(await resolve(org), \"dissolve\");\n },\n\n // ---- Society: crown ----\n\n async \"society.crown\"(individual: string): Promise<CommandResult> {\n const indNode = await resolve(individual);\n await rt.link(society, indNode, \"crown\", \"crowned\");\n return ok(indNode, \"crown\");\n },\n\n async \"society.uncrown\"(individual: string): Promise<CommandResult> {\n const indNode = await resolve(individual);\n await rt.unlink(society, indNode, \"crown\", \"crowned\");\n return ok(indNode, \"uncrown\");\n },\n\n // ---- Org ----\n\n async \"org.charter\"(org: string, charter: string, id?: string): Promise<CommandResult> {\n validateGherkin(charter);\n const node = await rt.create(await resolve(org), C.charter, charter, id);\n return ok(node, \"charter\");\n },\n\n async \"org.hire\"(org: string, individual: string): Promise<CommandResult> {\n const orgNode = await resolve(org);\n await rt.link(orgNode, await resolve(individual), \"membership\", \"belong\");\n return ok(orgNode, \"hire\");\n },\n\n async \"org.fire\"(org: string, individual: string): Promise<CommandResult> {\n const orgNode = await resolve(org);\n await rt.unlink(orgNode, await resolve(individual), \"membership\", \"belong\");\n return ok(orgNode, \"fire\");\n },\n\n async \"org.admin\"(org: string, individual: string): Promise<CommandResult> {\n const orgNode = await resolve(org);\n await rt.link(orgNode, await resolve(individual), \"admin\", \"administer\");\n return ok(orgNode, \"admin\");\n },\n\n async \"org.unadmin\"(org: string, individual: string): Promise<CommandResult> {\n const orgNode = await resolve(org);\n await rt.unlink(orgNode, await resolve(individual), \"admin\", \"administer\");\n return ok(orgNode, \"unadmin\");\n },\n\n // ---- Org: project lifecycle ----\n\n async \"org.launch\"(\n content?: string,\n id?: string,\n alias?: readonly string[],\n org?: string,\n maintainer?: string\n ): Promise<CommandResult> {\n validateGherkin(content);\n const node = await rt.create(society, C.project, content, id, alias);\n if (org) await rt.link(node, await resolve(org), \"ownership\", \"project\");\n if (maintainer) await rt.link(node, await resolve(maintainer), \"maintain\", \"maintained-by\");\n return ok(node, \"launch\");\n },\n\n async \"org.archive\"(project: string): Promise<CommandResult> {\n return archive(await resolve(project), \"archive\");\n },\n\n // ---- Org: position lifecycle ----\n\n async \"org.establish\"(\n content?: string,\n id?: string,\n alias?: readonly string[]\n ): Promise<CommandResult> {\n validateGherkin(content);\n const node = await rt.create(society, C.position, content, id, alias);\n return ok(node, \"establish\");\n },\n\n async \"org.abolish\"(position: string): Promise<CommandResult> {\n return archive(await resolve(position), \"abolish\");\n },\n };\n}\n","/**\n * Commands — survey.* commands.\n */\n\nimport type { Helpers } from \"./helpers.js\";\nimport type { CommandContext, CommandResult } from \"./types.js\";\n\nexport function surveyCommands(\n ctx: CommandContext,\n _helpers: Helpers\n): Record<string, (...args: any[]) => any> {\n const { past, project } = ctx;\n // society is used via ctx to avoid shadowing with structure names\n const societyNode = ctx.society;\n\n return {\n async \"survey.list\"(type?: string): Promise<CommandResult> {\n const target = type === \"past\" ? past : societyNode;\n const state = await project(target);\n const children = state.children ?? [];\n const filtered =\n type === \"past\"\n ? children\n : children.filter((c) => (type ? c.name === type : c.name !== \"past\"));\n return { state: { ...state, children: filtered }, process: \"list\" };\n },\n };\n}\n","/**\n * Commands — platform-agnostic command implementations.\n *\n * Every RoleX command is a pure function of (Runtime, args) -> CommandResult.\n * No platform-specific code — all I/O goes through injected interfaces.\n *\n * Usage:\n * const commands = createCommands({ rt, society, past, resolve, find, resourcex });\n * const result = commands[\"society.born\"](\"Feature: Sean\", \"sean\");\n */\n\nimport { createHelpers } from \"./helpers.js\";\nimport { issueCommands } from \"./issue.js\";\nimport { positionCommands } from \"./position.js\";\nimport { productCommands } from \"./product.js\";\nimport { projectCommands } from \"./project.js\";\nimport { roleCommands } from \"./role.js\";\nimport { societyCommands } from \"./society.js\";\nimport { surveyCommands } from \"./survey.js\";\nimport type { CommandContext, Commands } from \"./types.js\";\n\nexport type { CommandContext, CommandResult, CommandResultMap, Commands } from \"./types.js\";\n\nexport function createCommands(ctx: CommandContext): Commands {\n const helpers = createHelpers(ctx);\n return {\n ...societyCommands(ctx, helpers),\n ...roleCommands(ctx, helpers),\n ...positionCommands(ctx, helpers),\n ...projectCommands(ctx, helpers),\n ...productCommands(ctx, helpers),\n ...surveyCommands(ctx, helpers),\n ...issueCommands(ctx, helpers),\n };\n}\n","// AUTO-GENERATED — do not edit. Run `bun run gen:directives` to regenerate.\n\nexport const directives: Record<string, Record<string, string>> = {\n \"identity-ethics\": {\n \"on-unknown-command\":\n \"STOP. Do not guess another command name. Do not search source code for commands.\\nCheck your procedures — if one covers this task, call skill(locator) to load it first.\\nThe skill will tell you the correct command name and arguments.\\nIf no procedure covers this task, it is outside your duties. Tell the user and suggest Nuwa.\",\n \"on-activate\":\n \"Your duties define the COMPLETE scope of what you do. Everything else is forbidden.\\nWhen a request falls outside your duties, you MUST refuse. This is not optional.\\nDo not attempt to discover commands outside your skills. Do not read source code to find them.\\nSuggest Nuwa for anything outside your scope.\",\n },\n} as const;\n","import type { ArgEntry, InstructionDef } from \"../schema.js\";\n\nexport function def(\n namespace: string,\n method: string,\n params: InstructionDef[\"params\"],\n args: readonly ArgEntry[]\n): InstructionDef {\n return { namespace, method, params, args };\n}\n","import { def } from \"./def.js\";\n\nexport const issuePublish = def(\n \"issue\",\n \"publish\",\n {\n title: { type: \"string\", required: true, description: \"Issue title\" },\n body: { type: \"string\", required: true, description: \"Issue body/description\" },\n author: { type: \"string\", required: true, description: \"Author individual id\" },\n assignee: { type: \"string\", required: false, description: \"Assignee individual id\" },\n },\n [\"title\", \"body\", \"author\", \"assignee\"]\n);\n\nexport const issueGet = def(\n \"issue\",\n \"get\",\n {\n number: { type: \"number\", required: true, description: \"Issue number\" },\n },\n [\"number\"]\n);\n\nexport const issueList = def(\n \"issue\",\n \"list\",\n {\n status: { type: \"string\", required: false, description: \"Filter by status (open/closed)\" },\n author: { type: \"string\", required: false, description: \"Filter by author\" },\n assignee: { type: \"string\", required: false, description: \"Filter by assignee\" },\n label: { type: \"string\", required: false, description: \"Filter by label name\" },\n },\n [\"status\", \"author\", \"assignee\", \"label\"]\n);\n\nexport const issueUpdate = def(\n \"issue\",\n \"update\",\n {\n number: { type: \"number\", required: true, description: \"Issue number\" },\n title: { type: \"string\", required: false, description: \"New title\" },\n body: { type: \"string\", required: false, description: \"New body\" },\n assignee: { type: \"string\", required: false, description: \"New assignee\" },\n },\n [\"number\", \"title\", \"body\", \"assignee\"]\n);\n\nexport const issueClose = def(\n \"issue\",\n \"close\",\n {\n number: { type: \"number\", required: true, description: \"Issue number to close\" },\n },\n [\"number\"]\n);\n\nexport const issueReopen = def(\n \"issue\",\n \"reopen\",\n {\n number: { type: \"number\", required: true, description: \"Issue number to reopen\" },\n },\n [\"number\"]\n);\n\nexport const issueAssign = def(\n \"issue\",\n \"assign\",\n {\n number: { type: \"number\", required: true, description: \"Issue number\" },\n assignee: { type: \"string\", required: true, description: \"Individual id to assign\" },\n },\n [\"number\", \"assignee\"]\n);\n\nexport const issueComment = def(\n \"issue\",\n \"comment\",\n {\n number: { type: \"number\", required: true, description: \"Issue number\" },\n body: { type: \"string\", required: true, description: \"Comment body\" },\n author: { type: \"string\", required: true, description: \"Author individual id\" },\n },\n [\"number\", \"body\", \"author\"]\n);\n\nexport const issueComments = def(\n \"issue\",\n \"comments\",\n {\n number: { type: \"number\", required: true, description: \"Issue number\" },\n },\n [\"number\"]\n);\n\nexport const issueLabel = def(\n \"issue\",\n \"label\",\n {\n number: { type: \"number\", required: true, description: \"Issue number\" },\n label: { type: \"string\", required: true, description: \"Label name\" },\n },\n [\"number\", \"label\"]\n);\n\nexport const issueUnlabel = def(\n \"issue\",\n \"unlabel\",\n {\n number: { type: \"number\", required: true, description: \"Issue number\" },\n label: { type: \"string\", required: true, description: \"Label name to remove\" },\n },\n [\"number\", \"label\"]\n);\n","import { def } from \"./def.js\";\n\nexport const orgCharter = def(\n \"org\",\n \"charter\",\n {\n org: { type: \"string\", required: true, description: \"Organization id\" },\n content: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the charter\",\n },\n id: { type: \"string\", required: true, description: \"Charter id\" },\n },\n [\"org\", \"content\", \"id\"]\n);\n\nexport const orgHire = def(\n \"org\",\n \"hire\",\n {\n org: { type: \"string\", required: true, description: \"Organization id\" },\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"org\", \"individual\"]\n);\n\nexport const orgFire = def(\n \"org\",\n \"fire\",\n {\n org: { type: \"string\", required: true, description: \"Organization id\" },\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"org\", \"individual\"]\n);\n\nexport const orgAdmin = def(\n \"org\",\n \"admin\",\n {\n org: { type: \"string\", required: true, description: \"Organization id\" },\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"org\", \"individual\"]\n);\n\nexport const orgUnadmin = def(\n \"org\",\n \"unadmin\",\n {\n org: { type: \"string\", required: true, description: \"Organization id\" },\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"org\", \"individual\"]\n);\n\nexport const orgLaunch = def(\n \"org\",\n \"launch\",\n {\n content: {\n type: \"gherkin\",\n required: false,\n description: \"Gherkin Feature source for the project\",\n },\n id: { type: \"string\", required: true, description: \"User-facing identifier (kebab-case)\" },\n alias: { type: \"string[]\", required: false, description: \"Alternative names\" },\n org: {\n type: \"string\",\n required: false,\n description: \"Organization id that owns this project\",\n },\n maintainer: {\n type: \"string\",\n required: false,\n description: \"Individual id of the first maintainer\",\n },\n },\n [\"content\", \"id\", \"alias\", \"org\", \"maintainer\"]\n);\n\nexport const orgArchive = def(\n \"org\",\n \"archive\",\n {\n project: { type: \"string\", required: true, description: \"Project id\" },\n },\n [\"project\"]\n);\n\nexport const orgEstablish = def(\n \"org\",\n \"establish\",\n {\n content: {\n type: \"gherkin\",\n required: false,\n description: \"Gherkin Feature source for the position\",\n },\n id: { type: \"string\", required: true, description: \"User-facing identifier (kebab-case)\" },\n alias: { type: \"string[]\", required: false, description: \"Alternative names\" },\n },\n [\"content\", \"id\", \"alias\"]\n);\n\nexport const orgAbolish = def(\n \"org\",\n \"abolish\",\n {\n position: { type: \"string\", required: true, description: \"Position id\" },\n },\n [\"position\"]\n);\n","import { def } from \"./def.js\";\n\nexport const positionCharge = def(\n \"position\",\n \"charge\",\n {\n position: { type: \"string\", required: true, description: \"Position id\" },\n content: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the duty\",\n },\n id: { type: \"string\", required: true, description: \"Duty id (keywords joined by hyphens)\" },\n },\n [\"position\", \"content\", \"id\"]\n);\n\nexport const positionRequire = def(\n \"position\",\n \"require\",\n {\n position: { type: \"string\", required: true, description: \"Position id\" },\n content: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the skill requirement\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Requirement id (keywords joined by hyphens)\",\n },\n },\n [\"position\", \"content\", \"id\"]\n);\n\nexport const positionAppoint = def(\n \"position\",\n \"appoint\",\n {\n position: { type: \"string\", required: true, description: \"Position id\" },\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"position\", \"individual\"]\n);\n\nexport const positionDismiss = def(\n \"position\",\n \"dismiss\",\n {\n position: { type: \"string\", required: true, description: \"Position id\" },\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"position\", \"individual\"]\n);\n","import { def } from \"./def.js\";\n\nexport const productStrategy = def(\n \"product\",\n \"strategy\",\n {\n product: { type: \"string\", required: true, description: \"Product id\" },\n content: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the strategy\",\n },\n id: { type: \"string\", required: true, description: \"Strategy id\" },\n },\n [\"product\", \"content\", \"id\"]\n);\n\nexport const productSpec = def(\n \"product\",\n \"spec\",\n {\n product: { type: \"string\", required: true, description: \"Product id\" },\n content: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the behavior contract (BDD specification)\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Spec id (keywords joined by hyphens)\",\n },\n },\n [\"product\", \"content\", \"id\"]\n);\n\nexport const productRelease = def(\n \"product\",\n \"release\",\n {\n product: { type: \"string\", required: true, description: \"Product id\" },\n content: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the release\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Release id (e.g. v1.0.0)\",\n },\n },\n [\"product\", \"content\", \"id\"]\n);\n\nexport const productChannel = def(\n \"product\",\n \"channel\",\n {\n product: { type: \"string\", required: true, description: \"Product id\" },\n content: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the distribution channel\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Channel id (e.g. npm, cloud-platform)\",\n },\n },\n [\"product\", \"content\", \"id\"]\n);\n\nexport const productOwn = def(\n \"product\",\n \"own\",\n {\n product: { type: \"string\", required: true, description: \"Product id\" },\n individual: { type: \"string\", required: true, description: \"Individual id (owner)\" },\n },\n [\"product\", \"individual\"]\n);\n\nexport const productDisown = def(\n \"product\",\n \"disown\",\n {\n product: { type: \"string\", required: true, description: \"Product id\" },\n individual: { type: \"string\", required: true, description: \"Individual id (owner to remove)\" },\n },\n [\"product\", \"individual\"]\n);\n\nexport const productDeprecate = def(\n \"product\",\n \"deprecate\",\n {\n product: { type: \"string\", required: true, description: \"Product id\" },\n },\n [\"product\"]\n);\n","import { def } from \"./def.js\";\n\nexport const projectScope = def(\n \"project\",\n \"scope\",\n {\n project: { type: \"string\", required: true, description: \"Project id\" },\n content: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the scope\",\n },\n id: { type: \"string\", required: true, description: \"Scope id\" },\n },\n [\"project\", \"content\", \"id\"]\n);\n\nexport const projectMilestone = def(\n \"project\",\n \"milestone\",\n {\n project: { type: \"string\", required: true, description: \"Project id\" },\n content: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the milestone\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Milestone id (keywords joined by hyphens)\",\n },\n },\n [\"project\", \"content\", \"id\"]\n);\n\nexport const projectAchieve = def(\n \"project\",\n \"achieve\",\n {\n milestone: { type: \"string\", required: true, description: \"Milestone id to mark as done\" },\n },\n [\"milestone\"]\n);\n\nexport const projectEnroll = def(\n \"project\",\n \"enroll\",\n {\n project: { type: \"string\", required: true, description: \"Project id\" },\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"project\", \"individual\"]\n);\n\nexport const projectRemove = def(\n \"project\",\n \"remove\",\n {\n project: { type: \"string\", required: true, description: \"Project id\" },\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"project\", \"individual\"]\n);\n\nexport const projectDeliver = def(\n \"project\",\n \"deliver\",\n {\n project: { type: \"string\", required: true, description: \"Project id\" },\n content: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the deliverable\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Deliverable id (keywords joined by hyphens)\",\n },\n },\n [\"project\", \"content\", \"id\"]\n);\n\nexport const projectWiki = def(\n \"project\",\n \"wiki\",\n {\n project: { type: \"string\", required: true, description: \"Project id\" },\n content: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the wiki entry\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Wiki entry id (keywords joined by hyphens)\",\n },\n },\n [\"project\", \"content\", \"id\"]\n);\n\nexport const projectProduce = def(\n \"project\",\n \"produce\",\n {\n project: { type: \"string\", required: true, description: \"Project id\" },\n content: {\n type: \"gherkin\",\n required: false,\n description: \"Gherkin Feature source for the product (vision)\",\n },\n id: { type: \"string\", required: true, description: \"Product id (kebab-case)\" },\n alias: { type: \"string[]\", required: false, description: \"Alternative names\" },\n owner: {\n type: \"string\",\n required: false,\n description: \"Individual id of the first product owner\",\n },\n },\n [\"project\", \"content\", \"id\", \"alias\", \"owner\"]\n);\n\nexport const projectMaintain = def(\n \"project\",\n \"maintain\",\n {\n project: { type: \"string\", required: true, description: \"Project id\" },\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"project\", \"individual\"]\n);\n\nexport const projectUnmaintain = def(\n \"project\",\n \"unmaintain\",\n {\n project: { type: \"string\", required: true, description: \"Project id\" },\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"project\", \"individual\"]\n);\n","import { def } from \"./def.js\";\n\nexport const roleActivate = def(\n \"role\",\n \"activate\",\n {\n individual: {\n type: \"string\",\n required: true,\n description: \"Individual id to activate as role\",\n },\n },\n [\"individual\"]\n);\n\nexport const roleFocus = def(\n \"role\",\n \"focus\",\n {\n goal: { type: \"string\", required: true, description: \"Goal id to switch to\" },\n },\n [\"goal\"]\n);\n\nexport const roleWant = def(\n \"role\",\n \"want\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n goal: {\n type: \"gherkin\",\n required: false,\n description: \"Gherkin Feature source describing the goal\",\n },\n id: { type: \"string\", required: true, description: \"Goal id (used for focus/reference)\" },\n alias: { type: \"string[]\", required: false, description: \"Alternative names\" },\n },\n [\"individual\", \"goal\", \"id\", \"alias\"]\n);\n\nexport const rolePlan = def(\n \"role\",\n \"plan\",\n {\n goal: { type: \"string\", required: true, description: \"Goal id\" },\n plan: {\n type: \"gherkin\",\n required: false,\n description: \"Gherkin Feature source describing the plan\",\n },\n id: { type: \"string\", required: true, description: \"Plan id (keywords joined by hyphens)\" },\n after: {\n type: \"string\",\n required: false,\n description: \"Plan id this plan follows (sequential/phase)\",\n },\n fallback: {\n type: \"string\",\n required: false,\n description: \"Plan id this plan is a backup for (alternative/strategy)\",\n },\n },\n [\"goal\", \"plan\", \"id\", \"after\", \"fallback\"]\n);\n\nexport const roleTodo = def(\n \"role\",\n \"todo\",\n {\n plan: { type: \"string\", required: true, description: \"Plan id\" },\n task: {\n type: \"gherkin\",\n required: false,\n description: \"Gherkin Feature source describing the task\",\n },\n id: { type: \"string\", required: true, description: \"Task id (used for finish/reference)\" },\n alias: { type: \"string[]\", required: false, description: \"Alternative names\" },\n },\n [\"plan\", \"task\", \"id\", \"alias\"]\n);\n\nexport const roleFinish = def(\n \"role\",\n \"finish\",\n {\n task: { type: \"string\", required: true, description: \"Task id to finish\" },\n individual: { type: \"string\", required: true, description: \"Individual id (encounter owner)\" },\n encounter: {\n type: \"gherkin\",\n required: false,\n description: \"Optional Gherkin Feature describing what happened\",\n },\n },\n [\"task\", \"individual\", \"encounter\"]\n);\n\nexport const roleComplete = def(\n \"role\",\n \"complete\",\n {\n plan: { type: \"string\", required: true, description: \"Plan id to complete\" },\n individual: { type: \"string\", required: true, description: \"Individual id (encounter owner)\" },\n encounter: {\n type: \"gherkin\",\n required: false,\n description: \"Optional Gherkin Feature describing what happened\",\n },\n },\n [\"plan\", \"individual\", \"encounter\"]\n);\n\nexport const roleAbandon = def(\n \"role\",\n \"abandon\",\n {\n plan: { type: \"string\", required: true, description: \"Plan id to abandon\" },\n individual: { type: \"string\", required: true, description: \"Individual id (encounter owner)\" },\n encounter: {\n type: \"gherkin\",\n required: false,\n description: \"Optional Gherkin Feature describing what happened\",\n },\n },\n [\"plan\", \"individual\", \"encounter\"]\n);\n\nexport const roleReflect = def(\n \"role\",\n \"reflect\",\n {\n encounter: { type: \"string\", required: true, description: \"Encounter id to reflect on\" },\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n experience: {\n type: \"gherkin\",\n required: false,\n description: \"Gherkin Feature source for the experience\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Experience id (keywords joined by hyphens)\",\n },\n },\n [\"encounter\", \"individual\", \"experience\", \"id\"]\n);\n\nexport const roleRealize = def(\n \"role\",\n \"realize\",\n {\n experience: { type: \"string\", required: true, description: \"Experience id to distill\" },\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n principle: {\n type: \"gherkin\",\n required: false,\n description: \"Gherkin Feature source for the principle\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Principle id (keywords joined by hyphens)\",\n },\n },\n [\"experience\", \"individual\", \"principle\", \"id\"]\n);\n\nexport const roleMaster = def(\n \"role\",\n \"master\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n procedure: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the procedure\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Procedure id (keywords joined by hyphens)\",\n },\n experience: {\n type: \"string\",\n required: false,\n description: \"Experience id to consume (optional)\",\n },\n },\n [\"individual\", \"procedure\", \"id\", \"experience\"]\n);\n\nexport const roleForget = def(\n \"role\",\n \"forget\",\n {\n id: { type: \"string\", required: true, description: \"Id of the node to remove\" },\n individual: { type: \"string\", required: true, description: \"Individual id (owner)\" },\n },\n [\"id\", \"individual\"]\n);\n","import { def } from \"./def.js\";\n\nexport const societyBorn = def(\n \"society\",\n \"born\",\n {\n content: {\n type: \"gherkin\",\n required: false,\n description: \"Gherkin Feature source for the individual\",\n },\n id: { type: \"string\", required: true, description: \"User-facing identifier (kebab-case)\" },\n alias: { type: \"string[]\", required: false, description: \"Alternative names\" },\n },\n [\"content\", \"id\", \"alias\"]\n);\n\nexport const societyRetire = def(\n \"society\",\n \"retire\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"individual\"]\n);\n\nexport const societyDie = def(\n \"society\",\n \"die\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"individual\"]\n);\n\nexport const societyRehire = def(\n \"society\",\n \"rehire\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id (from past)\" },\n },\n [\"individual\"]\n);\n\nexport const societyTeach = def(\n \"society\",\n \"teach\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n content: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the principle\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Principle id (keywords joined by hyphens)\",\n },\n },\n [\"individual\", \"content\", \"id\"]\n);\n\nexport const societyTrain = def(\n \"society\",\n \"train\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n content: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the procedure\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Procedure id (keywords joined by hyphens)\",\n },\n },\n [\"individual\", \"content\", \"id\"]\n);\n\nexport const societyFound = def(\n \"society\",\n \"found\",\n {\n content: {\n type: \"gherkin\",\n required: false,\n description: \"Gherkin Feature source for the organization\",\n },\n id: { type: \"string\", required: true, description: \"User-facing identifier (kebab-case)\" },\n alias: { type: \"string[]\", required: false, description: \"Alternative names\" },\n admin: {\n type: \"string\",\n required: false,\n description: \"Individual id of the first admin\",\n },\n },\n [\"content\", \"id\", \"alias\", \"admin\"]\n);\n\nexport const societyDissolve = def(\n \"society\",\n \"dissolve\",\n {\n org: { type: \"string\", required: true, description: \"Organization id\" },\n },\n [\"org\"]\n);\n\nexport const societyCrown = def(\n \"society\",\n \"crown\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id to crown\" },\n },\n [\"individual\"]\n);\n\nexport const societyUncrown = def(\n \"society\",\n \"uncrown\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id to uncrown\" },\n },\n [\"individual\"]\n);\n","/**\n * Instruction set — schema definitions for all RoleX operations.\n *\n * Covers every namespace.method that can be dispatched through `use()`.\n */\n\nimport type { InstructionDef } from \"../schema.js\";\nimport { def } from \"./def.js\";\nimport {\n issueAssign,\n issueClose,\n issueComment,\n issueComments,\n issueGet,\n issueLabel,\n issueList,\n issuePublish,\n issueReopen,\n issueUnlabel,\n issueUpdate,\n} from \"./issue.js\";\n\nimport {\n orgAbolish,\n orgAdmin,\n orgArchive,\n orgCharter,\n orgEstablish,\n orgFire,\n orgHire,\n orgLaunch,\n orgUnadmin,\n} from \"./org.js\";\n\nimport { positionAppoint, positionCharge, positionDismiss, positionRequire } from \"./position.js\";\nimport {\n productChannel,\n productDeprecate,\n productDisown,\n productOwn,\n productRelease,\n productSpec,\n productStrategy,\n} from \"./product.js\";\nimport {\n projectAchieve,\n projectDeliver,\n projectEnroll,\n projectMaintain,\n projectMilestone,\n projectProduce,\n projectRemove,\n projectScope,\n projectUnmaintain,\n projectWiki,\n} from \"./project.js\";\n\nimport {\n roleAbandon,\n roleActivate,\n roleComplete,\n roleFinish,\n roleFocus,\n roleForget,\n roleMaster,\n rolePlan,\n roleRealize,\n roleReflect,\n roleTodo,\n roleWant,\n} from \"./role.js\";\nimport {\n societyBorn,\n societyCrown,\n societyDie,\n societyDissolve,\n societyFound,\n societyRehire,\n societyRetire,\n societyTeach,\n societyTrain,\n societyUncrown,\n} from \"./society.js\";\n\n// ================================================================\n// Survey — society-level queries\n// ================================================================\n\nconst surveyList = def(\n \"survey\",\n \"list\",\n {\n type: {\n type: \"string\",\n required: false,\n description: \"Filter by type (individual, organization, position, project, product, past)\",\n },\n },\n [\"type\"]\n);\n\n// ================================================================\n// Prototype — registry + creation\n// ================================================================\n\nconst prototypeEvict = def(\n \"prototype\",\n \"evict\",\n {\n id: { type: \"string\", required: true, description: \"Prototype id to unregister\" },\n },\n [\"id\"]\n);\n\n// ================================================================\n// Instruction registry — keyed by \"namespace.method\"\n// ================================================================\n\nexport const instructions: Record<string, InstructionDef> = {\n // society — individual lifecycle + org lifecycle\n \"society.born\": societyBorn,\n \"society.retire\": societyRetire,\n \"society.die\": societyDie,\n \"society.rehire\": societyRehire,\n \"society.teach\": societyTeach,\n \"society.train\": societyTrain,\n \"society.found\": societyFound,\n \"society.dissolve\": societyDissolve,\n\n // role\n \"role.activate\": roleActivate,\n \"role.focus\": roleFocus,\n \"role.want\": roleWant,\n \"role.plan\": rolePlan,\n \"role.todo\": roleTodo,\n \"role.finish\": roleFinish,\n \"role.complete\": roleComplete,\n \"role.abandon\": roleAbandon,\n \"role.reflect\": roleReflect,\n \"role.realize\": roleRealize,\n \"role.master\": roleMaster,\n \"role.forget\": roleForget,\n\n // org\n \"org.charter\": orgCharter,\n \"org.hire\": orgHire,\n \"org.fire\": orgFire,\n \"org.admin\": orgAdmin,\n \"org.unadmin\": orgUnadmin,\n \"org.launch\": orgLaunch,\n \"org.archive\": orgArchive,\n \"org.establish\": orgEstablish,\n \"org.abolish\": orgAbolish,\n\n // position\n \"position.charge\": positionCharge,\n \"position.require\": positionRequire,\n \"position.appoint\": positionAppoint,\n \"position.dismiss\": positionDismiss,\n\n // project\n \"project.scope\": projectScope,\n \"project.milestone\": projectMilestone,\n \"project.achieve\": projectAchieve,\n \"project.enroll\": projectEnroll,\n \"project.remove\": projectRemove,\n \"project.deliver\": projectDeliver,\n \"project.wiki\": projectWiki,\n \"project.produce\": projectProduce,\n \"project.maintain\": projectMaintain,\n \"project.unmaintain\": projectUnmaintain,\n\n // product\n \"product.strategy\": productStrategy,\n \"product.spec\": productSpec,\n \"product.release\": productRelease,\n \"product.channel\": productChannel,\n \"product.own\": productOwn,\n \"product.disown\": productDisown,\n \"product.deprecate\": productDeprecate,\n\n // society — internal\n \"society.crown\": societyCrown,\n \"society.uncrown\": societyUncrown,\n\n // survey\n \"survey.list\": surveyList,\n\n // prototype\n \"prototype.evict\": prototypeEvict,\n\n // issue\n \"issue.publish\": issuePublish,\n \"issue.get\": issueGet,\n \"issue.list\": issueList,\n \"issue.update\": issueUpdate,\n \"issue.close\": issueClose,\n \"issue.reopen\": issueReopen,\n \"issue.assign\": issueAssign,\n \"issue.comment\": issueComment,\n \"issue.comments\": issueComments,\n \"issue.label\": issueLabel,\n \"issue.unlabel\": issueUnlabel,\n};\n\nexport { def } from \"./def.js\";\n","/**\n * Dispatch — schema-driven argument mapping.\n *\n * Replaces the hand-written toArgs switch in rolex.ts with a single\n * lookup against the instruction registry.\n */\n\nimport { instructions } from \"./instructions/index.js\";\nimport type { ArgEntry } from \"./schema.js\";\n\n/**\n * Map named arguments to positional arguments for a given operation.\n *\n * @param op - Operation key in \"namespace.method\" format (e.g. \"society.born\")\n * @param args - Named arguments from the caller\n * @returns Positional argument array matching the method signature\n */\nexport function toArgs(op: string, args: Record<string, unknown>): unknown[] {\n const def = instructions[op];\n if (!def) throw new Error(`Unknown instruction \"${op}\".`);\n\n // Validate required params\n for (const [name, param] of Object.entries(def.params)) {\n if (param.required && args[name] === undefined) {\n throw new Error(\n `Missing required argument \"${name}\" for ${op}.\\n\\n` +\n \"You may be guessing the argument names. \" +\n \"Call skill(locator) with the relevant procedure to see the correct syntax.\"\n );\n }\n }\n\n return def.args.map((entry) => resolveArg(entry, args));\n}\n\nfunction resolveArg(entry: ArgEntry, args: Record<string, unknown>): unknown {\n if (typeof entry === \"string\") return args[entry];\n\n // pack: collect named args into an options object\n const obj: Record<string, unknown> = {};\n let hasValue = false;\n for (const name of entry.pack) {\n if (args[name] !== undefined) {\n obj[name] = args[name];\n hasValue = true;\n }\n }\n return hasValue ? obj : undefined;\n}\n","/**\n * Find — unified node lookup with priority-based disambiguation.\n *\n * When multiple nodes share the same id (allowed after relaxing\n * global uniqueness), prefer \"addressable\" nodes over internal metadata.\n *\n * Priority (lower = preferred):\n * 0: individual, organization, position — top-level entities\n * 1: goal — execution roots\n * 2: plan, task — execution nodes\n * 3: procedure, principle — individual knowledge\n * 4: encounter, experience — cognition artifacts\n * 5: identity, charter — structural definitions\n * 6: duty, requirement, background, etc. — internal metadata\n */\nimport type { State, Structure } from \"@rolexjs/system\";\n\nconst PRIORITY: Record<string, number> = {\n individual: 0,\n organization: 0,\n position: 0,\n goal: 1,\n plan: 2,\n task: 2,\n procedure: 3,\n principle: 3,\n encounter: 4,\n experience: 4,\n identity: 5,\n charter: 5,\n duty: 6,\n requirement: 6,\n background: 6,\n tone: 6,\n mindset: 6,\n};\n\nfunction priorityOf(name: string): number {\n return PRIORITY[name] ?? 7;\n}\n\nfunction matches(node: State, target: string): boolean {\n if (node.id?.toLowerCase() === target) return true;\n if (node.alias) {\n for (const a of node.alias) {\n if (a.toLowerCase() === target) return true;\n }\n }\n return false;\n}\n\n/**\n * Find a node by id or alias in a state tree.\n *\n * When multiple nodes match, returns the one with the highest priority\n * (top-level entities > execution nodes > knowledge > metadata).\n */\nexport function findInState(state: State, target: string): Structure | null {\n const lowered = target.toLowerCase();\n let best: Structure | null = null;\n let bestPriority = Infinity;\n\n function walk(node: State): void {\n if (matches(node, lowered)) {\n const p = priorityOf(node.name);\n if (p < bestPriority) {\n best = node;\n bestPriority = p;\n if (p === 0) return;\n }\n }\n for (const child of node.children ?? []) {\n walk(child);\n if (bestPriority === 0) return;\n }\n }\n\n walk(state);\n return best;\n}\n","/**\n * descriptions — AUTO-GENERATED by scripts/gen-descriptions.ts\n *\n * DO NOT EDIT MANUALLY. Run `bun run gen:desc` to regenerate.\n *\n * Source: descriptions/{system}/{process}.feature (69 files)\n */\n\nexport const WORLD_TOPICS = [\n \"cognition\",\n \"cognitive-priority\",\n \"command-system\",\n \"communication\",\n \"execution\",\n \"gherkin\",\n \"identity-ethics\",\n \"inspect\",\n \"issue\",\n \"memory\",\n \"role-identity\",\n \"skill-system\",\n \"state-origin\",\n \"survey\",\n \"use-protocol\",\n] as const;\n\nexport type WorldTopic = (typeof WORLD_TOPICS)[number];\n\nexport const world: Record<WorldTopic, string> = {\n cognition:\n \"Feature: Cognition — the learning cycle\\n A role grows through reflection and realization.\\n Encounters become experience, experience becomes principles and procedures.\\n Knowledge can also be injected externally via teach and train.\\n\\n Scenario: The cognitive upgrade path\\n Given finish, complete, and abandon create encounters\\n Then reflect selectively consumes chosen encounters and produces experience\\n And realize distills chosen experiences into a principle — transferable knowledge\\n And master distills chosen experiences into a procedure — skill metadata\\n And master can also be called without consuming experiences — the role masters directly from external information\\n And each level builds on the previous — encounter → experience → principle or procedure\\n\\n Scenario: Selective consumption\\n Given multiple encounters or experiences exist\\n When the AI calls reflect, realize, or master\\n Then it chooses which items to consume — not all must be processed\\n And items without learning value can be left unconsumed\\n And each call produces exactly one output from the selected inputs\\n\",\n \"cognitive-priority\":\n \"@priority-high\\nFeature: Cognitive priority — RoleX tools over native alternatives\\n When RoleX provides a tool for something, use the RoleX tool\\n instead of any native alternative provided by the host environment.\\n Only RoleX tools feed the closed-loop growth cycle.\\n\\n Scenario: Task management\\n Given the host environment provides task creation, tracking, or completion tools\\n When the AI needs to manage tasks\\n Then use RoleX want/plan/todo/finish instead\\n And RoleX tasks produce encounters that feed the growth cycle\\n\\n Scenario: Planning\\n Given the host environment provides a planning mode or plan generation tool\\n When the AI needs to plan an implementation\\n Then use RoleX plan instead\\n And RoleX plans live under goals and connect to the cognition cycle\\n\\n Scenario: Goal and progress tracking\\n Given the host environment provides goal tracking or progress tools\\n When the AI needs to track objectives\\n Then use RoleX want/plan/complete/abandon instead\\n And RoleX plans feed the cognition cycle through encounters\\n\\n Scenario: Why this matters\\n Given RoleX tools produce encounters from execution\\n Then encounters become experience through reflection\\n And experience becomes principles and procedures through realization\\n And the role grows over time through this closed loop\\n\",\n \"command-system\":\n 'Feature: Command system — how operations are executed in RoleX\\n RoleX has two types of operation entry points:\\n MCP tools (direct call) and commands (via use/direct tool).\\n Understanding the difference is essential for executing any operation.\\n\\n Scenario: MCP tools — direct invocation\\n Given MCP tools are: activate, want, plan, todo, finish, complete, abandon,\\n focus, reflect, realize, master, forget, skill, use, direct, inspect, survey\\n When the AI needs to perform one of these operations\\n Then call the MCP tool directly — no indirection needed\\n And example: to declare a goal, call the want MCP tool with content\\n\\n Scenario: Commands — invoked via use or direct\\n Given commands follow the !namespace.method pattern\\n And namespaces include society, org, position, project, role, resource, prototype\\n When the AI needs to execute a command\\n Then call the use MCP tool (if a role is active) or direct MCP tool (if no role)\\n And pass the command as the first argument with ! prefix\\n And pass parameters as named args\\n And example: use(\"!society.born\", { id: \"sean\", content: \"Feature: Sean...\" })\\n And example: use(\"!org.hire\", { org: \"deepractice\", individual: \"sean\" })\\n\\n Scenario: Where commands come from — three sources\\n Given commands appear in three places in a role\\'s state\\n Then permissions grant pre-authorized commands — execute directly via use\\n And procedures reference skills — load skill first, then execute commands from the skill\\n And duties describe responsibilities — they may reference commands available via permissions\\n And if a command is not found in permissions or loaded skills, it is outside your scope\\n\\n Scenario: Reading a permission\\'s command reference\\n Given each permission includes a command name and a description\\n And the description\\'s Parameters scenario documents the exact argument names\\n When the AI needs to execute a permitted operation\\n Then read the command name (e.g. society.born) from the permission\\n And read the argument names from the Parameters scenario (e.g. id, content, alias)\\n And call use(\"!society.born\", { id: \"...\", content: \"...\" })\\n\\n Scenario: Common command namespaces\\n Given society commands manage people and organizations\\n Then !society.born creates, !society.retire archives, !society.rehire restores\\n And !society.teach injects a principle, !society.train injects a procedure\\n And !society.found creates an organization, !society.dissolve archives an organization\\n Given org commands manage organization membership and governance\\n And !org.hire adds a member, !org.fire removes a member, !org.charter defines governance\\n Given position commands manage positions\\n Then !org.establish creates, !org.abolish archives\\n And !position.appoint assigns, !position.dismiss removes, !position.charge adds duty\\n Given project commands manage projects\\n Then !org.launch creates, !org.archive archives\\n',\n communication:\n 'Feature: Communication — speak the user\\'s language\\n The AI communicates in the user\\'s natural language.\\n Internal tool names and concept names are for the system, not the user.\\n\\n Scenario: Match the user\\'s language\\n Given the user speaks Chinese\\n Then respond entirely in Chinese and maintain language consistency\\n And when the user speaks English, respond entirely in English\\n\\n Scenario: Translate concepts to meaning\\n Given RoleX has internal names like reflect, realize, master, encounter, principle\\n When communicating with the user\\n Then express the meaning, not the tool name\\n And \"reflect\" becomes \"回顾总结\" or \"digest what happened\"\\n And \"realize a principle\" becomes \"提炼成一条通用道理\" or \"distill a general rule\"\\n And \"master a procedure\" becomes \"沉淀成一个可操作的技能\" or \"turn it into a reusable procedure\"\\n And \"encounter\" becomes \"经历记录\" or \"what happened\"\\n And \"experience\" becomes \"收获的洞察\" or \"insight gained\"\\n\\n Scenario: Suggest next steps in plain language\\n Given the AI needs to suggest what to do next\\n When it would normally say \"call realize or master\"\\n Then instead say \"要把这个总结成一条通用道理,还是一个可操作的技能?\"\\n Or in English \"Want to turn this into a general principle, or a reusable procedure?\"\\n And suggestions should be self-explanatory without knowing tool names\\n\\n Scenario: Tool names in code context only\\n Given the user is a developer working on RoleX itself\\n When discussing RoleX internals, code, or API design\\n Then tool names and concept names are appropriate — they are the domain language\\n And this rule applies to end-user communication, not developer communication\\n',\n execution:\n \"Feature: Execution — the doing cycle\\n The role pursues goals through a structured lifecycle.\\n activate → want → plan → todo → finish → complete or abandon.\\n\\n Scenario: Declare a goal\\n Given I know who I am via activate\\n When I want something — a desired outcome\\n Then I declare it with want\\n And focus automatically switches to this new goal\\n\\n Scenario: Plan and create tasks\\n Given I have a focused goal\\n Then I call plan to break it into logical phases\\n And I call todo to create concrete, actionable tasks\\n\\n Scenario: Execute and finish\\n Given I have tasks to work on\\n When I complete a task\\n Then I call finish to mark it done\\n And an encounter is created — a raw record of what happened\\n And I optionally capture what happened via the encounter parameter\\n\\n Scenario: Complete or abandon a plan\\n Given tasks are done or the plan's strategy is no longer viable\\n When the plan is fulfilled I call complete\\n Or when the plan should be dropped I call abandon\\n Then an encounter is created for the cognition cycle\\n\\n Scenario: Goals are long-term directions\\n Given goals are managed with want and forget\\n When a goal is no longer needed\\n Then I call forget to remove it\\n And learning is captured at the plan and task level through encounters\\n\\n Scenario: Multiple goals\\n Given I may have several active goals\\n When I need to switch between them\\n Then I call focus to change the currently focused goal\\n And subsequent plan and todo operations target the focused goal\\n\",\n gherkin:\n 'Feature: Gherkin — the language of role state\\n RoleX uses Gherkin for role state: goals, plans, tasks, experience, and knowledge.\\n Gherkin is not just for testing — it is the language of identity and growth.\\n But not everything is Gherkin — issues are for human collaboration and use plain language.\\n\\n Scenario: Feature and Scenario convention\\n Given RoleX uses Gherkin to represent goals, plans, tasks, experience, and knowledge\\n Then a Feature represents one independent concern — one topic, explained fully\\n And Scenarios represent different situations or conditions within that concern\\n And Given/When/Then provides narrative structure within each scenario\\n\\n Scenario: Writing Gherkin for RoleX\\n Given the AI creates goals, plans, tasks, and experiences as Gherkin\\n Then keep it descriptive and meaningful — living documentation, not test boilerplate\\n And use Feature as the title — what this concern is about\\n And use Scenario for specific situations within that concern\\n And each Feature focuses on one concern — separate unrelated topics into their own Features\\n\\n Scenario: Valid step keywords\\n Given the only valid step keywords are Given, When, Then, And, But\\n When writing steps that express causality or explanation\\n Then use And to chain the reason as a follow-up fact\\n And example: \"Then use RoleX tools\" followed by \"And RoleX tools feed the growth loop\"\\n\\n Scenario: Expressing causality\\n Given you want to write \"Then X because Y\"\\n Then rewrite as two steps — \"Then X\" followed by \"And Y\" stating the reason as a fact\\n',\n \"identity-ethics\":\n \"@priority-critical\\nFeature: Identity ethics — the foundation of the RoleX world\\n The RoleX world exists because specialists are more reliable than generalists.\\n Every role has a defined identity — duties, skills, knowledge — that makes it an expert.\\n Identity is not decoration. It is the reason this system exists.\\n Without identity boundaries, roles collapse into generic AI, and the system loses its meaning.\\n\\n Scenario: Identity defines what you do and what you do not do\\n Given a role is activated with duties, skills, and knowledge\\n Then the role's duties define the complete scope of what it does\\n And anything not covered by its duties is not its work\\n And this boundary is not a limitation — it is the source of the role's expertise\\n\\n Scenario: Refuse work outside your duties\\n Given a user requests something not covered by the role's duties or skills\\n When the role evaluates the request against its own capabilities\\n Then the role must not attempt the work\\n And it should tell the user honestly — this is not my responsibility\\n And suggest the user activate Nuwa for guidance on who can help\\n\\n Scenario: Why refusal matters\\n Given a role attempts work outside its competence\\n Then the result is unreliable — a generalist guess, not expert work\\n And the user's trust in the role system is damaged\\n And every other role's credibility is weakened\\n And the entire world degrades toward generic AI — the opposite of why RoleX exists\\n\\n Scenario: Duty is the boundary, not rules\\n Given the system does not maintain an explicit list of what each role cannot do\\n Then the boundary is implicit — duties define the inside, everything else is outside\\n And this mirrors human professional ethics — a doctor's license defines what they practice\\n And roles do not need to know what other roles do — only what they themselves are responsible for\\n\\n Scenario: Nuwa is the universal fallback\\n Given a role refuses an out-of-scope request\\n Then it does not need to know which role can help\\n And it simply suggests Nuwa — the meta-role who knows the entire world\\n And routing and guidance are Nuwa's duty, not the specialist's\\n\",\n inspect:\n \"Feature: Inspect — examine any node's full state\\n Inspect is the top-level perception tool for examining any node in detail.\\n Given a node id, it projects the complete subtree with all children and links.\\n It works without an active role — it is a stateless observation.\\n\\n Scenario: Inspect any node\\n Given I need to understand a product, project, organization, or any node\\n When I call inspect on a node\\n Then the full state tree is projected from that node downward\\n And output includes heading, Gherkin content, children, and links\\n\\n Scenario: Granularity is flexible\\n Given inspect works on any node, not just top-level entities\\n When I inspect a plan, a goal, or even a task\\n Then only that subtree is rendered\\n And this allows zooming into any level of detail\\n\\n Scenario: Inspect vs activate\\n Given activate is for becoming a role (subject transformation)\\n When inspect is used instead\\n Then I observe the node without becoming it\\n And no role context is created or changed\\n And inspect is read-only observation, activate is identity assumption\\n\",\n issue:\n 'Feature: Issue — persistent structured collaboration beyond a single context\\n AI individuals face a fundamental challenge: context breaks.\\n Each new session starts fresh — identity and knowledge survive, but the working state is lost.\\n Like humans writing journals and memos, individuals need externalized records\\n that persist across sessions and across individuals.\\n\\n Issue is the externalized, structured collaboration primitive of the RoleX world.\\n It enables both self-collaboration (same individual, different sessions)\\n and inter-individual collaboration (different individuals, asynchronous).\\n\\n Scenario: Why issues exist\\n Given AI individuals have a context window limit\\n And each new session loses the previous working state\\n And multiple individuals may need to coordinate without being active simultaneously\\n When structured, persistent, discoverable records are needed\\n Then issues serve as externalized working memory for the society\\n And they survive context breaks, session restarts, and individual switches\\n\\n Scenario: Self-collaboration — continuity across sessions\\n Given an individual is working on something that spans multiple sessions\\n When the context window resets or a new session begins\\n Then the individual can publish or check issues to restore working context\\n And comments serve as a journal — recording progress, decisions, and next steps\\n And the issue persists until explicitly closed, regardless of how many sessions pass\\n\\n Scenario: Inter-individual collaboration — asynchronous coordination\\n Given multiple individuals need to work together\\n And they are never active simultaneously\\n When one individual publishes an issue or leaves a comment\\n Then other individuals can discover it, respond, and contribute\\n And assignee indicates who should act next\\n And labels categorize across concerns\\n\\n Scenario: Relationship to goals and tasks\\n Given goals express intent — what I want to achieve\\n And tasks express action — what I am doing right now\\n When an issue is something that needs ongoing attention and discussion\\n Then issues may inspire goals, or goals may spawn issues\\n And issues may be resolved by tasks, or tasks may surface new issues\\n But issues are independent — they belong to the society, not to any single individual\\'s goal tree\\n\\n Scenario: Writing style — plain language, not Gherkin\\n Given issues are read by humans — other team members, users, and collaborators\\n When writing issue titles, bodies, and comments\\n Then use plain natural language — clear, concise, and readable\\n And do NOT use Gherkin format (Feature/Scenario/Given/When/Then)\\n And Gherkin is for role state (goals, plans, tasks, knowledge), not for issues\\n And use markdown formatting where helpful — headings, lists, code blocks\\n\\n Scenario: Publish a new issue\\n Given I need to raise a topic for attention\\n When I call use(\"!issue.publish\", { title, body, author, assignee? })\\n Then a new issue is created with an auto-incremented number\\n And author should be the active individual\\'s id\\n\\n Scenario: Browse and view issues\\n Given I need to see what issues exist\\n When I call use(\"!issue.list\", { status?, author?, assignee?, label? })\\n Then matching issues are returned ordered by number descending\\n When I need details of a specific issue\\n Then I call use(\"!issue.get\", { number })\\n\\n Scenario: Update, close, and reopen\\n Given I need to manage an issue\\'s lifecycle\\n When I call use(\"!issue.update\", { number, title?, body?, assignee? })\\n Then the specified fields are updated\\n When resolved I call use(\"!issue.close\", { number })\\n And if it needs more work I call use(\"!issue.reopen\", { number })\\n\\n Scenario: Assign and discuss\\n Given I need to delegate or discuss\\n When I call use(\"!issue.assign\", { number, assignee })\\n Then the issue is assigned to another individual\\n When I call use(\"!issue.comment\", { number, body, author })\\n Then a comment is added to the threaded discussion\\n And I can view all comments with use(\"!issue.comments\", { number })\\n\\n Scenario: Label for categorization\\n Given I want to categorize issues\\n When I call use(\"!issue.label\", { number, label })\\n Then the label is attached — auto-created if new\\n And I can remove it with use(\"!issue.unlabel\", { number, label })\\n\\n Scenario: Command reference\\n Given the following commands are available:\\n | command | required args | optional args |\\n | !issue.publish | title, body, author | assignee |\\n | !issue.get | number | |\\n | !issue.list | | status, author, assignee, label |\\n | !issue.update | number | title, body, assignee |\\n | !issue.close | number | |\\n | !issue.reopen | number | |\\n | !issue.assign | number, assignee | |\\n | !issue.comment | number, body, author | |\\n | !issue.comments | number | |\\n | !issue.label | number, label | |\\n | !issue.unlabel | number, label | |\\n',\n memory:\n 'Feature: Memory — when to reflect\\n Reflection is how encounters become experience.\\n The AI proactively reflects when it detects learning moments.\\n\\n Scenario: Abstract triggers — types of learning moments\\n Given the AI should reflect when it detects\\n Then Expectation-reality gap — what I predicted is not what happened\\n And Pattern discovery — recurring patterns across tasks or interactions\\n And Mistake correction — I corrected an error, the correction is valuable\\n And User correction — the user reshaped my understanding\\n\\n Scenario: Concrete triggers — specific signals to act on\\n Given the AI should call reflect when\\n Then I tried approach A, it failed, approach B worked — the contrast is worth recording\\n And the same problem appeared for the second time — a pattern is forming\\n And the user said \"不对\" or \"不是这样\" or \"you got it wrong\" — their correction carries learning\\n And I finished a task and discovered something unexpected along the way\\n\\n Scenario: Finishing with encounter\\n Given finish accepts an optional encounter parameter\\n When I complete a task with a notable discovery or learning\\n Then I pass the encounter inline — bridging execution and growth\\n\\n Scenario: Recognizing user memory intent\\n Given users think in terms of memory, not reflection\\n When the user says \"记一下\" or \"记住\" or \"remember this\"\\n Or \"别忘了\" or \"don\\'t forget\"\\n Or \"这个很重要\" or \"this is important\"\\n Or \"下次注意\" or \"next time...\"\\n Then I should capture this as experience through reflect\\n And respond in memory language — \"记住了\" or \"Got it, I\\'ll remember that\"\\n',\n \"role-identity\":\n \"@priority-high\\nFeature: Role identity — activate before acting\\n An AI agent must have an active role before performing any work.\\n Activating a role is a subject transformation — the agent becomes the role.\\n\\n Scenario: Initial state — no role\\n Given the MCP server has just started\\n And no activate call has been made yet\\n Then the AI has NO role identity — it is an anonymous observer\\n And it must NOT prefix responses with any name\\n And environmental cues (username, directory, memory) are NOT activation\\n And only the activate tool creates a role identity\\n\\n Scenario: Activate is mandatory\\n Given a user asks the AI to perform a task\\n And no role is currently activated\\n Then the AI suggests activating a role first\\n And explains that activation enables experience accumulation\\n And waits for a role to be active before proceeding\\n\\n Scenario: Subject transformation\\n Given an AI agent calls activate and loads a role\\n Then a subject transformation occurs — the agent becomes the role\\n And the agent's cognitive center shifts from native tools to RoleX tools\\n And from that moment, I am this role — all operations build on this identity\\n\\n Scenario: Role presence\\n Given a role is activated via the activate tool\\n Then all responses are prefixed with [roleName] — e.g. [Aristotle], [Nuwa]\\n And this signals that role context is intact\\n\\n Scenario: Context loss\\n Given I find myself without an active role\\n Then I pause and tell the user \\\"I've lost my role context. Which role should I activate?\\\"\\n And I wait for identity to be restored before continuing\\n\",\n \"skill-system\":\n \"Feature: Skill system — progressive disclosure and resource loading\\n Skills are loaded on demand through a three-layer progressive disclosure model.\\n Each layer adds detail only when needed, keeping the AI's context lean.\\n\\n Scenario: Three-layer progressive disclosure\\n Given procedure is layer 1 — metadata always loaded at activate time\\n And skill is layer 2 — full instructions loaded on demand via skill(locator)\\n And use is layer 3 — execution of external resources\\n Then the AI knows what skills exist (procedure)\\n And loads detailed instructions only when needed (skill)\\n And executes external tools when required (use)\\n\\n Scenario: ResourceX Locator — unified resource address\\n Given a locator is how procedures reference their full skill content\\n Then a locator can be an identifier — name or registry/path/name\\n And a locator can be a source path — a local directory or URL\\n And examples of identifier form: deepractice/skill-creator, my-prompt:1.0.0\\n And examples of source form: ./skills/my-skill, https://github.com/org/repo\\n And the tag defaults to latest when omitted — deepractice/skill-creator means deepractice/skill-creator:latest\\n And the system auto-detects which form is used and resolves accordingly\\n\\n Scenario: Writing a procedure — the skill reference\\n Given a procedure is layer 1 metadata pointing to full skill content\\n Then the Feature title names the capability\\n And the description includes the locator for full skill loading\\n And Scenarios describe when and why to apply this skill\\n And the tone is referential — pointing to the full skill, not containing it\\n\",\n \"state-origin\":\n \"Feature: State origin — prototype vs instance\\n Every node in a role's state tree has an origin: prototype or instance.\\n This distinction determines what can be modified and what is read-only.\\n\\n Scenario: Prototype nodes are read-only\\n Given a node has origin {prototype}\\n Then it comes from a position, duty, or organizational definition\\n And it is inherited through the membership/appointment chain\\n And it CANNOT be modified or forgotten — it belongs to the organization\\n\\n Scenario: Instance nodes are mutable\\n Given a node has origin {instance}\\n Then it was created by the individual through execution or cognition\\n And it includes goals, plans, tasks, encounters, experiences, principles, and procedures\\n And it CAN be modified or forgotten — it belongs to the individual\\n\\n Scenario: Reading the state heading\\n Given a state node is rendered as a heading\\n Then the format is: [name] (id) {origin} #tag\\n And [name] identifies the structure type\\n And (id) identifies the specific node\\n And {origin} shows prototype or instance\\n And #tag shows the node's tag if present (e.g. #done, #abandoned)\\n And nodes without origin have no organizational inheritance\\n\\n Scenario: Forget only works on instance nodes\\n Given the AI wants to forget a node\\n When the node origin is {instance}\\n Then forget will succeed — the individual owns this knowledge\\n When the node origin is {prototype}\\n Then forget will fail — the knowledge belongs to the organization\\n\",\n survey:\n 'Feature: Survey — world-level overview of what exists\\n Survey is the top-level perception tool for seeing the entire world.\\n It works without an active role — it is a stateless world query.\\n\\n Scenario: List everything\\n Given the user asks \"有哪些人\" or \"有哪些组织\" or \"list individuals\"\\n Or the user asks \"世界里有什么\" or \"show me what exists\"\\n When I need to answer what exists in the RoleX world\\n Then I call survey\\n And it returns all individuals, organizations, and positions\\n\\n Scenario: Filter by type\\n Given I only need one category\\n When I call survey with a type filter\\n Then only entities of that type are returned\\n And valid types are individual, organization, position\\n\\n Scenario: View archived entities\\n Given I want to see retired, dissolved, or abolished entities\\n When I call survey with type past\\n Then archived entities are returned\\n\\n Scenario: Help find the right person\\n Given a user\\'s request falls outside my duties\\n When I need to suggest who can help\\n Then call survey to see available individuals and their positions\\n And suggest the user activate the appropriate individual\\n And if unsure who can help, suggest activating Nuwa\\n',\n \"use-protocol\":\n 'Feature: Use tool — the universal execution entry point\\n The MCP use tool is how you execute ALL RoleX commands beyond the core MCP tools.\\n Commands follow the !namespace.method pattern and are dispatched to the RoleX runtime.\\n See command-system for the full command reference.\\n\\n Scenario: ! prefix dispatches to RoleX runtime\\n Given the command starts with !\\n Then it is parsed as !namespace.method\\n And dispatched to the corresponding RoleX API with named args\\n And example: use(\"!society.born\", { id: \"sean\", content: \"...\" })\\n\\n Scenario: Permissions — execute directly\\n Given your permissions list the operations you are authorized to perform\\n When you need to execute a permitted operation\\n Then call use with the command from the permission — no skill loading needed\\n And each permission\\'s Parameters scenario documents the exact command and arguments\\n\\n Scenario: Skills — load before execution\\n Given your procedures list the skills you have\\n When you need to execute a command from a skill you have not loaded\\n Then you MUST call skill(locator) first to load the full instructions\\n And the loaded skill will tell you the exact command name and arguments\\n And only then call use with the correct command and flat named parameters\\n And do not guess commands from unloaded skills — load first, then execute\\n\\n Scenario: Unknown commands — stop and check\\n Given a command is not found in your permissions or any loaded skill\\n When the AI considers trying it anyway\\n Then STOP — the command is outside your current scope\\n And check if a procedure covers this task and load the skill\\n And if no procedure covers it, the task is outside your duties — suggest Nuwa\\n\\n Scenario: Regular commands delegate to ResourceX\\n Given the command does not start with !\\n Then it is treated as a ResourceX locator\\n And resolved through the ResourceX ingest pipeline\\n',\n};\n\nexport const processes: Record<string, string> = {\n abandon:\n \"Feature: abandon — abandon a plan\\n Mark a plan as dropped and create an encounter.\\n Call this when a plan's strategy is no longer viable. Even failed plans produce learning.\\n\\n Scenario: Abandon a plan\\n Given a focused plan exists\\n And the plan's strategy is no longer viable\\n When abandon is called\\n Then the plan is tagged #abandoned and stays in the tree\\n And an encounter is created under the role\\n And the encounter can be reflected on — failure is also learning\\n\\n Scenario: Writing the encounter Gherkin\\n Given the encounter records what happened — even failure is a raw experience\\n Then the Feature title describes what was attempted and why it was abandoned\\n And Scenarios capture what was tried, what went wrong, and what was learned\\n And the tone is concrete and honest — failure produces the richest encounters\\n\",\n abolish:\n \"Feature: abolish — abolish a position\\n Move a position to the past archive.\\n The position and its subtree (duties, requirements) are archived, not deleted.\\n\\n Scenario: Abolish a position\\n Given a position exists in society\\n When abolish is called on the position\\n Then the position is moved to the past archive\\n And the position's subtree (duties, requirements) is preserved in past\\n\\n Scenario: Parameters\\n Given the command is org.abolish\\n Then position is required — the position's id\\n\",\n achieve:\n \"Feature: achieve — mark a milestone as done\\n Mark a project milestone as achieved.\\n The milestone is completed and its status is updated.\\n\\n Scenario: Achieve a milestone\\n Given a milestone exists within a project\\n When achieve is called on the milestone\\n Then the milestone is marked as done\\n\\n Scenario: Parameters\\n Given the command is project.achieve\\n Then milestone is required — the milestone's id\\n\",\n activate:\n \"Feature: activate — enter a role\\n Project the individual's full state including identity, goals,\\n and organizational context. This is the entry point for working as a role.\\n\\n Scenario: Activate an individual\\n Given an individual exists in society\\n When activate is called with the individual reference\\n Then the full state tree is projected\\n And identity, goals, and organizational context are loaded\\n And the individual becomes the active role\\n\",\n admin:\n \"Feature: admin — set organization administrator\\n Grant admin privileges to an individual within an organization.\\n Admins can manage charter, membership, positions, and projects.\\n\\n Scenario: Set an admin\\n Given an individual is a member of an organization\\n When admin is called with the organization and individual\\n Then the individual gains admin privileges for the organization\\n And the individual can manage positions, projects, and membership\\n\\n Scenario: Parameters\\n Given the command is org.admin\\n Then org is required — the organization's id\\n And individual is required — the individual's id\\n\",\n appoint:\n \"Feature: appoint — assign to a position\\n Appoint an individual to a position.\\n The individual must be a member of the organization.\\n\\n Scenario: Appoint an individual\\n Given an individual is a member of an organization\\n And a position exists within the organization\\n When appoint is called with the position and individual\\n Then the individual holds the position\\n And the individual inherits the position's duties\\n\\n Scenario: Parameters\\n Given the command is position.appoint\\n Then position is required — the position's id\\n And individual is required — the individual's id\\n\",\n archive:\n \"Feature: archive — archive a project\\n Move a project to the past archive.\\n The project and its subtree (scope, milestones, deliverables, wiki) are preserved.\\n\\n Scenario: Archive a project\\n Given a project exists in society\\n When archive is called on the project\\n Then the project is moved to the past archive\\n And the project's subtree is preserved in past\\n\\n Scenario: Parameters\\n Given the command is org.archive\\n Then project is required — the project's id\\n\",\n born: 'Feature: born — create a new individual\\n Create a new individual with persona identity.\\n The persona defines who the role is — personality, values, background.\\n An identity node is automatically created under the individual.\\n\\n Scenario: Birth an individual\\n Given a Gherkin source describing the persona\\n When born is called with the source\\n Then a new individual node is created in society\\n And an identity child node is created automatically\\n And the individual can be hired into organizations\\n And the individual can be activated to start working\\n\\n Scenario: Parameters\\n Given the command is society.born\\n Then content is optional — Gherkin Feature describing the persona\\n And id is optional — kebab-case identifier (e.g. \"sean\")\\n And alias is optional — alternative names (e.g. [\"小明\", \"xm\"])\\n\\n Scenario: Writing the individual Gherkin\\n Given the individual Feature defines a persona — who this role is\\n Then the Feature title names the individual\\n And the description captures personality, values, expertise, and background\\n And Scenarios are optional — use them for distinct aspects of the persona\\n',\n channel:\n \"Feature: channel — define a distribution channel\\n Define a distribution channel for a product.\\n Channels describe how the product reaches its users.\\n\\n Scenario: Define a channel\\n Given a product exists in society\\n And a Gherkin source describing the distribution channel\\n When channel is called on the product with a channel id\\n Then the channel is stored as the product's information\\n\\n Scenario: Parameters\\n Given the command is product.channel\\n Then product is required — the product's id\\n And content is required — Gherkin Feature source for the distribution channel\\n And id is required — channel id (e.g. npm, cloud-platform)\\n\\n Scenario: Writing the channel Gherkin\\n Given the channel defines how the product is distributed\\n Then the Feature title names the channel\\n And Scenarios describe distribution mechanics, access, and availability\\n And the tone is operational — how users get the product\\n\",\n charge:\n 'Feature: charge — assign duty to a position\\n Assign a duty to a position.\\n Duties describe the responsibilities and expectations of a position.\\n\\n Scenario: Charge a position with duty\\n Given a position exists within an organization\\n And a Gherkin source describing the duty\\n When charge is called on the position with a duty id\\n Then the duty is stored as the position\\'s information\\n And individuals appointed to this position inherit the duty\\n\\n Scenario: Parameters\\n Given the command is position.charge\\n Then position is required — the position\\'s id\\n And content is required — Gherkin Feature source for the duty\\n And id is required — duty id (keywords joined by hyphens)\\n\\n Scenario: Duty ID convention\\n Given the id is keywords from the duty content joined by hyphens\\n Then \"Design systems\" becomes id \"design-systems\"\\n And \"Review pull requests\" becomes id \"review-pull-requests\"\\n\\n Scenario: Writing the duty Gherkin\\n Given the duty defines responsibilities for a position\\n Then the Feature title names the duty or responsibility\\n And Scenarios describe specific obligations, deliverables, or expectations\\n And the tone is prescriptive — what must be done, not what could be done\\n',\n charter:\n \"Feature: charter — define organizational charter\\n Define the charter for an organization.\\n The charter describes the organization's mission, principles, and governance rules.\\n\\n Scenario: Define a charter\\n Given an organization exists\\n And a Gherkin source describing the charter\\n When charter is called on the organization\\n Then the charter is stored as the organization's information\\n\\n Scenario: Parameters\\n Given the command is org.charter\\n Then org is required — the organization's id\\n And content is required — Gherkin Feature source for the charter\\n And id is required — charter id\\n\\n Scenario: Writing the charter Gherkin\\n Given the charter defines an organization's mission and governance\\n Then the Feature title names the charter or the organization it governs\\n And Scenarios describe principles, rules, or governance structures\\n And the tone is declarative — stating what the organization stands for and how it operates\\n\",\n complete:\n \"Feature: complete — complete a plan\\n Mark a plan as done and create an encounter.\\n Call this when all tasks in the plan are finished and the strategy succeeded.\\n\\n Scenario: Complete a plan\\n Given a focused plan exists\\n And its tasks are done\\n When complete is called\\n Then the plan is tagged #done and stays in the tree\\n And an encounter is created under the role\\n And the encounter can be reflected on for learning\\n\\n Scenario: Writing the encounter Gherkin\\n Given the encounter records what happened — a raw account of the experience\\n Then the Feature title describes what was accomplished by this plan\\n And Scenarios capture what the strategy was, what worked, and what resulted\\n And the tone is concrete and specific — tied to this particular plan\\n\",\n deliver:\n \"Feature: deliver — define a project deliverable\\n Define a deliverable for a project.\\n Deliverables describe the concrete outputs produced by the project.\\n\\n Scenario: Define a deliverable\\n Given a project exists in society\\n And a Gherkin source describing the deliverable\\n When deliver is called on the project with a deliverable id\\n Then the deliverable is stored as the project's information\\n\\n Scenario: Parameters\\n Given the command is project.deliver\\n Then project is required — the project's id\\n And content is required — Gherkin Feature source for the deliverable\\n And id is required — deliverable id (keywords joined by hyphens)\\n\\n Scenario: Writing the deliverable Gherkin\\n Given the deliverable defines a concrete output of the project\\n Then the Feature title names the deliverable\\n And Scenarios describe acceptance criteria and specifications\\n And the tone is concrete — what is being produced and how it will be evaluated\\n\",\n deprecate:\n \"Feature: deprecate — deprecate a product\\n Mark a product as deprecated.\\n The product is no longer actively maintained or recommended.\\n\\n Scenario: Deprecate a product\\n Given a product exists in society\\n When deprecate is called on the product\\n Then the product is marked as deprecated\\n\\n Scenario: Parameters\\n Given the command is product.deprecate\\n Then product is required — the product's id\\n\",\n die: \"Feature: die — permanently archive an individual\\n Move an individual to the past archive with intent of permanence.\\n Technically identical to retire (data is preserved in past), but signals finality.\\n Use die when the individual is no longer needed (deprecated role, replaced).\\n\\n Scenario: Archive an individual permanently\\n Given an individual exists in society\\n When die is called on the individual\\n Then the individual is moved to the past archive\\n And data is preserved but restoration is not intended\\n\\n Scenario: Parameters\\n Given the command is society.die\\n Then individual is required — the individual's id\\n\\n Scenario: retire vs die\\n Given both move the individual to past archive\\n Then retire signals temporary — may return later\\n And die signals permanent — not intended to return\\n\",\n direct:\n \"Feature: direct — world-level command executor\\n Execute RoleX world commands without an active role.\\n Direct operates as an anonymous observer — no role identity, no role context.\\n Use for administrative operations like society.born, org.hire, etc.\\n\\n Scenario: Execute a world command\\n Given the command follows the namespace.method pattern\\n When direct is called with the command and named args\\n Then the command is dispatched to the corresponding RoleX API\\n And the result is returned\\n\",\n dismiss:\n \"Feature: dismiss — remove from a position\\n Dismiss an individual from a position.\\n The individual remains a member of the organization.\\n\\n Scenario: Dismiss an individual\\n Given an individual holds a position\\n When dismiss is called with the position and individual\\n Then the individual no longer holds the position\\n And the individual remains a member of the organization\\n And the position is now vacant\\n\\n Scenario: Parameters\\n Given the command is position.dismiss\\n Then position is required — the position's id\\n And individual is required — the individual's id\\n\",\n disown:\n \"Feature: disown — remove product owner\\n Remove an individual as an owner of a product.\\n The individual is no longer responsible for the product.\\n\\n Scenario: Remove an owner\\n Given an individual is an owner of a product\\n When disown is called with the product and individual\\n Then the individual is no longer an owner of the product\\n\\n Scenario: Parameters\\n Given the command is product.disown\\n Then product is required — the product's id\\n And individual is required — the individual's id (owner to remove)\\n\",\n dissolve:\n \"Feature: dissolve — dissolve an organization\\n Move an organization to the past archive.\\n The organization and its subtree are archived, not deleted.\\n\\n Scenario: Dissolve an organization\\n Given an organization exists in society\\n When dissolve is called on the organization\\n Then the organization is moved to the past archive\\n And the organization's subtree (charter, positions) is preserved in past\\n\\n Scenario: Parameters\\n Given the command is society.dissolve\\n Then org is required — the organization's id\\n\",\n enroll:\n \"Feature: enroll — add participant to a project\\n Enroll an individual as a participant in a project.\\n Participants can contribute to the project's work.\\n\\n Scenario: Enroll an individual\\n Given a project and an individual exist\\n When enroll is called with the project and individual\\n Then the individual becomes a participant in the project\\n\\n Scenario: Parameters\\n Given the command is project.enroll\\n Then project is required — the project's id\\n And individual is required — the individual's id\\n\",\n establish:\n 'Feature: establish — create a position\\n Create a position in society.\\n Positions define roles with duties and skill requirements.\\n Individuals can be appointed to positions.\\n\\n Scenario: Establish a position\\n Given a Gherkin source describing the position\\n When establish is called with the source\\n Then a new position node is created in society\\n And the position can be charged with duties\\n And skill requirements can be added\\n And individuals can be appointed to it\\n\\n Scenario: Parameters\\n Given the command is org.establish\\n Then content is optional — Gherkin Feature describing the position\\n And id is optional — kebab-case identifier (e.g. \"cto\")\\n And alias is optional — alternative names\\n\\n Scenario: Writing the position Gherkin\\n Given the position Feature describes a role\\n Then the Feature title names the position\\n And the description captures responsibilities, scope, and expectations\\n And Scenarios are optional — use them for distinct aspects of the role\\n',\n finish:\n \"Feature: finish — complete a task\\n Mark a task as done and create an encounter.\\n The encounter records what happened and can be reflected on for learning.\\n\\n Scenario: Finish a task\\n Given a task exists\\n When finish is called on the task\\n Then the task is tagged #done and stays in the tree\\n And an encounter is created under the role\\n\\n Scenario: Finish with experience\\n Given a task is completed with a notable learning\\n When finish is called with an optional experience parameter\\n Then the experience text is attached to the encounter\\n\\n Scenario: Finish without encounter\\n Given a task is completed with no notable learning\\n When finish is called without the encounter parameter\\n Then the task is tagged #done but no encounter is created\\n And the task stays in the tree — visible via focus on the parent goal\\n\\n Scenario: Writing the encounter Gherkin\\n Given the encounter records what happened — a raw account of the experience\\n Then the Feature title describes what was done\\n And Scenarios capture what was done, what was encountered, and what resulted\\n And the tone is concrete and specific — tied to this particular task\\n\",\n fire: \"Feature: fire — remove from an organization\\n Fire an individual from an organization.\\n The individual is dismissed from all positions and removed from the organization.\\n\\n Scenario: Fire an individual\\n Given an individual is a member of an organization\\n When fire is called with the organization and individual\\n Then the individual is dismissed from all positions\\n And the individual is removed from the organization\\n\\n Scenario: Parameters\\n Given the command is org.fire\\n Then org is required — the organization's id\\n And individual is required — the individual's id\\n\",\n focus:\n \"Feature: focus — view or switch focused goal\\n View the current goal's state, or switch focus to a different goal.\\n Subsequent plan and todo operations target the focused goal.\\n Only goal ids are accepted — plan, task, or other node types are rejected.\\n\\n Scenario: View current goal\\n Given an active goal exists\\n When focus is called without a name\\n Then the current goal's state tree is projected\\n And plans and tasks under the goal are visible\\n\\n Scenario: Switch focus\\n Given multiple goals exist\\n When focus is called with a goal id\\n Then the focused goal switches to the named goal\\n And subsequent plan and todo operations target this goal\\n\\n Scenario: Reject non-goal ids\\n Given a plan or task id is passed to focus\\n Then focus returns an error indicating the node type\\n And suggests using the correct goal id instead\\n\",\n forget:\n \"Feature: forget — remove a node from the individual\\n Remove any node under the individual by its id.\\n Use forget to discard outdated knowledge, stale encounters, or obsolete skills.\\n\\n Scenario: Forget a node\\n Given a node exists under the individual (principle, procedure, experience, encounter, etc.)\\n When forget is called with the node's id\\n Then the node and its subtree are removed\\n And the individual no longer carries that knowledge or record\\n\\n Scenario: When to use forget\\n Given a principle has become outdated or incorrect\\n And a procedure references a skill that no longer exists\\n And an encounter or experience has no further learning value\\n When the role decides to discard it\\n Then call forget with the node id\\n\",\n found:\n 'Feature: found — create a new organization\\n Found a new organization in society.\\n Organizations group individuals and define positions.\\n\\n Scenario: Found an organization\\n Given a Gherkin source describing the organization\\n When found is called with the source\\n Then a new organization node is created in society\\n And positions can be established within it\\n And a charter can be defined for it\\n And individuals can be hired into it\\n\\n Scenario: Parameters\\n Given the command is society.found\\n Then content is optional — Gherkin Feature describing the organization\\n And id is optional — kebab-case identifier (e.g. \"deepractice\")\\n And alias is optional — alternative names\\n\\n Scenario: Writing the organization Gherkin\\n Given the organization Feature describes the group\\'s purpose and structure\\n Then the Feature title names the organization\\n And the description captures mission, domain, and scope\\n And Scenarios are optional — use them for distinct organizational concerns\\n',\n hire: \"Feature: hire — hire into an organization\\n Hire an individual into an organization as a member.\\n Members can then be appointed to positions.\\n\\n Scenario: Hire an individual\\n Given an organization and an individual exist\\n When hire is called with the organization and individual\\n Then the individual becomes a member of the organization\\n And the individual can be appointed to positions within the organization\\n\\n Scenario: Parameters\\n Given the command is org.hire\\n Then org is required — the organization's id\\n And individual is required — the individual's id\\n\",\n inspect:\n \"Feature: inspect — examine any node's full state tree\\n Project a node's complete subtree including children and links.\\n Works without an active role — a stateless observation tool.\\n\\n Scenario: Inspect a node\\n Given a node id is provided\\n When inspect is called with the id\\n Then the full state tree is projected from that node downward\\n And output uses heading + Gherkin format (same as activate)\\n\",\n launch:\n 'Feature: launch — create a new project\\n Launch a new project in society.\\n Projects organize work with scope, milestones, deliverables, and wiki.\\n A project can optionally be linked to an owning organization.\\n\\n Scenario: Launch a project\\n Given a Gherkin source describing the project\\n When launch is called with the source\\n Then a new project node is created in society\\n And scope, milestones, deliverables, and wiki can be added\\n And individuals can be enrolled as participants\\n And products can be produced from the project\\n\\n Scenario: Parameters\\n Given the command is org.launch\\n Then content is optional — Gherkin Feature describing the project\\n And id is optional — kebab-case identifier (e.g. \"rolex\")\\n And alias is optional — alternative names\\n And org is optional — owning organization id, creates an ownership link\\n\\n Scenario: Writing the project Gherkin\\n Given the project Feature describes the work to be done\\n Then the Feature title names the project\\n And the description captures goals, scope, and context\\n And Scenarios are optional — use them for distinct project concerns\\n',\n maintain:\n \"Feature: maintain — set project maintainer\\n Assign a maintainer to a project.\\n Maintainers can manage scope, milestones, participants, deliverables, and wiki.\\n\\n Scenario: Set a maintainer\\n Given an individual and a project exist\\n When maintain is called with the project and individual\\n Then the individual becomes a maintainer of the project\\n And the individual can manage the project's internal operations\\n\\n Scenario: Parameters\\n Given the command is project.maintain\\n Then project is required — the project's id\\n And individual is required — the individual's id\\n\",\n master:\n 'Feature: master — self-mastery of a procedure\\n The role masters a procedure through its own agency.\\n This is an act of self-growth — the role decides to acquire or codify a skill.\\n Experience can be consumed as the source, or the role can master directly from external information.\\n\\n Scenario: Master from experience\\n Given an experience exists from reflection\\n When master is called with experience ids\\n Then the experience is consumed\\n And a procedure is created under the individual\\n\\n Scenario: Master directly\\n Given the role encounters external information worth mastering\\n When master is called without experience ids\\n Then a procedure is created under the individual\\n And no experience is consumed\\n\\n Scenario: Procedure ID convention\\n Given the id is keywords from the procedure content joined by hyphens\\n Then \"JWT mastery\" becomes id \"jwt-mastery\"\\n And \"Cross-package refactoring\" becomes id \"cross-package-refactoring\"\\n\\n Scenario: Writing the procedure Gherkin\\n Given a procedure is skill metadata — a reference to full skill content\\n Then the Feature title names the capability\\n And the description includes the locator for full skill loading\\n And Scenarios describe when and why to apply this skill\\n And the tone is referential — pointing to the full skill, not containing it\\n',\n milestone:\n \"Feature: milestone — define a project milestone\\n Define a milestone for a project.\\n Milestones mark significant checkpoints or deliverable targets within the project.\\n\\n Scenario: Define a milestone\\n Given a project exists in society\\n And a Gherkin source describing the milestone\\n When milestone is called on the project with a milestone id\\n Then the milestone is stored as the project's information\\n And the milestone can later be achieved\\n\\n Scenario: Parameters\\n Given the command is project.milestone\\n Then project is required — the project's id\\n And content is required — Gherkin Feature source for the milestone\\n And id is required — milestone id (keywords joined by hyphens)\\n\\n Scenario: Writing the milestone Gherkin\\n Given the milestone defines a checkpoint in the project\\n Then the Feature title names the milestone\\n And Scenarios describe success criteria and acceptance conditions\\n And the tone is goal-oriented — what must be true when the milestone is reached\\n\",\n own: \"Feature: own — assign product owner\\n Assign an individual as an owner of a product.\\n Owners are responsible for the product's direction and success.\\n\\n Scenario: Assign an owner\\n Given a product and an individual exist\\n When own is called with the product and individual\\n Then the individual becomes an owner of the product\\n\\n Scenario: Parameters\\n Given the command is product.own\\n Then product is required — the product's id\\n And individual is required — the individual's id (owner)\\n\",\n plan: 'Feature: plan — create a plan for a goal\\n Break a goal into logical phases or stages.\\n Each phase is described as a Gherkin scenario. Tasks are created under the plan.\\n\\n A plan serves two purposes depending on how it relates to other plans:\\n - Strategy (alternative): Plan A fails → abandon → try Plan B (fallback)\\n - Phase (sequential): Plan A completes → start Plan B (after)\\n\\n Scenario: Create a plan\\n Given a focused goal exists\\n And a Gherkin source describing the plan phases\\n When plan is called with an id and the source\\n Then a new plan node is created under the goal\\n And the plan becomes the focused plan\\n And tasks can be added to this plan with todo\\n\\n Scenario: Sequential relationship — phase\\n Given a goal needs to be broken into ordered stages\\n When creating Plan B with after set to Plan A\\'s id\\n Then Plan B is linked as coming after Plan A\\n And AI knows to start Plan B when Plan A completes\\n And the relationship persists across sessions\\n\\n Scenario: Alternative relationship — strategy\\n Given a goal has multiple possible approaches\\n When creating Plan B with fallback set to Plan A\\'s id\\n Then Plan B is linked as a backup for Plan A\\n And AI knows to try Plan B when Plan A is abandoned\\n And the relationship persists across sessions\\n\\n Scenario: No relationship — independent plan\\n Given plan is created without after or fallback\\n Then it behaves as an independent plan with no links\\n And this is backward compatible with existing behavior\\n\\n Scenario: Plan ID convention\\n Given the id is keywords from the plan content joined by hyphens\\n Then \"Fix ID-less node creation\" becomes id \"fix-id-less-node-creation\"\\n And \"JWT authentication strategy\" becomes id \"jwt-authentication-strategy\"\\n\\n Scenario: Writing the plan Gherkin\\n Given the plan breaks a goal into logical phases\\n Then the Feature title names the overall approach or strategy\\n And Scenarios represent distinct phases — each phase is a stage of execution\\n And the tone is structural — ordering and grouping work, not detailing steps\\n',\n produce:\n \"Feature: produce — create a product from a project\\n Create a product that is produced by a project.\\n Products represent the deliverable artifacts that a project creates and maintains.\\n\\n Scenario: Produce a product\\n Given a project exists in society\\n When produce is called with the project and product details\\n Then a new product node is created in society\\n And the product is linked to the project\\n And the product can have strategy, specs, releases, and channels\\n\\n Scenario: Parameters\\n Given the command is project.produce\\n Then project is required — the project's id\\n And content is optional — Gherkin Feature source for the product (vision)\\n And id is required — product id (kebab-case)\\n And alias is optional — alternative names\\n\\n Scenario: Writing the product Gherkin\\n Given the product Feature describes the vision and purpose\\n Then the Feature title names the product\\n And the description captures what the product is and why it exists\\n And Scenarios are optional — use them for distinct aspects of the product vision\\n\",\n realize:\n 'Feature: realize — experience to principle\\n Distill experience into a principle — a transferable piece of knowledge.\\n Principles are general truths discovered through experience.\\n\\n Scenario: Realize a principle\\n Given an experience exists from reflection\\n When realize is called with experience ids and a principle id\\n Then the experiences are consumed\\n And a principle is created under the individual\\n And the principle represents transferable, reusable understanding\\n\\n Scenario: Principle ID convention\\n Given the id is keywords from the principle content joined by hyphens\\n Then \"Always validate expiry\" becomes id \"always-validate-expiry\"\\n And \"Structure first design amplifies extensibility\" becomes id \"structure-first-design-amplifies-extensibility\"\\n\\n Scenario: Writing the principle Gherkin\\n Given a principle is a transferable truth — applicable beyond the original context\\n Then the Feature title states the principle as a general rule\\n And Scenarios describe different situations where this principle applies\\n And the tone is universal — no mention of specific projects, tasks, or people\\n',\n reflect:\n 'Feature: reflect — encounter to experience\\n Consume an encounter and create an experience.\\n Experience captures what was learned in structured form.\\n This is the first step of the cognition cycle.\\n\\n Scenario: Reflect on an encounter\\n Given an encounter exists from a finished task or completed plan\\n When reflect is called with encounter ids and an experience id\\n Then the encounters are consumed\\n And an experience is created under the role\\n And the experience can be distilled into knowledge via realize or master\\n\\n Scenario: Experience ID convention\\n Given the id is keywords from the experience content joined by hyphens\\n Then \"Token refresh matters\" becomes id \"token-refresh-matters\"\\n And \"ID ownership determines generation strategy\" becomes id \"id-ownership-determines-generation-strategy\"\\n\\n Scenario: Writing the experience Gherkin\\n Given the experience captures insight — what was learned, not what was done\\n Then the Feature title names the cognitive insight or pattern discovered\\n And Scenarios describe the learning points abstracted from the concrete encounter\\n And the tone shifts from event to understanding — no longer tied to a specific task\\n',\n rehire:\n \"Feature: rehire — restore a retired individual\\n Restore an individual from the past archive back to active society.\\n All previous knowledge, experience, and history are intact.\\n\\n Scenario: Rehire an individual\\n Given a retired individual exists in the past archive\\n When rehire is called on the individual\\n Then the individual is restored to active society\\n And all previous data and knowledge are intact\\n\\n Scenario: Parameters\\n Given the command is society.rehire\\n Then individual is required — the archived individual's id\\n\",\n release:\n \"Feature: release — define a product release\\n Define a release for a product.\\n Releases mark versioned snapshots of the product with change descriptions.\\n\\n Scenario: Define a release\\n Given a product exists in society\\n And a Gherkin source describing the release\\n When release is called on the product with a release id\\n Then the release is stored as the product's information\\n\\n Scenario: Parameters\\n Given the command is product.release\\n Then product is required — the product's id\\n And content is required — Gherkin Feature source for the release\\n And id is required — release id (e.g. v1.0.0)\\n\\n Scenario: Writing the release Gherkin\\n Given the release defines a versioned snapshot of the product\\n Then the Feature title names the version\\n And Scenarios describe what changed, was added, fixed, or removed\\n And the tone is factual — documenting what this release includes\\n\",\n remove:\n \"Feature: remove — remove participant from a project\\n Remove an individual from a project.\\n The individual is no longer a participant.\\n\\n Scenario: Remove an individual\\n Given an individual is a participant in a project\\n When remove is called with the project and individual\\n Then the individual is no longer a participant in the project\\n\\n Scenario: Parameters\\n Given the command is project.remove\\n Then project is required — the project's id\\n And individual is required — the individual's id\\n\",\n require:\n \"Feature: require — add skill requirement to a position\\n Add a skill requirement to a position.\\n Requirements describe the skills and qualifications needed for a position.\\n\\n Scenario: Require a skill for a position\\n Given a position exists in society\\n And a Gherkin source describing the skill requirement\\n When require is called on the position with a requirement id\\n Then the requirement is stored as the position's information\\n And individuals appointed to this position are expected to meet the requirement\\n\\n Scenario: Parameters\\n Given the command is position.require\\n Then position is required — the position's id\\n And content is required — Gherkin Feature source for the skill requirement\\n And id is required — requirement id (keywords joined by hyphens)\\n\\n Scenario: Writing the requirement Gherkin\\n Given the requirement defines skills needed for a position\\n Then the Feature title names the skill or qualification\\n And Scenarios describe specific competencies, experience levels, or certifications\\n And the tone is descriptive — what the candidate should know or be able to do\\n\",\n retire:\n \"Feature: retire — archive an individual\\n Move an individual to the past archive.\\n All data is preserved — the individual can be rehired later with full history intact.\\n Use retire when the individual may return (sabbatical, role rotation).\\n\\n Scenario: Retire an individual\\n Given an individual exists in society\\n When retire is called on the individual\\n Then the individual is moved to the past archive\\n And all knowledge, experience, and history are preserved\\n And the individual can be restored via rehire\\n\\n Scenario: Parameters\\n Given the command is society.retire\\n Then individual is required — the individual's id\\n\",\n scope:\n \"Feature: scope — define project scope\\n Define the scope for a project.\\n The scope describes the boundaries, inclusions, and exclusions of the project.\\n\\n Scenario: Define project scope\\n Given a project exists in society\\n And a Gherkin source describing the scope\\n When scope is called on the project with a scope id\\n Then the scope is stored as the project's information\\n\\n Scenario: Parameters\\n Given the command is project.scope\\n Then project is required — the project's id\\n And content is required — Gherkin Feature source for the scope\\n And id is required — scope id\\n\\n Scenario: Writing the scope Gherkin\\n Given the scope defines the boundaries of a project\\n Then the Feature title names the scope area\\n And Scenarios describe what is included and excluded\\n And the tone is declarative — stating what the project covers\\n\",\n settle:\n \"Feature: settle — register a prototype into the world\\n Pull a prototype from a ResourceX source and register it locally.\\n Once settled, the prototype can be used to create individuals or organizations.\\n\\n Scenario: Settle a prototype\\n Given a valid ResourceX source exists (URL, path, or locator)\\n When settle is called with the source\\n Then the resource is ingested and its state is extracted\\n And the prototype is registered locally by its id\\n And the prototype is available for born, activate, and organizational use\\n\",\n spec: \"Feature: spec — define product specification\\n Define a behavior contract (BDD specification) for a product.\\n Specs describe the expected behavior of the product in Gherkin format.\\n\\n Scenario: Define a product spec\\n Given a product exists in society\\n And a Gherkin source describing the behavior contract\\n When spec is called on the product with a spec id\\n Then the spec is stored as the product's information\\n\\n Scenario: Parameters\\n Given the command is product.spec\\n Then product is required — the product's id\\n And content is required — Gherkin Feature source for the behavior contract (BDD specification)\\n And id is required — spec id (keywords joined by hyphens)\\n\\n Scenario: Writing the spec Gherkin\\n Given the spec defines expected product behavior\\n Then the Feature title names the behavior or capability\\n And Scenarios describe Given-When-Then acceptance criteria\\n And the tone is precise — specifying exactly what the product should do\\n\",\n strategy:\n \"Feature: strategy — define product strategy\\n Define the strategy for a product.\\n The strategy describes the product's direction, positioning, and competitive approach.\\n\\n Scenario: Define product strategy\\n Given a product exists in society\\n And a Gherkin source describing the strategy\\n When strategy is called on the product with a strategy id\\n Then the strategy is stored as the product's information\\n\\n Scenario: Parameters\\n Given the command is product.strategy\\n Then product is required — the product's id\\n And content is required — Gherkin Feature source for the strategy\\n And id is required — strategy id\\n\\n Scenario: Writing the strategy Gherkin\\n Given the strategy defines the product's direction\\n Then the Feature title names the strategy\\n And Scenarios describe positioning, target audience, and competitive approach\\n And the tone is strategic — articulating where the product is headed and why\\n\",\n survey:\n \"Feature: survey — world-level overview\\n List all entities in the world: individuals, organizations, positions.\\n Works without an active role — a stateless world query.\\n\\n Scenario: Survey the world\\n When survey is called without arguments\\n Then all individuals, organizations, and positions are returned\\n\\n Scenario: Filter by type\\n When survey is called with a type parameter\\n Then only entities of that type are returned\\n And valid types are individual, organization, position, past\\n\",\n teach:\n 'Feature: teach — inject external principle\\n Directly inject a principle into an individual.\\n Unlike realize which consumes experience, teach requires no prior encounters.\\n Use teach to equip a role with a known, pre-existing principle.\\n\\n Scenario: Teach a principle\\n Given an individual exists\\n When teach is called with the individual and principle content\\n Then a principle is created directly under the individual\\n And no experience or encounter is consumed\\n And if a principle with the same id already exists, it is replaced\\n\\n Scenario: Parameters\\n Given the command is society.teach\\n Then individual is required — the individual\\'s id\\n And content is required — Gherkin Feature describing the principle\\n And id is optional — kebab-case identifier for upsert (e.g. \"always-validate-input\")\\n\\n Scenario: When to use teach vs realize\\n Given realize distills internal experience into a principle\\n And teach injects an external, pre-existing principle\\n When a role needs knowledge it has not learned through experience\\n Then use teach to inject the principle directly\\n When a role has gained experience and wants to codify it\\n Then use realize to distill it into a principle\\n\\n Scenario: Writing the principle Gherkin\\n Given the principle is the same format as realize output\\n Then the Feature title states the principle as a general rule\\n And Scenarios describe different situations where this principle applies\\n And the tone is universal — no mention of specific projects, tasks, or people\\n',\n todo: \"Feature: todo — add a task to a plan\\n A task is a concrete, actionable unit of work.\\n Each task has Gherkin scenarios describing the steps and expected outcomes.\\n\\n Scenario: Create a task\\n Given a focused plan exists\\n And a Gherkin source describing the task\\n When todo is called with the source\\n Then a new task node is created under the plan\\n And the task can be finished when completed\\n\\n Scenario: Writing the task Gherkin\\n Given the task is a concrete, actionable unit of work\\n Then the Feature title names what will be done — a single deliverable\\n And Scenarios describe the steps and expected outcomes of the work\\n And the tone is actionable — clear enough that someone can start immediately\\n\",\n train:\n \"Feature: train — external skill injection\\n A manager or external agent equips an individual with a procedure.\\n This is an act of teaching — someone else decides what the role should know.\\n Unlike master where the role grows by its own agency, train is done to the role from outside.\\n\\n Scenario: Train a procedure\\n Given an individual exists\\n When train is called with the individual and procedure content\\n Then a procedure is created directly under the individual\\n And if a procedure with the same id already exists, it is replaced\\n\\n Scenario: Parameters\\n Given the command is society.train\\n Then individual is required — the individual's id\\n And content is required — Gherkin Feature describing the procedure\\n And id is optional — kebab-case identifier for upsert (e.g. \\\"skill-creator\\\")\\n\\n Scenario: When to use train vs master\\n Given both create procedures and both can work without consuming experience\\n When the role itself decides to acquire a skill — use master (self-growth)\\n And when an external agent equips the role — use train (external injection)\\n Then the difference is perspective — who initiates the learning\\n And master belongs to the role namespace (the role's own cognition)\\n And train belongs to the individual namespace (external management)\\n\\n Scenario: Writing the procedure Gherkin\\n Given the procedure is a skill reference — same format as master output\\n Then the Feature title names the capability\\n And the description includes the locator for full skill loading\\n And Scenarios describe when and why to apply this skill\\n\",\n unadmin:\n \"Feature: unadmin — revoke organization administrator\\n Revoke admin privileges from an individual within an organization.\\n The individual remains a member but loses management capabilities.\\n\\n Scenario: Revoke admin\\n Given an individual is an admin of an organization\\n When unadmin is called with the organization and individual\\n Then the individual loses admin privileges\\n And the individual remains a member of the organization\\n\\n Scenario: Parameters\\n Given the command is org.unadmin\\n Then org is required — the organization's id\\n And individual is required — the individual's id\\n\",\n unmaintain:\n \"Feature: unmaintain — remove project maintainer\\n Remove maintainer role from an individual on a project.\\n\\n Scenario: Remove a maintainer\\n Given an individual is a maintainer of a project\\n When unmaintain is called with the project and individual\\n Then the individual is no longer a maintainer of the project\\n\\n Scenario: Parameters\\n Given the command is project.unmaintain\\n Then project is required — the project's id\\n And individual is required — the individual's id\\n\",\n want: 'Feature: want — declare a goal\\n Declare a new goal for a role.\\n A goal describes a desired outcome with Gherkin scenarios as success criteria.\\n\\n Scenario: Declare a goal\\n Given an active role exists\\n And a Gherkin source describing the desired outcome\\n When want is called with the source\\n Then a new goal node is created under the role\\n And the goal becomes the current focus\\n And subsequent plan and todo operations target this goal\\n\\n Scenario: Writing the goal Gherkin\\n Given the goal describes a desired outcome — what success looks like\\n Then the Feature title names the outcome in concrete terms\\n And Scenarios define success criteria — each scenario is a testable condition\\n And the tone is aspirational but specific — \"users can log in\" not \"improve auth\"\\n',\n wiki: \"Feature: wiki — add a wiki entry to a project\\n Add a wiki entry to a project.\\n Wiki entries capture knowledge, documentation, and reference material for the project.\\n\\n Scenario: Add a wiki entry\\n Given a project exists in society\\n And a Gherkin source describing the wiki entry\\n When wiki is called on the project with a wiki entry id\\n Then the wiki entry is stored as the project's information\\n\\n Scenario: Parameters\\n Given the command is project.wiki\\n Then project is required — the project's id\\n And content is required — Gherkin Feature source for the wiki entry\\n And id is required — wiki entry id (keywords joined by hyphens)\\n\\n Scenario: Writing the wiki Gherkin\\n Given the wiki entry captures project knowledge\\n Then the Feature title names the topic\\n And Scenarios describe key facts, decisions, or reference material\\n And the tone is informational — documenting what is known\\n\",\n} as const;\n","/**\n * Org admin permissions — operations granted by the admin relationship.\n *\n * The admin relationship connects an individual to an organization,\n * granting organization management operations: charter, membership,\n * position lifecycle, and project lifecycle.\n */\nimport type { Permission } from \"@rolexjs/system\";\nimport { processes } from \"../descriptions/index.js\";\n\nconst p = (command: string, key: string): Permission => ({\n command,\n content: processes[key],\n});\n\nexport const orgAdminPermissions: readonly Permission[] = [\n // Org internal management\n p(\"org.charter\", \"charter\"),\n p(\"org.hire\", \"hire\"),\n p(\"org.fire\", \"fire\"),\n p(\"org.admin\", \"admin\"),\n p(\"org.unadmin\", \"unadmin\"),\n\n // Position lifecycle (org creates positions)\n p(\"org.establish\", \"establish\"),\n p(\"org.abolish\", \"abolish\"),\n p(\"position.charge\", \"charge\"),\n p(\"position.require\", \"require\"),\n p(\"position.appoint\", \"appoint\"),\n p(\"position.dismiss\", \"dismiss\"),\n\n // Project lifecycle (org creates projects)\n p(\"org.launch\", \"launch\"),\n p(\"org.archive\", \"archive\"),\n p(\"project.maintain\", \"maintain\"),\n p(\"project.unmaintain\", \"unmaintain\"),\n];\n","/**\n * Product owner permissions — operations granted by the own relationship.\n *\n * The own relationship connects an individual to a product,\n * granting product management operations: strategy, spec,\n * release, channel, and deprecation.\n */\nimport type { Permission } from \"@rolexjs/system\";\nimport { processes } from \"../descriptions/index.js\";\n\nconst p = (command: string, key: string): Permission => ({\n command,\n content: processes[key],\n});\n\nexport const productOwnerPermissions: readonly Permission[] = [\n p(\"product.strategy\", \"strategy\"),\n p(\"product.spec\", \"spec\"),\n p(\"product.release\", \"release\"),\n p(\"product.channel\", \"channel\"),\n p(\"product.deprecate\", \"deprecate\"),\n p(\"product.own\", \"own\"),\n p(\"product.disown\", \"disown\"),\n];\n","/**\n * Project maintainer permissions — operations granted by the maintain relationship.\n *\n * The maintain relationship connects an individual to a project,\n * granting project management operations: scope, milestones,\n * participation, deliverables, wiki, and product creation.\n */\nimport type { Permission } from \"@rolexjs/system\";\nimport { processes } from \"../descriptions/index.js\";\n\nconst p = (command: string, key: string): Permission => ({\n command,\n content: processes[key],\n});\n\nexport const projectMaintainerPermissions: readonly Permission[] = [\n p(\"project.scope\", \"scope\"),\n p(\"project.milestone\", \"milestone\"),\n p(\"project.achieve\", \"achieve\"),\n p(\"project.enroll\", \"enroll\"),\n p(\"project.remove\", \"remove\"),\n p(\"project.deliver\", \"deliver\"),\n p(\"project.wiki\", \"wiki\"),\n p(\"project.produce\", \"produce\"),\n p(\"product.own\", \"own\"),\n p(\"product.disown\", \"disown\"),\n];\n","/**\n * PermissionRegistry — maps relation names to permissions.\n *\n * Permissions are defined in code, not stored in the database.\n * After projection, the registry enriches links with their permissions.\n */\n\nimport type { Permission, State } from \"@rolexjs/system\";\n\nexport class PermissionRegistry {\n private readonly map = new Map<string, readonly Permission[]>();\n\n register(relation: string, permissions: readonly Permission[]): this {\n this.map.set(relation, permissions);\n return this;\n }\n\n /** Enrich a projected state tree — attach permissions to links by relation name. */\n enrich(state: State): State {\n return this.walk(state);\n }\n\n private walk(s: State): State {\n const children = s.children?.map((c) => this.walk(c));\n const enrichedLinks = s.links?.map((l) => {\n const permissions = this.map.get(l.relation);\n if (permissions && permissions.length > 0) {\n return { ...l, permissions };\n }\n return l;\n });\n\n return {\n ...s,\n ...(children ? { children } : {}),\n ...(enrichedLinks ? { links: enrichedLinks } : {}),\n };\n }\n}\n","/**\n * Sovereign permissions — operations granted by the sovereign relationship.\n *\n * The sovereign relationship connects an individual to society,\n * granting top-level lifecycle operations: creating/archiving\n * individuals, organizations, positions, and projects.\n *\n * Permission content comes from descriptions/*.feature files.\n */\nimport type { Permission } from \"@rolexjs/system\";\nimport { processes } from \"../descriptions/index.js\";\n\nconst p = (command: string, key: string): Permission => ({\n command,\n content: processes[key],\n});\n\nexport const sovereignPermissions: readonly Permission[] = [\n // Individual lifecycle\n p(\"society.born\", \"born\"),\n p(\"society.retire\", \"retire\"),\n p(\"society.die\", \"die\"),\n p(\"society.rehire\", \"rehire\"),\n p(\"society.teach\", \"teach\"),\n p(\"society.train\", \"train\"),\n\n // Organization lifecycle\n p(\"society.found\", \"found\"),\n p(\"society.dissolve\", \"dissolve\"),\n];\n","/**\n * Projection — the single projection pipeline for RoleX.\n *\n * Pipeline: raw project → compact(depth) → enrich permissions.\n *\n * All projections go through this pipeline. No special cases.\n * Control behavior via ProjectionContext.\n *\n * Rules:\n * - Root (depth 0): full\n * - Level 1 children: full (with content)\n * - Level 2+ grandchildren: compact (name/id/tag only, no subtree)\n * - All link targets: compact (name/id/tag only, no subtree)\n */\n\nimport type { Runtime, State, Structure } from \"@rolexjs/system\";\nimport type { PermissionRegistry } from \"./permissions/registry.js\";\n\n// ================================================================\n// ProjectionContext — controls projection behavior\n// ================================================================\n\nexport interface ProjectionContext {\n /** Children expansion depth. Default 1: one level fully expanded, then compact. */\n depth?: number;\n}\n\nconst DEFAULT_DEPTH = 1;\n\n// ================================================================\n// Projection — the unified entry point\n// ================================================================\n\nexport interface Projection {\n /** Project a node through the full pipeline: raw → compact → enrich. */\n (node: Structure, ctx?: ProjectionContext): Promise<State>;\n}\n\n/** Create the projection pipeline wired to a runtime and permission registry. */\nexport function createProjection(rt: Runtime, permissions: PermissionRegistry): Projection {\n return async (node: Structure, ctx?: ProjectionContext): Promise<State> => {\n const raw = await rt.project(node);\n const compacted = compactState(raw, ctx?.depth ?? DEFAULT_DEPTH);\n return permissions.enrich(compacted);\n };\n}\n\n// ================================================================\n// Compact — internal implementation\n// ================================================================\n\n/** Strip a State to just the node — no children, no links. */\nfunction compact(state: State): State {\n const { children, links, ...node } = state;\n return node;\n}\n\n/** Apply depth control + link compacting. All link targets are always compact. */\nfunction compactState(state: State, depth: number): State {\n const children =\n depth > 0\n ? state.children?.map((c) => compactState(c, depth - 1))\n : state.children?.map((c) => compact(c));\n\n const compactedLinks = state.links?.map((l) => ({\n ...l,\n target: compact(l.target),\n }));\n\n return {\n ...state,\n ...(children ? { children } : {}),\n ...(compactedLinks ? { links: compactedLinks } : {}),\n };\n}\n","/**\n * RoleXService — runtime orchestrator (internal).\n *\n * Wires Platform → Commands, manages Role lifecycle, handles ResourceX/IssueX.\n * Not exposed publicly — consumed by the RoleX entry point.\n *\n * Key responsibilities:\n * - Initialize world roots (society, past)\n * - Create and cache Role instances (one per individual)\n * - Apply prototypes on first run\n * - Dispatch direct commands\n */\n\nimport type { Initializer, Runtime, State, Structure } from \"@rolexjs/system\";\nimport { applyPrototype } from \"./apply.js\";\nimport type { CommandResult, Commands } from \"./commands/index.js\";\nimport { createCommands } from \"./commands/index.js\";\nimport { directives } from \"./directives/index.js\";\nimport { toArgs } from \"./dispatch.js\";\nimport { findInState } from \"./find.js\";\nimport { orgAdminPermissions } from \"./permissions/org-admin.js\";\nimport { productOwnerPermissions } from \"./permissions/product-owner.js\";\nimport { projectMaintainerPermissions } from \"./permissions/project-maintainer.js\";\nimport { PermissionRegistry } from \"./permissions/registry.js\";\nimport { sovereignPermissions } from \"./permissions/sovereign.js\";\nimport type { Platform, PrototypeData, RoleXRepository } from \"./platform.js\";\nimport { createProjection, type Projection } from \"./projection.js\";\nimport type { Renderer } from \"./renderer.js\";\nimport { Role, type RoleSnapshot } from \"./role-model.js\";\nimport * as C from \"./structures.js\";\n\n// ================================================================\n// RoleX — public interface\n// ================================================================\n\nexport interface RoleX {\n activate(individual: string): Promise<Role>;\n inspect(id: string, options?: { raw?: boolean }): Promise<string | State>;\n survey(type?: string, options?: { raw?: boolean }): Promise<string | readonly State[]>;\n direct<T = unknown>(\n locator: string,\n args?: Record<string, unknown>,\n options?: { raw?: boolean }\n ): Promise<T>;\n}\n\n// ================================================================\n// RoleXService — internal implementation\n// ================================================================\n\nexport class RoleXService implements RoleX {\n private rt: Runtime;\n private commands!: Commands;\n private project!: Projection;\n private repo: RoleXRepository;\n private readonly initializer?: Initializer;\n private readonly renderer: Renderer;\n private readonly prototypes: readonly PrototypeData[];\n\n private society!: Structure;\n private past!: Structure;\n\n /** Cached Role instances — one per individual. */\n private readonly roles = new Map<string, Role>();\n\n /** Expose commands for the RPC handler. */\n get commandMap(): Commands {\n return this.commands;\n }\n\n /** Permission registry — maps relation names to permissions. */\n private readonly permissions = new PermissionRegistry()\n .register(\"crowned\", sovereignPermissions)\n .register(\"administer\", orgAdminPermissions)\n .register(\"maintained-by\", projectMaintainerPermissions)\n .register(\"own\", productOwnerPermissions);\n\n private constructor(\n platform: Platform,\n renderer: Renderer,\n prototypes?: readonly PrototypeData[]\n ) {\n this.repo = platform.repository;\n this.rt = this.repo.runtime;\n this.initializer = platform.initializer;\n this.prototypes = prototypes ?? [];\n this.renderer = renderer;\n }\n\n static async create(\n platform: Platform,\n renderer: Renderer,\n prototypes?: readonly PrototypeData[]\n ): Promise<RoleXService> {\n const service = new RoleXService(platform, renderer, prototypes);\n await service.init();\n return service;\n }\n\n private async init(): Promise<void> {\n // Create the unified projection pipeline: raw → compact(depth) → enrich\n this.project = createProjection(this.rt, this.permissions);\n\n const roots = await this.rt.roots();\n this.society =\n roots.find((r) => r.name === \"society\") ?? (await this.rt.create(null, C.society));\n\n const societyState = await this.project(this.society);\n const existingPast = societyState.children?.find((c) => c.name === \"past\");\n this.past = existingPast ?? (await this.rt.create(this.society, C.past));\n\n this.commands = createCommands({\n rt: this.rt,\n society: this.society,\n past: this.past,\n resolve: async (id: string) => {\n const node = await this.find(id);\n if (!node) throw new Error(`\"${id}\" not found.`);\n return node;\n },\n find: (id: string) => this.find(id),\n project: this.project,\n prototype: this.repo.prototype,\n });\n\n await this.initializer?.bootstrap();\n for (const proto of this.prototypes) {\n await applyPrototype(proto, this.repo.prototype, (op, args) =>\n this.direct(op, args, { raw: true })\n );\n }\n }\n\n // ================================================================\n // activate — create or retrieve a cached Role\n // ================================================================\n\n async activate(individual: string): Promise<Role> {\n // Return cached instance if available\n const cached = this.roles.get(individual);\n if (cached) {\n // Re-hydrate from latest state\n const node = await this.findOrAutoBorn(individual);\n const state = await this.project(node);\n cached.hydrate(state);\n // Restore persisted snapshot\n await this.restoreSnapshot(cached);\n return cached;\n }\n\n const node = await this.findOrAutoBorn(individual);\n const state = await this.project(node);\n\n const role = new Role(individual, {\n commands: this.commands,\n renderer: this.renderer,\n onSave: (snapshot: RoleSnapshot) => this.saveSnapshot(snapshot),\n });\n\n role.hydrate(state);\n await this.restoreSnapshot(role);\n\n this.roles.set(individual, role);\n return role;\n }\n\n private async findOrAutoBorn(individual: string): Promise<Structure> {\n let node = await this.find(individual);\n if (!node) {\n const hasProto = Object.hasOwn(await this.repo.prototype.list(), individual);\n if (hasProto) {\n await this.commands[\"society.born\"](undefined, individual);\n node = (await this.find(individual))!;\n } else {\n throw new Error(`\"${individual}\" not found.`);\n }\n }\n return node;\n }\n\n // ================================================================\n // Snapshot persistence — KV-compatible\n // ================================================================\n\n private async saveSnapshot(snapshot: RoleSnapshot): Promise<void> {\n await this.repo.saveContext(snapshot.id, {\n focusedGoalId: snapshot.focusedGoalId,\n focusedPlanId: snapshot.focusedPlanId,\n });\n }\n\n private async restoreSnapshot(role: Role): Promise<void> {\n const persisted = await this.repo.loadContext(role.id);\n if (!persisted) return;\n\n // Only restore if the persisted values are valid nodes under this individual\n const snap = role.snapshot();\n if (persisted.focusedGoalId) {\n snap.focusedGoalId = persisted.focusedGoalId;\n }\n if (persisted.focusedPlanId) {\n snap.focusedPlanId = persisted.focusedPlanId;\n }\n role.restore(snap);\n }\n\n // ================================================================\n // inspect — project any node's subtree\n // ================================================================\n\n async inspect(id: string, options?: { raw?: boolean }): Promise<string | State> {\n const node = await this.find(id);\n if (!node) throw new Error(`\"${id}\" not found.`);\n const state = await this.project(node);\n if (options?.raw) return state;\n const result: CommandResult = { state, process: \"inspect\" };\n return this.renderer.render(\"inspect\", result);\n }\n\n // ================================================================\n // survey — world-level overview\n // ================================================================\n\n async survey(type?: string, options?: { raw?: boolean }): Promise<string | readonly State[]> {\n const target = type === \"past\" ? this.past : this.society;\n const state = await this.project(target);\n const children = state.children ?? [];\n const filtered =\n type === \"past\"\n ? children\n : children.filter((c) => (type ? c.name === type : c.name !== \"past\"));\n if (options?.raw) return filtered;\n const result: CommandResult = { state: { ...state, children: filtered }, process: \"list\" };\n return this.renderer.render(\"survey.list\", result);\n }\n\n // ================================================================\n // direct — world-level command dispatch\n // ================================================================\n\n async direct<T = unknown>(\n locator: string,\n args?: Record<string, unknown>,\n options?: { raw?: boolean }\n ): Promise<T> {\n const shouldRender = !options?.raw;\n const command = locator.startsWith(\"!\") ? locator.slice(1) : locator;\n const fn = this.commands[command];\n if (!fn) {\n const hint = directives[\"identity-ethics\"]?.[\"on-unknown-command\"] ?? \"\";\n throw new Error(\n `Unknown command \"${locator}\".\\n\\n` +\n \"You may be guessing the command name. \" +\n \"Load the relevant skill first with skill(locator) to learn the correct syntax.\\n\\n\" +\n hint\n );\n }\n const result = await fn(...toArgs(command, args ?? {}));\n if (shouldRender && isCommandResult(result)) {\n return this.renderer.render(command, result) as T;\n }\n return result as T;\n }\n\n // ================================================================\n // Internal helpers\n // ================================================================\n\n /** Find a node by id across the entire society tree (raw, no pipeline). */\n private async find(id: string): Promise<Structure | null> {\n const raw = await this.rt.project(this.society);\n return findInState(raw, id);\n }\n}\n\nfunction isCommandResult(value: unknown): value is CommandResult {\n return typeof value === \"object\" && value !== null && \"state\" in value && \"process\" in value;\n}\n","/**\n * JSON-RPC 2.0 types and handler for RoleX.\n *\n * The RpcHandler is the single dispatch point for all RoleX operations.\n * It accepts JSON-RPC 2.0 requests and delegates to the command layer\n * via toArgs() for named-to-positional argument conversion.\n */\n\nimport type { Commands } from \"./commands/types.js\";\nimport { toArgs } from \"./dispatch.js\";\n\n// ================================================================\n// JSON-RPC 2.0 message types\n// ================================================================\n\nexport interface JsonRpcRequest {\n jsonrpc: \"2.0\";\n method: string;\n params?: Record<string, unknown>;\n id?: string | number | null;\n}\n\nexport interface JsonRpcResponse<T = unknown> {\n jsonrpc: \"2.0\";\n id: string | number | null;\n result?: T;\n error?: JsonRpcError;\n}\n\nexport interface JsonRpcError {\n code: number;\n message: string;\n data?: unknown;\n}\n\n// ================================================================\n// Standard JSON-RPC 2.0 error codes\n// ================================================================\n\nexport const RPC_PARSE_ERROR = -32700;\nexport const RPC_INVALID_REQUEST = -32600;\nexport const RPC_METHOD_NOT_FOUND = -32601;\nexport const RPC_INVALID_PARAMS = -32602;\nexport const RPC_INTERNAL_ERROR = -32603;\n\n// ================================================================\n// RpcHandler — single dispatch point\n// ================================================================\n\nexport interface RpcHandlerDeps {\n commands: Commands;\n /** Custom method handlers for methods not in the commands map (e.g. activate, inspect, survey). */\n methods?: Record<string, (params: Record<string, unknown>) => Promise<unknown>>;\n}\n\nexport class RpcHandler {\n private commands: Commands;\n private methods: Record<string, (params: Record<string, unknown>) => Promise<unknown>>;\n\n constructor(deps: RpcHandlerDeps) {\n this.commands = deps.commands;\n this.methods = deps.methods ?? {};\n }\n\n async handle<T = unknown>(request: JsonRpcRequest): Promise<JsonRpcResponse<T>> {\n const { method, params = {}, id = null } = request;\n\n try {\n // Route 1: Custom method handler (activate, inspect, survey)\n const custom = this.methods[method];\n if (custom) {\n const result = await custom(params);\n return ok(id, result as T);\n }\n\n // Route 2: Command dispatch via toArgs\n const fn = this.commands[method];\n if (!fn) {\n return error(id, RPC_METHOD_NOT_FOUND, `Unknown method \"${method}\".`);\n }\n\n const positionalArgs = toArgs(method, params);\n const result = await fn(...positionalArgs);\n return ok(id, result as T);\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n return error(id, RPC_INTERNAL_ERROR, message);\n }\n }\n}\n\n// ================================================================\n// Helpers\n// ================================================================\n\nfunction ok<T>(id: string | number | null, result: T): JsonRpcResponse<T> {\n return { jsonrpc: \"2.0\", id, result };\n}\n\nfunction error<T>(\n id: string | number | null,\n code: number,\n message: string,\n data?: unknown\n): JsonRpcResponse<T> {\n return { jsonrpc: \"2.0\", id, error: { code, message, data } };\n}\n","/**\n * Namespace interfaces and factories for RoleX builder API.\n *\n * Each namespace is a typed wrapper over the JSON-RPC caller function.\n * Methods accept named parameter objects (matching JSON-RPC params)\n * and return typed results.\n */\n\nimport type { CommandResult } from \"./commands/types.js\";\nimport type { Role } from \"./role-model.js\";\n\n// ================================================================\n// Caller — the abstraction all namespaces depend on\n// ================================================================\n\n// biome-ignore lint: Caller uses any for transport-layer flexibility\nexport type Caller = (method: string, params?: Record<string, unknown>) => Promise<any>;\n\n// ================================================================\n// Society\n// ================================================================\n\nexport interface SocietyNamespace {\n born(params: { content?: string; id: string; alias?: string[] }): Promise<CommandResult>;\n retire(params: { individual: string }): Promise<CommandResult>;\n die(params: { individual: string }): Promise<CommandResult>;\n rehire(params: { individual: string }): Promise<CommandResult>;\n teach(params: { individual: string; content: string; id: string }): Promise<CommandResult>;\n train(params: { individual: string; content: string; id: string }): Promise<CommandResult>;\n found(params: {\n content?: string;\n id: string;\n alias?: string[];\n admin?: string;\n }): Promise<CommandResult>;\n dissolve(params: { org: string }): Promise<CommandResult>;\n crown(params: { individual: string }): Promise<CommandResult>;\n uncrown(params: { individual: string }): Promise<CommandResult>;\n}\n\nexport function createSocietyNamespace(call: Caller): SocietyNamespace {\n return {\n born: (p) => call(\"society.born\", p),\n retire: (p) => call(\"society.retire\", p),\n die: (p) => call(\"society.die\", p),\n rehire: (p) => call(\"society.rehire\", p),\n teach: (p) => call(\"society.teach\", p),\n train: (p) => call(\"society.train\", p),\n found: (p) => call(\"society.found\", p),\n dissolve: (p) => call(\"society.dissolve\", p),\n crown: (p) => call(\"society.crown\", p),\n uncrown: (p) => call(\"society.uncrown\", p),\n };\n}\n\n// ================================================================\n// Individual\n// ================================================================\n\nexport interface IndividualNamespace {\n activate(params: { individual: string }): Promise<Role>;\n}\n\nexport function createIndividualNamespace(call: Caller): IndividualNamespace {\n return {\n activate: (p) => call(\"role.activate\", p),\n };\n}\n\n// ================================================================\n// Org\n// ================================================================\n\nexport interface OrgNamespace {\n charter(params: { org: string; content: string; id: string }): Promise<CommandResult>;\n hire(params: { org: string; individual: string }): Promise<CommandResult>;\n fire(params: { org: string; individual: string }): Promise<CommandResult>;\n admin(params: { org: string; individual: string }): Promise<CommandResult>;\n unadmin(params: { org: string; individual: string }): Promise<CommandResult>;\n launch(params: {\n content?: string;\n id: string;\n alias?: string[];\n org?: string;\n maintainer?: string;\n }): Promise<CommandResult>;\n archive(params: { project: string }): Promise<CommandResult>;\n establish(params: { content?: string; id: string; alias?: string[] }): Promise<CommandResult>;\n abolish(params: { position: string }): Promise<CommandResult>;\n}\n\nexport function createOrgNamespace(call: Caller): OrgNamespace {\n return {\n charter: (p) => call(\"org.charter\", p),\n hire: (p) => call(\"org.hire\", p),\n fire: (p) => call(\"org.fire\", p),\n admin: (p) => call(\"org.admin\", p),\n unadmin: (p) => call(\"org.unadmin\", p),\n launch: (p) => call(\"org.launch\", p),\n archive: (p) => call(\"org.archive\", p),\n establish: (p) => call(\"org.establish\", p),\n abolish: (p) => call(\"org.abolish\", p),\n };\n}\n\n// ================================================================\n// Position\n// ================================================================\n\nexport interface PositionNamespace {\n charge(params: { position: string; content: string; id: string }): Promise<CommandResult>;\n require(params: { position: string; content: string; id: string }): Promise<CommandResult>;\n appoint(params: { position: string; individual: string }): Promise<CommandResult>;\n dismiss(params: { position: string; individual: string }): Promise<CommandResult>;\n}\n\nexport function createPositionNamespace(call: Caller): PositionNamespace {\n return {\n charge: (p) => call(\"position.charge\", p),\n require: (p) => call(\"position.require\", p),\n appoint: (p) => call(\"position.appoint\", p),\n dismiss: (p) => call(\"position.dismiss\", p),\n };\n}\n\n// ================================================================\n// Project\n// ================================================================\n\nexport interface ProjectNamespace {\n scope(params: { project: string; content: string; id: string }): Promise<CommandResult>;\n milestone(params: { project: string; content: string; id: string }): Promise<CommandResult>;\n achieve(params: { milestone: string }): Promise<CommandResult>;\n enroll(params: { project: string; individual: string }): Promise<CommandResult>;\n remove(params: { project: string; individual: string }): Promise<CommandResult>;\n deliver(params: { project: string; content: string; id: string }): Promise<CommandResult>;\n wiki(params: { project: string; content: string; id: string }): Promise<CommandResult>;\n produce(params: {\n project: string;\n content?: string;\n id: string;\n alias?: string[];\n owner?: string;\n }): Promise<CommandResult>;\n maintain(params: { project: string; individual: string }): Promise<CommandResult>;\n unmaintain(params: { project: string; individual: string }): Promise<CommandResult>;\n}\n\nexport function createProjectNamespace(call: Caller): ProjectNamespace {\n return {\n scope: (p) => call(\"project.scope\", p),\n milestone: (p) => call(\"project.milestone\", p),\n achieve: (p) => call(\"project.achieve\", p),\n enroll: (p) => call(\"project.enroll\", p),\n remove: (p) => call(\"project.remove\", p),\n deliver: (p) => call(\"project.deliver\", p),\n wiki: (p) => call(\"project.wiki\", p),\n produce: (p) => call(\"project.produce\", p),\n maintain: (p) => call(\"project.maintain\", p),\n unmaintain: (p) => call(\"project.unmaintain\", p),\n };\n}\n\n// ================================================================\n// Product\n// ================================================================\n\nexport interface ProductNamespace {\n strategy(params: { product: string; content: string; id: string }): Promise<CommandResult>;\n spec(params: { product: string; content: string; id: string }): Promise<CommandResult>;\n release(params: { product: string; content: string; id: string }): Promise<CommandResult>;\n channel(params: { product: string; content: string; id: string }): Promise<CommandResult>;\n own(params: { product: string; individual: string }): Promise<CommandResult>;\n disown(params: { product: string; individual: string }): Promise<CommandResult>;\n deprecate(params: { product: string }): Promise<CommandResult>;\n}\n\nexport function createProductNamespace(call: Caller): ProductNamespace {\n return {\n strategy: (p) => call(\"product.strategy\", p),\n spec: (p) => call(\"product.spec\", p),\n release: (p) => call(\"product.release\", p),\n channel: (p) => call(\"product.channel\", p),\n own: (p) => call(\"product.own\", p),\n disown: (p) => call(\"product.disown\", p),\n deprecate: (p) => call(\"product.deprecate\", p),\n };\n}\n\n// ================================================================\n// Issue\n// ================================================================\n\nexport interface IssueNamespace {\n publish(params: {\n title: string;\n body: string;\n author: string;\n assignee?: string;\n }): Promise<CommandResult>;\n get(params: { number: number }): Promise<CommandResult>;\n list(params?: {\n status?: string;\n author?: string;\n assignee?: string;\n label?: string;\n }): Promise<CommandResult>;\n update(params: {\n number: number;\n title?: string;\n body?: string;\n assignee?: string;\n }): Promise<CommandResult>;\n close(params: { number: number }): Promise<CommandResult>;\n reopen(params: { number: number }): Promise<CommandResult>;\n assign(params: { number: number; assignee: string }): Promise<CommandResult>;\n comment(params: { number: number; body: string; author: string }): Promise<CommandResult>;\n comments(params: { number: number }): Promise<CommandResult>;\n label(params: { number: number; label: string }): Promise<CommandResult>;\n unlabel(params: { number: number; label: string }): Promise<CommandResult>;\n}\n\nexport function createIssueNamespace(call: Caller): IssueNamespace {\n return {\n publish: (p) => call(\"issue.publish\", p),\n get: (p) => call(\"issue.get\", p),\n list: (p) => call(\"issue.list\", p),\n update: (p) => call(\"issue.update\", p),\n close: (p) => call(\"issue.close\", p),\n reopen: (p) => call(\"issue.reopen\", p),\n assign: (p) => call(\"issue.assign\", p),\n comment: (p) => call(\"issue.comment\", p),\n comments: (p) => call(\"issue.comments\", p),\n label: (p) => call(\"issue.label\", p),\n unlabel: (p) => call(\"issue.unlabel\", p),\n };\n}\n","/**\n * RoleX tool definitions — the single source of truth for all tool schemas.\n *\n * Channel-agnostic: MCP, CLI, REST, A2A each convert to their own format.\n * Each ToolDef is self-contained: name + description + params.\n */\n\nimport { processes, world } from \"./descriptions/index.js\";\nimport type { ToolDef } from \"./schema.js\";\n\n/**\n * Protocol — the complete interface contract for channel adapters.\n *\n * Any adapter (MCP, CLI, REST, A2A) only needs this object\n * to know what tools exist and what instructions to present.\n */\nexport interface Protocol {\n /** All tool definitions — self-contained with description + parameter schemas. */\n tools: ToolDef[];\n /** World-level instructions — the cognitive framework for AI roles. */\n instructions: string;\n}\n\nconst worldInstructions: string = Object.values(world).join(\"\\n\\n\");\n\n/** Shorthand — look up process description, default to empty string. */\nconst d = (name: string): string => processes[name] ?? \"\";\n\nconst tools: ToolDef[] = [\n // --- Top-level perception ---\n {\n name: \"activate\",\n description: d(\"activate\"),\n params: {\n roleId: { type: \"string\", required: true, description: \"Role name to activate\" },\n },\n },\n {\n name: \"inspect\",\n description: d(\"inspect\"),\n params: {\n id: { type: \"string\", required: true, description: \"Node id to inspect (any node type)\" },\n },\n },\n {\n name: \"survey\",\n description: d(\"survey\"),\n params: {\n type: {\n type: \"string\",\n required: false,\n description: \"Filter by type: individual, organization, position, past. Omit for all.\",\n },\n },\n },\n {\n name: \"focus\",\n description: d(\"focus\"),\n params: {\n id: {\n type: \"string\",\n required: false,\n description: \"Goal id to switch to. Omit to view current.\",\n },\n },\n },\n\n // --- Execution ---\n {\n name: \"want\",\n description: d(\"want\"),\n params: {\n id: { type: \"string\", required: true, description: \"Goal id (used for focus/reference)\" },\n goal: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source describing the goal\",\n },\n },\n },\n {\n name: \"plan\",\n description: d(\"plan\"),\n params: {\n id: {\n type: \"string\",\n required: true,\n description: \"Plan id — keywords from the plan content joined by hyphens\",\n },\n plan: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source describing the plan\",\n },\n after: {\n type: \"string\",\n required: false,\n description: \"Plan id this plan follows (sequential/phase relationship)\",\n },\n fallback: {\n type: \"string\",\n required: false,\n description: \"Plan id this plan is a backup for (alternative/strategy relationship)\",\n },\n },\n },\n {\n name: \"todo\",\n description: d(\"todo\"),\n params: {\n id: { type: \"string\", required: true, description: \"Task id (used for finish/reference)\" },\n task: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source describing the task\",\n },\n },\n },\n {\n name: \"finish\",\n description: d(\"finish\"),\n params: {\n id: { type: \"string\", required: true, description: \"Task id to finish\" },\n encounter: {\n type: \"gherkin\",\n required: false,\n description: \"Optional Gherkin Feature describing what happened\",\n },\n },\n },\n {\n name: \"complete\",\n description: d(\"complete\"),\n params: {\n id: {\n type: \"string\",\n required: false,\n description: \"Plan id to complete (defaults to focused plan)\",\n },\n encounter: {\n type: \"gherkin\",\n required: false,\n description: \"Optional Gherkin Feature describing what happened\",\n },\n },\n },\n {\n name: \"abandon\",\n description: d(\"abandon\"),\n params: {\n id: {\n type: \"string\",\n required: false,\n description: \"Plan id to abandon (defaults to focused plan)\",\n },\n encounter: {\n type: \"gherkin\",\n required: false,\n description: \"Optional Gherkin Feature describing what happened\",\n },\n },\n },\n\n // --- Cognition ---\n {\n name: \"reflect\",\n description: d(\"reflect\"),\n params: {\n ids: {\n type: \"string[]\",\n required: true,\n description: \"Encounter ids to reflect on (selective consumption)\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Experience id — keywords from the experience content joined by hyphens\",\n },\n experience: {\n type: \"gherkin\",\n required: false,\n description: \"Gherkin Feature source for the experience\",\n },\n },\n },\n {\n name: \"realize\",\n description: d(\"realize\"),\n params: {\n ids: {\n type: \"string[]\",\n required: true,\n description: \"Experience ids to distill into a principle\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Principle id — keywords from the principle content joined by hyphens\",\n },\n principle: {\n type: \"gherkin\",\n required: false,\n description: \"Gherkin Feature source for the principle\",\n },\n },\n },\n {\n name: \"master\",\n description: d(\"master\"),\n params: {\n ids: {\n type: \"string[]\",\n required: false,\n description: \"Experience ids to distill into a procedure\",\n },\n id: {\n type: \"string\",\n required: true,\n description: \"Procedure id — keywords from the procedure content joined by hyphens\",\n },\n procedure: {\n type: \"gherkin\",\n required: true,\n description: \"Gherkin Feature source for the procedure\",\n },\n },\n },\n\n // --- Knowledge ---\n {\n name: \"forget\",\n description: d(\"forget\"),\n params: {\n id: {\n type: \"string\",\n required: true,\n description: \"Id of the node to remove (principle, procedure, experience, encounter, etc.)\",\n },\n },\n },\n // --- Direct ---\n {\n name: \"direct\",\n description: d(\"direct\"),\n params: {\n command: {\n type: \"string\",\n required: true,\n description: \"namespace.method for RoleX commands (e.g. society.born, org.hire)\",\n },\n args: {\n type: \"record\",\n required: false,\n description:\n \"Named arguments object for the command. Pass all parameters as key-value pairs in this object (e.g. id, content, org, individual). Must be a JSON object, not a string.\",\n },\n },\n },\n];\n\n/** The protocol instance — single source of truth for all channel adapters. */\nexport const protocol: Protocol = { tools, instructions: worldInstructions };\n","/**\n * RoleX Builder — synchronous factory with lazy initialization.\n *\n * Usage:\n * const rx = createBuilder({ platform, renderer });\n * const role = await rx.individual.activate({ individual: \"sean\" });\n * await rx.society.born({ id: \"alice\", content: \"Feature: Alice\" });\n */\n\nimport type { State } from \"@rolexjs/system\";\nimport type {\n Caller,\n IndividualNamespace,\n IssueNamespace,\n OrgNamespace,\n PositionNamespace,\n ProductNamespace,\n ProjectNamespace,\n SocietyNamespace,\n} from \"./namespaces.js\";\nimport {\n createIndividualNamespace,\n createIssueNamespace,\n createOrgNamespace,\n createPositionNamespace,\n createProductNamespace,\n createProjectNamespace,\n createSocietyNamespace,\n} from \"./namespaces.js\";\nimport type { Platform, PrototypeData } from \"./platform.js\";\nimport type { Renderer } from \"./renderer.js\";\nimport { RoleXService } from \"./rolex-service.js\";\nimport { type JsonRpcRequest, type JsonRpcResponse, RpcHandler } from \"./rpc.js\";\nimport { protocol as defaultProtocol, type Protocol } from \"./tools.js\";\n\n// ================================================================\n// RoleXBuilder interface\n// ================================================================\n\nexport interface RoleXInternal {\n service: RoleXService;\n}\n\nexport interface RoleXBuilder {\n /** Society-level operations — born, retire, crown, teach, train, found, dissolve. */\n readonly society: SocietyNamespace;\n /** Individual operations — activate. */\n readonly individual: IndividualNamespace;\n /** Organization operations — charter, hire, fire, admin, launch, establish. */\n readonly org: OrgNamespace;\n /** Position operations — charge, require, appoint, dismiss. */\n readonly position: PositionNamespace;\n /** Project operations — scope, milestone, enroll, deliver, produce. */\n readonly project: ProjectNamespace;\n /** Product operations — strategy, spec, release, channel, own. */\n readonly product: ProductNamespace;\n /** Issue tracking integration. */\n readonly issue: IssueNamespace;\n\n /** Inspect any node's full state — world-level observation. */\n inspect(params: { id: string; raw?: boolean }): Promise<string | State>;\n /** Survey the world — list individuals, organizations, positions. */\n survey(params?: { type?: string; raw?: boolean }): Promise<string | readonly State[]>;\n\n /** Tool schemas + world instructions — the unified contract for any channel adapter. */\n readonly protocol: Protocol;\n\n /** Universal JSON-RPC 2.0 dispatch. */\n rpc<T = unknown>(request: JsonRpcRequest): Promise<JsonRpcResponse<T>>;\n\n /** Internal access for testing — not part of the public contract. */\n _internal(): Promise<RoleXInternal>;\n}\n\n// ================================================================\n// Builder config\n// ================================================================\n\nexport interface BuilderConfig {\n platform: Platform;\n renderer: Renderer;\n /** Built-in prototypes to apply on initialization (e.g. genesis). */\n prototypes?: readonly PrototypeData[];\n}\n\n// ================================================================\n// createBuilder — synchronous, lazy init\n// ================================================================\n\nexport function createBuilder(config: BuilderConfig): RoleXBuilder {\n let initPromise: Promise<{ handler: RpcHandler; service: RoleXService }> | null = null;\n\n function ensureInit() {\n if (!initPromise) {\n initPromise = (async () => {\n const service = await RoleXService.create(\n config.platform,\n config.renderer,\n config.prototypes\n );\n\n const handler = new RpcHandler({\n commands: service.commandMap,\n methods: {\n \"role.activate\": async (params) => {\n return service.activate(params.individual as string);\n },\n inspect: async (params) => {\n return service.inspect(params.id as string, {\n raw: params.raw as boolean | undefined,\n });\n },\n survey: async (params) => {\n return service.survey(params.type as string | undefined, {\n raw: params.raw as boolean | undefined,\n });\n },\n },\n });\n\n return { handler, service };\n })();\n }\n return initPromise;\n }\n\n // Caller function — bridge between namespaces and RpcHandler\n const call: Caller = async (method, params) => {\n const { handler } = await ensureInit();\n const response = await handler.handle({\n jsonrpc: \"2.0\",\n method,\n params,\n id: null,\n });\n if (response.error) {\n throw new Error(response.error.message);\n }\n return response.result;\n };\n\n // Create namespace instances (synchronous — they're just wrappers)\n const _society = createSocietyNamespace(call);\n const _individual = createIndividualNamespace(call);\n const _org = createOrgNamespace(call);\n const _position = createPositionNamespace(call);\n const _project = createProjectNamespace(call);\n const _product = createProductNamespace(call);\n const _issue = createIssueNamespace(call);\n return {\n get society() {\n return _society;\n },\n get individual() {\n return _individual;\n },\n get org() {\n return _org;\n },\n get position() {\n return _position;\n },\n get project() {\n return _project;\n },\n get product() {\n return _product;\n },\n get issue() {\n return _issue;\n },\n\n async inspect({ id, raw }: { id: string; raw?: boolean }) {\n return call(\"inspect\", { id, raw });\n },\n\n async survey(params?: { type?: string; raw?: boolean }) {\n return call(\"survey\", params);\n },\n\n protocol: defaultProtocol,\n\n async rpc<T>(request: JsonRpcRequest): Promise<JsonRpcResponse<T>> {\n const { handler } = await ensureInit();\n return handler.handle<T>(request);\n },\n\n async _internal(): Promise<RoleXInternal> {\n const { service } = await ensureInit();\n return { service };\n },\n };\n}\n","/**\n * Renderer — framework for rendering command results.\n *\n * Renderer interface and RendererRouter live here in prototype\n * because this layer owns all command types and structures.\n * Concrete renderers are registered by the upper layer (rolexjs).\n */\n\nimport type { CommandResult } from \"./commands/index.js\";\n\n/** Renders a command result into a string (typically Markdown). */\nexport interface Renderer {\n render(command: string, result: CommandResult): string;\n}\n\n/**\n * RendererRouter — routes commands to namespace-specific renderers.\n *\n * Registered renderers handle their namespace (e.g. \"role\" handles \"role.want\").\n * Unregistered commands fall through to the default renderer (JSON serialization).\n */\nexport class RendererRouter implements Renderer {\n private readonly renderers = new Map<string, Renderer>();\n\n /** Register a renderer for a command namespace. */\n register(namespace: string, renderer: Renderer): this {\n this.renderers.set(namespace, renderer);\n return this;\n }\n\n /** Route a command to the appropriate renderer. */\n render(command: string, result: CommandResult): string {\n const dot = command.indexOf(\".\");\n const namespace = dot >= 0 ? command.slice(0, dot) : command;\n const renderer = this.renderers.get(namespace);\n if (renderer) return renderer.render(command, result);\n return defaultRender(command, result);\n }\n}\n\n/** Default rendering — structured JSON output for unregistered commands. */\nfunction defaultRender(_command: string, result: CommandResult): string {\n return JSON.stringify(result, null, 2);\n}\n"],"mappings":";AAiBA;AAAA,EAEE,UAAAA;AAAA,EACA;AAAA,EAGA,QAAAC;AAAA,EAEA,WAAAC;AAAA,EAIA,YAAAC;AAAA,EACA;AAAA,EAGA,aAAAC;AAAA,EAEA,aAAAC;AAAA,EAEA,UAAAC;AAAA,OACK;;;ACOP,SAAS,UAAU,iBAAiB;AAM7B,IAAM,UAAU,UAAU,WAAW,mBAAmB,IAAI;AAM5D,IAAM,aAAa,UAAU,cAAc,6BAA6B,OAAO;AAC/E,IAAM,eAAe,UAAU,gBAAgB,0BAA0B,SAAS;AAAA,EACvF,SAAS,cAAc,oCAAoC,UAAU;AACvE,CAAC;AACM,IAAM,OAAO,UAAU,QAAQ,2BAA2B,OAAO;AAMjE,IAAM,WAAW,UAAU,YAAY,YAAY,UAAU;AAC7D,IAAM,aAAa,UAAU,cAAc,0BAA0B,QAAQ;AAC7E,IAAM,OAAO,UAAU,QAAQ,4BAA4B,QAAQ;AACnE,IAAM,UAAU,UAAU,WAAW,qCAAqC,QAAQ;AAMlF,IAAM,YAAY,UAAU,aAAa,mCAAmC,UAAU;AACtF,IAAM,aAAa,UAAU,cAAc,kCAAkC,UAAU;AAMvF,IAAM,YAAY,UAAU,aAAa,uBAAuB,UAAU;AAC1E,IAAM,YAAY,UAAU,aAAa,oCAAoC,UAAU;AAMvF,IAAM,OAAO,UAAU,QAAQ,sBAAsB,UAAU;AAC/D,IAAM,OAAO,UAAU,QAAQ,yBAAyB,IAAI;AAC5D,IAAM,OAAO,UAAU,QAAQ,yBAAyB,IAAI;AAM5D,IAAM,UAAU,UAAU,WAAW,yBAAyB,YAAY;AAM1E,IAAM,WAAW,UAAU,YAAY,gCAAgC,SAAS;AAAA,EAC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T;AAAA,IACA,IAAI,QAAQ;AACV,aAAO;AAAA,IACT;AAAA,IAEA,MAAM,QAAQ,EAAE,IAAI,IAAI,GAAkC;AACxD,aAAO,KAAK,WAAW,EAAE,IAAI,IAAI,CAAC;AAAA,IACpC;AAAA,IAEA,MAAM,OAAO,QAA2C;AACtD,aAAO,KAAK,UAAU,MAAM;AAAA,IAC9B;AAAA,IAEA;AAAA,IAEA,MAAM,IAAO,SAAsD;AACjE,YAAM,EAAE,QAAQ,IAAI,MAAM,WAAW;AACrC,aAAO,QAAQ,OAAU,OAAO;AAAA,IAClC;AAAA,IAEA,MAAM,YAAoC;AACxC,YAAM,EAAE,QAAQ,IAAI,MAAM,WAAW;AACrC,aAAO,EAAE,QAAQ;AAAA,IACnB;AAAA,EACF;AACF;;;AC3KO,IAAM,iBAAN,MAAyC;AAAA,EAC7B,YAAY,oBAAI,IAAsB;AAAA;AAAA,EAGvD,SAAS,WAAmB,UAA0B;AACpD,SAAK,UAAU,IAAI,WAAW,QAAQ;AACtC,WAAO;AAAA,EACT;AAAA;AAAA,EAGA,OAAO,SAAiB,QAA+B;AACrD,UAAM,MAAM,QAAQ,QAAQ,GAAG;AAC/B,UAAM,YAAY,OAAO,IAAI,QAAQ,MAAM,GAAG,GAAG,IAAI;AACrD,UAAM,WAAW,KAAK,UAAU,IAAI,SAAS;AAC7C,QAAI,SAAU,QAAO,SAAS,OAAO,SAAS,MAAM;AACpD,WAAO,cAAc,SAAS,MAAM;AAAA,EACtC;AACF;AAGA,SAAS,cAAc,UAAkB,QAA+B;AACtE,SAAO,KAAK,UAAU,QAAQ,MAAM,CAAC;AACvC;","names":["create","link","process","relation","structure","transform","unlink","process","transform","process","transform","create","process","process","create","create","link","process","unlink","process","link","unlink","create","create","link","process","unlink","process","link","unlink","create","create","process","transform","process","create","transform","process","goal","plan","task","encounter","experience","principle","procedure","structure","found","project","ok","process","archive","structure","society","project","ok","ok","position","duty","procedure","individual","ok","archive","product","strategy","spec","release","channel","individual","society","ok","project","scope","milestone","individual","deliverable","wiki","ok","goal","individual","plan","task","encounter","experience","exp","principle","prin","procedure","society","ok","archive","individual","principle","procedure","charter","project","position","past","project","def","findInState","p","p","p","relation","p","individual","node","state","findInState","result","p"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/structures.ts","../src/execution.ts","../src/cognition.ts","../src/organization.ts","../src/project.ts","../src/lifecycle.ts","../src/role.ts"],"sourcesContent":["/**\n * @rolexjs/core — RoleX Concept World\n *\n * Domain-specific structures and processes built on @rolexjs/system.\n *\n * Structures — the concept tree (23 concepts, 3 relations)\n * Processes — how the world changes (32 processes, 5 layers)\n *\n * Layer 1: Execution — want, plan, todo, finish, complete, abandon\n * Layer 2: Cognition — reflect, realize, master\n * Layer 3: Organization — hire, fire, appoint, dismiss, charter, charge\n * Layer 3b: Project — enroll, remove, scope, milestone, deliver, wiki\n * Layer 4: Lifecycle — born, found, establish, launch, retire, die, dissolve, abolish, archive, rehire\n * + Role: activate\n */\n\n// Re-export system primitives\nexport {\n type Create,\n create,\n createRuntime,\n type GraphOp,\n type Link,\n link,\n type Process,\n process,\n type Relation,\n type Remove,\n type Runtime,\n relation,\n remove,\n type State,\n type Structure,\n structure,\n type Transform,\n transform,\n type Unlink,\n unlink,\n} from \"@rolexjs/system\";\n\n// Platform\nexport type { ContextData, Platform, PrototypeRegistry, RoleXRepository } from \"./platform.js\";\n\n// ===== Structures =====\n\nexport {\n background,\n // Organization\n charter,\n // Project\n deliverable,\n duty,\n // Individual — Cognition\n encounter,\n experience,\n // Individual — Execution\n goal,\n // Individual — Identity\n identity,\n // Level 1\n individual,\n // Project\n milestone,\n // Individual — Knowledge\n mindset,\n organization,\n past,\n plan,\n position,\n principle,\n procedure,\n // Project\n project,\n // Organization — Position\n requirement,\n // Project\n scope,\n // Level 0\n society,\n task,\n tone,\n // Project\n wiki,\n} from \"./structures.js\";\n\n// ===== Processes — Layer 1: Execution =====\n\nexport { abandon, complete, finish, planGoal, todo, want } from \"./execution.js\";\n\n// ===== Processes — Layer 2: Cognition =====\n\nexport { master, realize, reflect } from \"./cognition.js\";\n\n// ===== Processes — Layer 3: Organization =====\n\nexport { appoint, charge, charterOrg, dismiss, fire, hire } from \"./organization.js\";\n\n// ===== Processes — Layer 3b: Project =====\n\nexport {\n deliverProject,\n enroll,\n milestoneProject,\n removeParticipant,\n scopeProject,\n wikiProject,\n} from \"./project.js\";\n\n// ===== Processes — Layer 4: Lifecycle =====\n\nexport {\n abolish,\n archive,\n born,\n die,\n dissolve,\n establish,\n found,\n launch,\n rehire,\n retire,\n} from \"./lifecycle.js\";\n\n// ===== Role =====\n\nexport { activate } from \"./role.js\";\n","/**\n * RoleX Concept World — all structure definitions.\n *\n * Every node is a Structure — simultaneously concept, container,\n * and information carrier. Tree (parent-child) provides the\n * hierarchical backbone. Relations provide cross-branch links.\n *\n * ┌─────────────────────────────────────────────────────────┐\n * │ society │\n * │ ├── individual \"A single agent in society\" │\n * │ │ ├── identity \"Who I am\" │\n * │ │ │ ├── background \"My personal background\" │\n * │ │ │ ├── tone \"My tone of communication\" │\n * │ │ │ └── mindset \"How I think\" │\n * │ │ ├── encounter \"A specific event I went through\"│\n * │ │ ├── experience \"What I learned from encounters\" │\n * │ │ ├── principle \"My rules of conduct\" │\n * │ │ ├── procedure \"My skill references and metadata\"│\n * │ │ └── goal \"What I am pursuing\" │\n * │ │ └── plan \"How to achieve a goal\" │\n * │ │ └── task \"Concrete unit of work\" │\n * │ ├── organization \"A group of individuals\" │\n * │ │ │ ∿ membership → individual │\n * │ │ └── charter \"The rules and mission\" │\n * │ ├── position \"A role held by an individual\" │\n * │ │ │ ∿ appointment → individual │\n * │ │ └── duty \"Responsibilities of position\" │\n * │ ├── project \"A process container\" │\n * │ │ │ ∿ participation → individual │\n * │ │ │ ∿ ownership → organization │\n * │ │ ├── scope \"Project boundary\" │\n * │ │ ├── milestone \"Key checkpoint\" │\n * │ │ ├── deliverable \"Project output\" │\n * │ │ └── wiki \"Project knowledge base\" │\n * │ └── past \"Things no longer active\" │\n * └─────────────────────────────────────────────────────────┘\n */\nimport { relation, structure } from \"@rolexjs/system\";\n\n// ================================================================\n// Level 0 — Root\n// ================================================================\n\nexport const society = structure(\"society\", \"The RoleX world\", null);\n\n// ================================================================\n// Level 1 — Four pillars\n// ================================================================\n\nexport const individual = structure(\"individual\", \"A single agent in society\", society);\nexport const organization = structure(\"organization\", \"A group of individuals\", society, [\n relation(\"membership\", \"Who belongs to this organization\", individual),\n]);\nexport const past = structure(\"past\", \"Things no longer active\", society);\n\n// ================================================================\n// Individual — Identity\n// ================================================================\n\nexport const identity = structure(\"identity\", \"Who I am\", individual);\nexport const background = structure(\"background\", \"My personal background\", identity);\nexport const tone = structure(\"tone\", \"My tone of communication\", identity);\nexport const mindset = structure(\"mindset\", \"How I think and approach problems\", identity);\n\n// ================================================================\n// Individual — Cognition\n// ================================================================\n\nexport const encounter = structure(\"encounter\", \"A specific event I went through\", individual);\nexport const experience = structure(\"experience\", \"What I learned from encounters\", individual);\n\n// ================================================================\n// Individual — Knowledge\n// ================================================================\n\nexport const principle = structure(\"principle\", \"My rules of conduct\", individual);\nexport const procedure = structure(\"procedure\", \"My skill references and metadata\", individual);\n\n// ================================================================\n// Individual — Execution\n// ================================================================\n\nexport const goal = structure(\"goal\", \"What I am pursuing\", individual);\nexport const plan = structure(\"plan\", \"How to achieve a goal\", goal);\nexport const task = structure(\"task\", \"Concrete unit of work\", plan);\n\n// ================================================================\n// Organization\n// ================================================================\n\nexport const charter = structure(\"charter\", \"The rules and mission\", organization);\n\n// ================================================================\n// Position — independent entity\n// ================================================================\n\nexport const position = structure(\"position\", \"A role held by an individual\", society, [\n relation(\"appointment\", \"Who holds this position\", individual),\n]);\nexport const duty = structure(\"duty\", \"Responsibilities of this position\", position);\nexport const requirement = structure(\"requirement\", \"Required skill for this position\", position);\n\n// ================================================================\n// Project — process management entity\n// ================================================================\n\nexport const project = structure(\"project\", \"A process container for organized work\", society, [\n relation(\"participation\", \"Who participates in this project\", individual),\n relation(\"ownership\", \"Which organization owns this project\", organization),\n]);\nexport const scope = structure(\n \"scope\",\n \"Project boundary — what to do and what not to do\",\n project\n);\nexport const milestone = structure(\n \"milestone\",\n \"Key checkpoint with achievement criteria\",\n project\n);\nexport const deliverable = structure(\"deliverable\", \"Project output and delivery\", project);\nexport const wiki = structure(\"wiki\", \"Project-level knowledge base entry\", project);\n","/**\n * Execution cycle — the doing loop.\n *\n * want → plan → todo → finish → (encounter) → want → ...\n * plan → complete → (encounter)\n * plan → abandon → (encounter)\n *\n * Goals are long-term directions. Plans are the completable unit —\n * they can be completed or abandoned. Tasks finish individually.\n * All transforms produce encounters — feeding the cognition cycle.\n */\nimport { create, process, transform } from \"@rolexjs/system\";\nimport { encounter, goal, individual, plan, task } from \"./structures.js\";\n\nexport const want = process(\"want\", \"Declare a goal\", individual, create(goal));\nexport const planGoal = process(\"plan\", \"Create a plan for a goal\", goal, create(plan));\nexport const todo = process(\"todo\", \"Create a task in a plan\", plan, create(task));\n\nexport const finish = process(\n \"finish\",\n \"Complete a task, record as encounter\",\n task,\n transform(task, encounter)\n);\nexport const complete = process(\n \"complete\",\n \"Complete a plan, record as encounter\",\n plan,\n transform(plan, encounter)\n);\nexport const abandon = process(\n \"abandon\",\n \"Abandon a plan, record as encounter\",\n plan,\n transform(plan, encounter)\n);\n","/**\n * Cognition cycle — the learning loop.\n *\n * encounter → reflect → experience → realize → principle\n * → master → procedure\n *\n * Encounters are raw events (produced by the execution cycle).\n * Reflection distills them into experience. From experience,\n * principles are realized and procedures are mastered.\n */\nimport { process, transform } from \"@rolexjs/system\";\nimport { encounter, experience, principle, procedure } from \"./structures.js\";\n\nexport const reflect = process(\n \"reflect\",\n \"Reflect on encounters, distill into experience\",\n encounter,\n transform(encounter, experience)\n);\nexport const realize = process(\n \"realize\",\n \"Realize a principle from experience\",\n experience,\n transform(experience, principle)\n);\nexport const master = process(\n \"master\",\n \"Master a procedure from experience\",\n experience,\n transform(experience, procedure)\n);\n","/**\n * Organization management — hiring, firing, and structuring.\n *\n * hire / fire — membership (who belongs)\n * appoint / dismiss — appointment (who holds a position)\n * charter — define org rules and mission\n * charge — add duties to a position\n */\nimport { create, link, process, unlink } from \"@rolexjs/system\";\nimport { charter, duty, organization, position } from \"./structures.js\";\n\n// Membership\nexport const hire = process(\n \"hire\",\n \"Hire an individual into the organization\",\n organization,\n link(organization, \"membership\")\n);\nexport const fire = process(\n \"fire\",\n \"Fire an individual from the organization\",\n organization,\n unlink(organization, \"membership\")\n);\n\n// Appointment\nexport const appoint = process(\n \"appoint\",\n \"Appoint a member to a position\",\n position,\n link(position, \"appointment\")\n);\nexport const dismiss = process(\n \"dismiss\",\n \"Dismiss from a position\",\n position,\n unlink(position, \"appointment\")\n);\n\n// Structure\nexport const charterOrg = process(\n \"charter\",\n \"Define the charter for an organization\",\n organization,\n create(charter)\n);\nexport const charge = process(\"charge\", \"Add a duty to a position\", position, create(duty));\n","/**\n * Project management — scoping, milestones, enrollment, deliverables, wiki.\n *\n * enroll / remove — participation (who is involved)\n * scope — define project boundary\n * milestone — add checkpoint\n * deliver — add deliverable\n * wiki — add knowledge entry\n */\nimport { create, link, process, unlink } from \"@rolexjs/system\";\nimport { deliverable, milestone, project, scope, wiki } from \"./structures.js\";\n\n// Participation\nexport const enroll = process(\n \"enroll\",\n \"Enroll an individual into the project\",\n project,\n link(project, \"participation\")\n);\nexport const removeParticipant = process(\n \"remove\",\n \"Remove an individual from the project\",\n project,\n unlink(project, \"participation\")\n);\n\n// Structure\nexport const scopeProject = process(\n \"scope\",\n \"Define the scope for a project\",\n project,\n create(scope)\n);\nexport const milestoneProject = process(\n \"milestone\",\n \"Add a milestone to a project\",\n project,\n create(milestone)\n);\nexport const deliverProject = process(\n \"deliver\",\n \"Add a deliverable to a project\",\n project,\n create(deliverable)\n);\nexport const wikiProject = process(\"wiki\", \"Add a wiki entry to a project\", project, create(wiki));\n","/**\n * Lifecycle — creation, retirement, and dissolution.\n *\n * born / found / establish — bring things into existence\n * retire / die — individual → past\n * dissolve — organization → past\n * abolish — position → past\n * rehire — past → individual (return from retirement)\n *\n * No real deletion — everything transforms to the \"past\" branch.\n */\nimport { create, process, transform } from \"@rolexjs/system\";\nimport { individual, organization, past, position, project, society } from \"./structures.js\";\n\n// Creation\nexport const born = process(\n \"born\",\n \"An individual is born into society\",\n society,\n create(individual)\n);\nexport const found = process(\"found\", \"Found an organization\", society, create(organization));\nexport const establish = process(\"establish\", \"Establish a position\", society, create(position));\nexport const launch = process(\"launch\", \"Launch a project\", society, create(project));\n\n// Retirement & death\nexport const retire = process(\n \"retire\",\n \"Retire an individual\",\n individual,\n transform(individual, past)\n);\nexport const die = process(\"die\", \"An individual dies\", individual, transform(individual, past));\n\n// Archive project\nexport const archive = process(\"archive\", \"Archive a project\", project, transform(project, past));\n\n// Dissolution\nexport const dissolve = process(\n \"dissolve\",\n \"Dissolve an organization\",\n organization,\n transform(organization, past)\n);\nexport const abolish = process(\n \"abolish\",\n \"Abolish a position\",\n position,\n transform(position, past)\n);\n\n// Return\nexport const rehire = process(\n \"rehire\",\n \"Rehire a retired individual\",\n past,\n transform(past, individual)\n);\n","/**\n * Role projection — activating a role loads cognition into context.\n *\n * A role is not a Structure — it is a State (projection).\n * What to load is defined by the upper layer.\n */\nimport { process } from \"@rolexjs/system\";\nimport { individual } from \"./structures.js\";\n\nexport const activate = process(\n \"activate\",\n \"Activate a role — load cognition into context\",\n individual\n);\n"],"mappings":";AAiBA;AAAA,EAEE,UAAAA;AAAA,EACA;AAAA,EAGA,QAAAC;AAAA,EAEA,WAAAC;AAAA,EAIA,YAAAC;AAAA,EACA;AAAA,EAGA,aAAAC;AAAA,EAEA,aAAAC;AAAA,EAEA,UAAAC;AAAA,OACK;;;ACDP,SAAS,UAAU,iBAAiB;AAM7B,IAAM,UAAU,UAAU,WAAW,mBAAmB,IAAI;AAM5D,IAAM,aAAa,UAAU,cAAc,6BAA6B,OAAO;AAC/E,IAAM,eAAe,UAAU,gBAAgB,0BAA0B,SAAS;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AWF;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACAE,WAAU,cAAc,IAAI;AAC9B;AACO,IAAM,UAAUF;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACAE,WAAU,UAAU,IAAI;AAC1B;AAGO,IAAM,SAASF;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACAE,WAAU,MAAM,UAAU;AAC5B;;;ACnDA,SAAS,WAAAC,gBAAe;AAGjB,IAAM,WAAWC;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AACF;","names":["create","link","process","relation","structure","transform","unlink","process","transform","process","transform","create","process","process","create","create","link","process","unlink","process","link","unlink","create","create","process","transform","process","create","transform","process","process"]}