@rolexjs/core 1.4.0 → 1.5.0-dev-20260309054045

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/rolex-service.ts","../src/apply.ts","../src/commands.ts","../src/directives/index.ts","../src/instructions.ts","../src/dispatch.ts","../src/find.ts","../src/descriptions/index.ts","../src/renderer.ts","../src/tools.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 // 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 // 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 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 publish,\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// ===== 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 { CommandContext, CommandResult, CommandResultMap, Commands } from \"./commands.js\";\nexport { createCommands } from \"./commands.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.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 * │ │ ├── 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 * │ │ ├── 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]);\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 [relation(\"ownership\", \"Who owns this product\", individual)]\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 * 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, 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 * 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));\nexport const publish = process(\"publish\", \"Publish a product\", society, create(product));\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.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 /** Direct execution — for `use` method. Provided by RoleXService. */\n direct?<T>(locator: string, args?: Record<string, unknown>): Promise<T>;\n /** Post-process `use` results (e.g., issue rendering). Provided by upper layer. */\n transformUseResult?<T>(locator: string, result: T): Promise<T>;\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 // Skills\n // ================================================================\n\n /** Skill: load full skill content by locator. */\n async skill(locator: string): Promise<string> {\n return await this.deps.commands[\"role.skill\"](locator);\n }\n\n // ================================================================\n // Use — subjective execution\n // ================================================================\n\n /** Use: subjective execution — `!ns.method` or ResourceX locator. */\n async use<T = unknown>(locator: string, args?: Record<string, unknown>): Promise<T> {\n if (!this.deps.direct) {\n throw new Error(\"Direct execution is not available on this Role instance.\");\n }\n const result = await this.deps.direct<T>(locator, args);\n if (this.deps.transformUseResult) {\n return this.deps.transformUseResult<T>(locator, result);\n }\n return 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 * 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, Structure } from \"@rolexjs/system\";\nimport { createIssueX, type IssueX } from \"issuexjs\";\nimport type { ResourceX } from \"resourcexjs\";\nimport { createResourceX, setProvider } from \"resourcexjs\";\nimport { applyPrototype } from \"./apply.js\";\nimport type { CommandResult, Commands } from \"./commands.js\";\nimport { createCommands } from \"./commands.js\";\nimport { directives } from \"./directives/index.js\";\nimport { toArgs } from \"./dispatch.js\";\nimport { findInState } from \"./find.js\";\nimport type { Platform, PrototypeData, RoleXRepository } from \"./platform.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 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 resourcex?: ResourceX;\n private issuex?: IssueX;\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 private constructor(platform: Platform, renderer: Renderer) {\n this.repo = platform.repository;\n this.rt = this.repo.runtime;\n this.initializer = platform.initializer;\n this.prototypes = platform.prototypes ?? [];\n this.renderer = renderer;\n\n if (platform.resourcexProvider) {\n setProvider(platform.resourcexProvider);\n this.resourcex = createResourceX(\n platform.resourcexExecutor\n ? { isolator: \"custom\", executor: platform.resourcexExecutor }\n : undefined\n );\n }\n\n if (platform.issuexProvider) {\n this.issuex = createIssueX({ provider: platform.issuexProvider });\n }\n }\n\n static async create(platform: Platform, renderer: Renderer): Promise<RoleXService> {\n const service = new RoleXService(platform, renderer);\n await service.init();\n return service;\n }\n\n private async init(): Promise<void> {\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.rt.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 resourcex: this.resourcex,\n issuex: this.issuex,\n prototype: this.repo.prototype,\n direct: (locator: string, args?: Record<string, unknown>) =>\n this.direct(locator, args, { raw: true }),\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.rt.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.rt.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 direct: <T>(locator: string, args?: Record<string, unknown>) => this.direct<T>(locator, args),\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[\"individual.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 // 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 if (locator.startsWith(\"!\")) {\n const command = locator.slice(1);\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 if (!this.resourcex) throw new Error(\"ResourceX is not available.\");\n return this.resourcex.ingest<T>(locator, args);\n }\n\n // ================================================================\n // Internal helpers\n // ================================================================\n\n private async find(id: string): Promise<Structure | null> {\n const state = await this.rt.project(this.society);\n return findInState(state, 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 * 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 — 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[\"individual.born\"](\"Feature: Sean\", \"sean\");\n */\n\nimport { parse } from \"@rolexjs/parser\";\nimport type { Runtime, State, Structure } from \"@rolexjs/system\";\nimport { structure } from \"@rolexjs/system\";\nimport type { Comment, Issue, IssueX } from \"issuexjs\";\nimport type { Resource, ResourceX, RXM } from \"resourcexjs\";\nimport * as C from \"./index.js\";\nimport type { PrototypeRepository } from \"./platform.js\";\n\n// ================================================================\n// Types\n// ================================================================\n\nexport interface CommandResult {\n state: State;\n process: string;\n}\n\nexport interface CommandContext {\n rt: Runtime;\n society: Structure;\n past: Structure;\n resolve(id: string): Structure | Promise<Structure>;\n find(id: string): (Structure | null) | Promise<Structure | null>;\n resourcex?: ResourceX;\n issuex?: IssueX;\n prototype?: PrototypeRepository;\n direct?(locator: string, args?: Record<string, unknown>): Promise<unknown>;\n}\n\n/**\n * CommandResultMap — typed return type for every command.\n *\n * This is the source of truth for what each command returns.\n * Renderer and consumers use this to know the shape of each result.\n */\nexport interface CommandResultMap {\n // ---- Individual ----\n \"individual.born\": CommandResult;\n \"individual.retire\": CommandResult;\n \"individual.die\": CommandResult;\n \"individual.rehire\": CommandResult;\n \"individual.teach\": CommandResult;\n \"individual.train\": CommandResult;\n\n // ---- Role: focus ----\n \"role.focus\": CommandResult;\n\n // ---- Role: execution ----\n \"role.want\": CommandResult;\n \"role.plan\": CommandResult;\n \"role.todo\": CommandResult;\n \"role.finish\": CommandResult;\n \"role.complete\": CommandResult;\n \"role.abandon\": CommandResult;\n\n // ---- Role: cognition ----\n \"role.reflect\": CommandResult;\n \"role.realize\": CommandResult;\n \"role.master\": CommandResult;\n\n // ---- Role: knowledge ----\n \"role.forget\": CommandResult;\n\n // ---- Role: skill ----\n \"role.skill\": string;\n\n // ---- Project ----\n \"project.launch\": CommandResult;\n \"project.scope\": CommandResult;\n \"project.milestone\": CommandResult;\n \"project.achieve\": CommandResult;\n \"project.enroll\": CommandResult;\n \"project.remove\": CommandResult;\n \"project.deliver\": CommandResult;\n \"project.wiki\": CommandResult;\n \"project.archive\": CommandResult;\n\n // ---- Product ----\n \"product.create\": CommandResult;\n \"product.strategy\": CommandResult;\n \"product.spec\": CommandResult;\n \"product.release\": CommandResult;\n \"product.channel\": CommandResult;\n \"product.own\": CommandResult;\n \"product.disown\": CommandResult;\n \"product.deprecate\": CommandResult;\n\n // ---- Organization ----\n \"org.found\": CommandResult;\n \"org.charter\": CommandResult;\n \"org.dissolve\": CommandResult;\n \"org.hire\": CommandResult;\n \"org.fire\": CommandResult;\n\n // ---- Position ----\n \"position.establish\": CommandResult;\n \"position.charge\": CommandResult;\n \"position.require\": CommandResult;\n \"position.abolish\": CommandResult;\n \"position.appoint\": CommandResult;\n \"position.dismiss\": CommandResult;\n\n // ---- Census ----\n \"census.list\": CommandResult;\n\n // ---- Issue ----\n \"issue.publish\": Issue;\n \"issue.get\": Issue | null;\n \"issue.list\": Issue[];\n \"issue.update\": Issue;\n \"issue.close\": Issue;\n \"issue.reopen\": Issue;\n \"issue.assign\": Issue;\n \"issue.comment\": Comment;\n \"issue.comments\": Comment[];\n \"issue.label\": Issue | null;\n \"issue.unlabel\": Issue | null;\n\n // ---- Resource ----\n \"resource.add\": Resource;\n \"resource.search\": string[];\n \"resource.has\": boolean;\n \"resource.info\": Resource;\n \"resource.remove\": undefined;\n \"resource.push\": RXM;\n \"resource.pull\": undefined;\n \"resource.clearCache\": undefined;\n}\n\nexport type Commands = Record<string, (...args: any[]) => any>;\n\n// ================================================================\n// Factory\n// ================================================================\n\nexport function createCommands(ctx: CommandContext): Commands {\n const { rt, society, past, resolve, resourcex, issuex } = ctx;\n\n // ---- Helpers ----\n\n async function ok(node: Structure, process: string): Promise<CommandResult> {\n return { state: await rt.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 /** Scoped search within a subtree. No priority needed — used only by removeExisting. */\n function 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 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 function requireResourceX(): ResourceX {\n if (!resourcex) throw new Error(\"ResourceX is not available.\");\n return resourcex;\n }\n\n function requireIssueX(): IssueX {\n if (!issuex) throw new Error(\"IssueX is not available.\");\n return issuex;\n }\n\n // ================================================================\n // Operations\n // ================================================================\n\n return {\n // ---- Individual: lifecycle ----\n\n async \"individual.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 \"individual.retire\"(individual: string): Promise<CommandResult> {\n return archive(await resolve(individual), \"retire\");\n },\n\n async \"individual.die\"(individual: string): Promise<CommandResult> {\n return archive(await resolve(individual), \"die\");\n },\n\n async \"individual.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 // ---- Individual: external injection ----\n\n async \"individual.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 \"individual.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 // ---- 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.tag(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.tag(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.tag(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 // ---- Role: skill ----\n\n async \"role.skill\"(locator: string): Promise<string> {\n const rx = requireResourceX();\n const content = await rx.ingest<string>(locator);\n const text = typeof content === \"string\" ? content : JSON.stringify(content, null, 2);\n try {\n const rxm = await rx.info(locator);\n return `${formatRXM(rxm)}\\n\\n${text}`;\n } catch {\n return text;\n }\n },\n\n // ---- Project ----\n\n async \"project.launch\"(\n content?: string,\n id?: string,\n alias?: readonly string[],\n org?: 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 return ok(node, \"launch\");\n },\n\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.tag(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.archive\"(project: string): Promise<CommandResult> {\n return archive(await resolve(project), \"archive\");\n },\n\n // ---- Product ----\n\n async \"product.create\"(\n content?: string,\n id?: string,\n alias?: readonly string[]\n ): Promise<CommandResult> {\n validateGherkin(content);\n const node = await rt.create(society, C.product, content, id, alias);\n return ok(node, \"create\");\n },\n\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 // ---- Org ----\n\n async \"org.found\"(\n content?: string,\n id?: string,\n alias?: readonly string[]\n ): Promise<CommandResult> {\n validateGherkin(content);\n const node = await rt.create(society, C.organization, content, id, alias);\n return ok(node, \"found\");\n },\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.dissolve\"(org: string): Promise<CommandResult> {\n return archive(await resolve(org), \"dissolve\");\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 // ---- Position ----\n\n async \"position.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 \"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.abolish\"(position: string): Promise<CommandResult> {\n return archive(await resolve(position), \"abolish\");\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\n // Auto-train: copy position requirements as individual procedures\n const posState = await rt.project(posNode);\n for (const child of posState.children ?? []) {\n if (child.name !== \"requirement\" || !child.information) continue;\n // rt.create is idempotent for same parent + same id\n await rt.create(indNode, C.procedure, child.information, child.id);\n }\n\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 // ---- Census ----\n\n async \"census.list\"(type?: string): Promise<CommandResult> {\n const target = type === \"past\" ? past : society;\n const state = await rt.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 // ---- Resource (proxy to ResourceX) ----\n\n \"resource.add\"(path: string): Promise<Resource> {\n return requireResourceX().add(path);\n },\n\n \"resource.search\"(query?: string): Promise<string[]> {\n return requireResourceX().search(query);\n },\n\n \"resource.has\"(locator: string): Promise<boolean> {\n return requireResourceX().has(locator);\n },\n\n \"resource.info\"(locator: string): Promise<Resource> {\n return requireResourceX().info(locator);\n },\n\n \"resource.remove\"(locator: string): Promise<void> {\n return requireResourceX().remove(locator);\n },\n\n \"resource.push\"(locator: string, options?: { registry?: string }): Promise<RXM> {\n return requireResourceX().push(locator, options);\n },\n\n \"resource.pull\"(locator: string, options?: { registry?: string }): Promise<void> {\n return requireResourceX().pull(locator, options);\n },\n\n \"resource.clearCache\"(registry?: string): Promise<void> {\n return requireResourceX().clearCache(registry);\n },\n\n // ---- Issue (proxy to IssueX) ----\n\n async \"issue.publish\"(\n title: string,\n body: string,\n author: string,\n assignee?: string\n ): Promise<Issue> {\n const ix = requireIssueX();\n return ix.createIssue({ title, body, author, assignee });\n },\n\n async \"issue.get\"(number: number): Promise<Issue | null> {\n return requireIssueX().getIssueByNumber(number);\n },\n\n async \"issue.list\"(\n status?: string,\n author?: string,\n assignee?: string,\n label?: string\n ): Promise<Issue[]> {\n const filter: Record<string, string> = {};\n if (status) filter.status = status;\n if (author) filter.author = author;\n if (assignee) filter.assignee = assignee;\n if (label) filter.label = label;\n return requireIssueX().listIssues(\n Object.keys(filter).length > 0 ? (filter as any) : undefined\n );\n },\n\n async \"issue.update\"(\n number: number,\n title?: string,\n body?: string,\n assignee?: string\n ): Promise<Issue> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n const patch: Record<string, unknown> = {};\n if (title !== undefined) patch.title = title;\n if (body !== undefined) patch.body = body;\n if (assignee !== undefined) patch.assignee = assignee;\n return ix.updateIssue(issue.id, patch);\n },\n\n async \"issue.close\"(number: number): Promise<Issue> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n return ix.closeIssue(issue.id);\n },\n\n async \"issue.reopen\"(number: number): Promise<Issue> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n return ix.reopenIssue(issue.id);\n },\n\n async \"issue.assign\"(number: number, assignee: string): Promise<Issue> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n return ix.updateIssue(issue.id, { assignee });\n },\n\n async \"issue.comment\"(number: number, body: string, author: string): Promise<Comment> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n return ix.createComment(issue.id, body, author);\n },\n\n async \"issue.comments\"(number: number): Promise<Comment[]> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n return ix.listComments(issue.id);\n },\n\n async \"issue.label\"(number: number, label: string): Promise<Issue | null> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n // Find or create label by name\n let labelObj = await ix.getLabelByName(label);\n if (!labelObj) labelObj = await ix.createLabel({ name: label });\n await ix.addLabel(issue.id, labelObj.id);\n return ix.getIssueByNumber(number);\n },\n\n async \"issue.unlabel\"(number: number, label: string): Promise<Issue | null> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n const labelObj = await ix.getLabelByName(label);\n if (!labelObj) throw new Error(`Label \"${label}\" not found.`);\n await ix.removeLabel(issue.id, labelObj.id);\n return ix.getIssueByNumber(number);\n },\n };\n}\n\n// ================================================================\n// Helpers\n// ================================================================\n\nfunction formatRXM(rxm: any): string {\n const lines: string[] = [`--- RXM: ${rxm.locator} ---`];\n const def = rxm.definition;\n if (def) {\n if (def.author) lines.push(`Author: ${def.author}`);\n if (def.description) lines.push(`Description: ${def.description}`);\n }\n const source = rxm.source;\n if (source?.files) {\n lines.push(\"Files:\");\n lines.push(renderFileTree(source.files, \" \"));\n }\n lines.push(\"---\");\n return lines.join(\"\\n\");\n}\n\nfunction renderFileTree(files: Record<string, any>, indent = \"\"): string {\n const lines: string[] = [];\n for (const [name, value] of Object.entries(files)) {\n if (value && typeof value === \"object\" && !(\"size\" in value)) {\n lines.push(`${indent}${name}`);\n lines.push(renderFileTree(value, `${indent} `));\n } else {\n const size = value?.size ? ` (${value.size} bytes)` : \"\";\n lines.push(`${indent}${name}${size}`);\n }\n }\n return lines.filter(Boolean).join(\"\\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","/**\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 { ArgEntry, InstructionDef } from \"./schema.js\";\n\nfunction 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\n// ================================================================\n// Individual — lifecycle + external injection\n// ================================================================\n\nconst individualBorn = def(\n \"individual\",\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\nconst individualRetire = def(\n \"individual\",\n \"retire\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"individual\"]\n);\n\nconst individualDie = def(\n \"individual\",\n \"die\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"individual\"]\n);\n\nconst individualRehire = def(\n \"individual\",\n \"rehire\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id (from past)\" },\n },\n [\"individual\"]\n);\n\nconst individualTeach = def(\n \"individual\",\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\nconst individualTrain = def(\n \"individual\",\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\n// ================================================================\n// Role — execution + cognition\n// ================================================================\n\nconst 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\nconst roleFocus = def(\n \"role\",\n \"focus\",\n {\n goal: { type: \"string\", required: true, description: \"Goal id to switch to\" },\n },\n [\"goal\"]\n);\n\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst roleSkill = def(\n \"role\",\n \"skill\",\n {\n locator: { type: \"string\", required: true, description: \"ResourceX locator for the skill\" },\n },\n [\"locator\"]\n);\n\n// ================================================================\n// Org — organization management\n// ================================================================\n\nconst orgFound = def(\n \"org\",\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 },\n [\"content\", \"id\", \"alias\"]\n);\n\nconst 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\nconst orgDissolve = def(\n \"org\",\n \"dissolve\",\n {\n org: { type: \"string\", required: true, description: \"Organization id\" },\n },\n [\"org\"]\n);\n\nconst 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\nconst 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\n// ================================================================\n// Position — position management\n// ================================================================\n\nconst positionEstablish = def(\n \"position\",\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\nconst 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\nconst 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\nconst positionAbolish = def(\n \"position\",\n \"abolish\",\n {\n position: { type: \"string\", required: true, description: \"Position id\" },\n },\n [\"position\"]\n);\n\nconst 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\nconst 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\n// ================================================================\n// Project — project management\n// ================================================================\n\nconst projectLaunch = def(\n \"project\",\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 },\n [\"content\", \"id\", \"alias\", \"org\"]\n);\n\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst projectArchive = def(\n \"project\",\n \"archive\",\n {\n project: { type: \"string\", required: true, description: \"Project id\" },\n },\n [\"project\"]\n);\n\n// ================================================================\n// Product — product management\n// ================================================================\n\nconst productCreate = def(\n \"product\",\n \"create\",\n {\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: \"User-facing identifier (kebab-case)\" },\n alias: { type: \"string[]\", required: false, description: \"Alternative names\" },\n },\n [\"content\", \"id\", \"alias\"]\n);\n\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst productDeprecate = def(\n \"product\",\n \"deprecate\",\n {\n product: { type: \"string\", required: true, description: \"Product id\" },\n },\n [\"product\"]\n);\n\n// ================================================================\n// Census — society-level queries\n// ================================================================\n\nconst censusList = def(\n \"census\",\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// Resource — ResourceX proxy\n// ================================================================\n\nconst resourceAdd = def(\n \"resource\",\n \"add\",\n {\n path: { type: \"string\", required: true, description: \"Path to resource directory\" },\n },\n [\"path\"]\n);\n\nconst resourceSearch = def(\n \"resource\",\n \"search\",\n {\n query: { type: \"string\", required: false, description: \"Search query\" },\n },\n [\"query\"]\n);\n\nconst resourceHas = def(\n \"resource\",\n \"has\",\n {\n locator: { type: \"string\", required: true, description: \"Resource locator\" },\n },\n [\"locator\"]\n);\n\nconst resourceInfo = def(\n \"resource\",\n \"info\",\n {\n locator: { type: \"string\", required: true, description: \"Resource locator\" },\n },\n [\"locator\"]\n);\n\nconst resourceRemove = def(\n \"resource\",\n \"remove\",\n {\n locator: { type: \"string\", required: true, description: \"Resource locator\" },\n },\n [\"locator\"]\n);\n\nconst resourcePush = def(\n \"resource\",\n \"push\",\n {\n locator: { type: \"string\", required: true, description: \"Resource locator\" },\n registry: { type: \"string\", required: false, description: \"Registry URL (overrides default)\" },\n },\n [\"locator\", { pack: [\"registry\"] }]\n);\n\nconst resourcePull = def(\n \"resource\",\n \"pull\",\n {\n locator: { type: \"string\", required: true, description: \"Resource locator\" },\n registry: { type: \"string\", required: false, description: \"Registry URL (overrides default)\" },\n },\n [\"locator\", { pack: [\"registry\"] }]\n);\n\nconst resourceClearCache = def(\n \"resource\",\n \"clearCache\",\n {\n registry: { type: \"string\", required: false, description: \"Registry to clear cache for\" },\n },\n [\"registry\"]\n);\n\n// ================================================================\n// Issue — IssueX proxy\n// ================================================================\n\nconst 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\nconst issueGet = def(\n \"issue\",\n \"get\",\n {\n number: { type: \"number\", required: true, description: \"Issue number\" },\n },\n [\"number\"]\n);\n\nconst 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\nconst 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\nconst issueClose = def(\n \"issue\",\n \"close\",\n {\n number: { type: \"number\", required: true, description: \"Issue number to close\" },\n },\n [\"number\"]\n);\n\nconst issueReopen = def(\n \"issue\",\n \"reopen\",\n {\n number: { type: \"number\", required: true, description: \"Issue number to reopen\" },\n },\n [\"number\"]\n);\n\nconst 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\nconst 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\nconst issueComments = def(\n \"issue\",\n \"comments\",\n {\n number: { type: \"number\", required: true, description: \"Issue number\" },\n },\n [\"number\"]\n);\n\nconst 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\nconst 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\n// ================================================================\n// Instruction registry — keyed by \"namespace.method\"\n// ================================================================\n\nexport const instructions: Record<string, InstructionDef> = {\n // individual\n \"individual.born\": individualBorn,\n \"individual.retire\": individualRetire,\n \"individual.die\": individualDie,\n \"individual.rehire\": individualRehire,\n \"individual.teach\": individualTeach,\n \"individual.train\": individualTrain,\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 \"role.skill\": roleSkill,\n\n // org\n \"org.found\": orgFound,\n \"org.charter\": orgCharter,\n \"org.dissolve\": orgDissolve,\n \"org.hire\": orgHire,\n \"org.fire\": orgFire,\n\n // position\n \"position.establish\": positionEstablish,\n \"position.charge\": positionCharge,\n \"position.require\": positionRequire,\n \"position.abolish\": positionAbolish,\n \"position.appoint\": positionAppoint,\n \"position.dismiss\": positionDismiss,\n\n // project\n \"project.launch\": projectLaunch,\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.archive\": projectArchive,\n\n // product\n \"product.create\": productCreate,\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 // census\n \"census.list\": censusList,\n\n // prototype\n \"prototype.evict\": prototypeEvict,\n\n // resource\n \"resource.add\": resourceAdd,\n \"resource.search\": resourceSearch,\n \"resource.has\": resourceHas,\n \"resource.info\": resourceInfo,\n \"resource.remove\": resourceRemove,\n \"resource.push\": resourcePush,\n \"resource.pull\": resourcePull,\n \"resource.clearCache\": resourceClearCache,\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","/**\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.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. \"individual.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","// AUTO-GENERATED — do not edit. Run `bun run gen:desc` to regenerate.\n\nexport const processes: Record<string, string> = {\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\\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 the persona is stored as the individual's information\\n And the individual can be hired into organizations\\n And the individual can be activated to start working\\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 die: \"Feature: die — permanently remove an individual\\n Permanently remove an individual.\\n Unlike retire, this is irreversible.\\n\\n Scenario: Remove an individual permanently\\n Given an individual exists\\n When die is called on the individual\\n Then the individual and all associated data are removed\\n And this operation is irreversible\",\n rehire:\n \"Feature: rehire — restore a retired individual\\n Rehire a retired individual.\\n Restores the individual with full history and knowledge intact.\\n\\n Scenario: Rehire an individual\\n Given a retired individual exists\\n When rehire is called on the individual\\n Then the individual is restored to active status\\n And all previous data and knowledge are intact\",\n retire:\n \"Feature: retire — archive an individual\\n Archive an individual — deactivate but preserve all data.\\n A retired individual can be rehired later with full history intact.\\n\\n Scenario: Retire an individual\\n Given an individual exists\\n When retire is called on the individual\\n Then the individual is deactivated\\n And all data is preserved for potential restoration\\n And the individual can be rehired later\",\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 individual id, principle Gherkin, and a principle id\\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: 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\" becomes id \"structure-first-design\"\\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 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 individual id, procedure Gherkin, and a procedure id\\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: Procedure ID convention\\n Given the id is keywords from the procedure content joined by hyphens\\n Then \"Skill Creator\" becomes id \"skill-creator\"\\n And \"Role Management\" becomes id \"role-management\"\\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 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: 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 dissolve:\n \"Feature: dissolve — dissolve an organization\\n Dissolve an organization.\\n All positions, charter entries, and assignments are cascaded.\\n\\n Scenario: Dissolve an organization\\n Given an organization exists\\n When dissolve is called on the organization\\n Then all positions within the organization are abolished\\n And all assignments and charter entries are removed\\n And the organization no longer exists\",\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 found:\n \"Feature: found — create a new organization\\n Found a new organization.\\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: 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 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 abolish:\n \"Feature: abolish — abolish a position\\n Abolish a position.\\n All duties and appointments associated with the position are removed.\\n\\n Scenario: Abolish a position\\n Given a position exists\\n When abolish is called on the position\\n Then all duties and appointments are removed\\n And the position no longer exists\",\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 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: 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 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 establish:\n \"Feature: establish — create a position\\n Create a position as an independent entity.\\n Positions define roles and can be charged with duties.\\n\\n Scenario: Establish a position\\n Given a Gherkin source describing the position\\n When establish is called with the position content\\n Then a new position entity is created\\n And the position can be charged with duties\\n And individuals can be appointed to it\\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 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 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 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 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 direct:\n 'Feature: direct — stateless world-level executor\\n Execute commands and load resources without an active role.\\n Direct operates as an anonymous observer — no role identity, no role context.\\n For operations as an active role, use the use tool instead.\\n\\n Scenario: When to use \"direct\" vs \"use\"\\n Given no role is activated — I am an observer\\n When I need to query or operate on the world\\n Then direct is the right tool\\n And once a role is activated, use the use tool for role-level actions\\n\\n Scenario: Execute a RoleX command\\n Given the locator starts with `!`\\n When direct is called with command and args\\n Then the command is parsed as `namespace.method`\\n And dispatched to the corresponding RoleX API\\n And all named parameters go inside the args object\\n And example: command = \"!census.list\", args = { type: \"individual\" }\\n\\n Scenario: Load a ResourceX resource\\n Given the locator does not start with `!`\\n When direct is called with the locator\\n Then the locator is passed to ResourceX for resolution\\n And the resource is loaded and returned',\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 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 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 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 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 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 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 skill:\n \"Feature: skill — load full skill content\\n Load the complete skill instructions by ResourceX locator.\\n This is progressive disclosure layer 2 — on-demand knowledge injection.\\n\\n Scenario: Load a skill\\n Given a procedure exists in the role with a locator\\n When skill is called with the locator\\n Then the full SKILL.md content is loaded via ResourceX\\n And the content is injected into the AI's context\\n And the AI can now follow the skill's detailed instructions\",\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 use: 'Feature: use — act as the current role\\n Execute commands and load resources as the active role.\\n Use requires an active role — the role is the subject performing the action.\\n For operations before activating a role, use the direct tool instead.\\n\\n Scenario: When to use \"use\" vs \"direct\"\\n Given a role is activated — I am someone\\n When I perform operations through use\\n Then the operation happens in the context of my role\\n And use is for role-level actions — acting in the world as myself\\n\\n Scenario: Execute a RoleX command\\n Given the locator starts with `!`\\n When use is called with command and args\\n Then the command is parsed as `namespace.method`\\n And dispatched to the corresponding RoleX API\\n And all named parameters go inside the args object\\n And example: command = \"!org.hire\", args = { org: \"dp\", individual: \"sean\" }\\n\\n Scenario: Load a ResourceX resource\\n Given the locator does not start with `!`\\n When use is called with the locator\\n Then the locator is passed to ResourceX for resolution\\n And the resource is loaded and returned',\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} as const;\n\nexport const world: Record<string, string> = {\n \"identity-ethics\":\n \"Feature: 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 \"cognitive-priority\":\n \"Feature: 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 \"role-identity\":\n \"Feature: 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 census:\n 'Feature: Census — the only way to query what exists in the world\\n Census is the single entry point for all world-level queries.\\n Call it via the MCP direct tool: direct(\"!census.list\").\\n Census 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 direct(\"!census.list\")\\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 direct(\"!census.list\", { type: \"individual\" })\\n Then only individuals 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 direct(\"!census.list\", { 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 direct(\"!census.list\") 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 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(ids, id, experience) selectively consumes chosen encounters and produces experience\\n And realize(ids, id, principle) distills chosen experiences into a principle — transferable knowledge\\n And master(ids, id, procedure) distills chosen experiences into a procedure — skill metadata\\n And master can also be called without ids — 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 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 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(id, goal)\\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(id, plan) to break it into logical phases\\n And I call todo(id, task) 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(id) 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(id) to change the currently focused goal\\n And subsequent plan and todo operations target the focused goal\",\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: 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 gherkin:\n 'Feature: Gherkin — the universal language\\n Everything in RoleX is expressed as Gherkin Feature files.\\n Gherkin is not just for testing — it is the language of identity, goals, and knowledge.\\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 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(id, encounter) 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 \"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 \"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 \"use-protocol\":\n 'Feature: Use tool — the universal execution entry point\\n The MCP use tool is how you execute ALL RoleX operations beyond the core MCP tools.\\n Whenever you see use(\"...\") or a !namespace.method pattern in skills or documentation,\\n it is an instruction to call the MCP use tool with that command.\\n\\n Scenario: How to read use instructions in skills\\n Given a skill document contains use(\"!resource.add\", { path: \"...\" })\\n Then this means: call the MCP use tool with command \"!resource.add\"\\n And all named arguments go inside the args object parameter\\n And example: command = \"!resource.add\", args = { path: \"/absolute/path\" }\\n And always use the MCP use tool for RoleX operations\\n And this applies to every use(\"...\") pattern you encounter in any skill or documentation\\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 the args object\\n\\n Scenario: Mandatory skill loading before execution\\n Given your procedures list the skills you have\\n When you need to execute a command you have not seen in a loaded skill\\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 args object\\n And do not use commands from other roles\\' descriptions — only your own skills\\n\\n Scenario: NEVER guess commands\\n Given a command is not found in any loaded skill\\n When the AI considers trying it anyway\\n Then STOP — do not call use or direct with unverified commands\\n And call skill(locator) with the relevant procedure to learn the correct syntax\\n And if no procedure covers this task, it 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} as const;\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.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","/**\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 * Description for each tool comes from descriptions/processes via detail().\n * This file only defines the parameter schema.\n */\n\nimport { 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 with 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\nconst tools: ToolDef[] = [\n // --- Role ---\n {\n name: \"activate\",\n params: {\n roleId: { type: \"string\", required: true, description: \"Role name to activate\" },\n },\n },\n {\n name: \"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 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 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 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 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 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 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 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 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 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 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 {\n name: \"skill\",\n params: {\n locator: {\n type: \"string\",\n required: true,\n description: \"ResourceX locator for the skill (e.g. deepractice/role-management)\",\n },\n },\n },\n\n // --- Use / Direct ---\n {\n name: \"use\",\n params: {\n command: {\n type: \"string\",\n required: true,\n description: \"!namespace.method for RoleX commands, or a ResourceX locator for resources\",\n },\n args: {\n type: \"record\",\n required: false,\n description:\n 'Named arguments object for the command. All parameters (id, content, org, individual, etc.) go inside this object. Example: { id: \"sean\", content: \"Feature: ...\" }. Load the relevant skill first to learn what args to pass.',\n },\n },\n },\n {\n name: \"direct\",\n params: {\n command: {\n type: \"string\",\n required: true,\n description: \"!namespace.method for RoleX commands, or a ResourceX locator for resources\",\n },\n args: {\n type: \"record\",\n required: false,\n description:\n 'Named arguments object for the command. All parameters (id, content, org, individual, etc.) go inside this object. Example: { type: \"individual\" }. Load the relevant skill first to learn what args to pass.',\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"],"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;;;ACKP,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,UA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AAAA,QACT,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AAAA;AAAA,EAGA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,MACN,IAAI;AAAA,QACF,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,MACN,SAAS;AAAA,QACP,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AAAA;AAAA,EAGA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,MACN,SAAS;AAAA,QACP,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACf;AAAA,MACA,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aACE;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,MACN,SAAS;AAAA,QACP,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACf;AAAA,MACA,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aACE;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AACF;AAGO,IAAM,WAAqB,EAAE,OAAO,cAAc,kBAAkB;","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","society","past","process","archive","structure","findInState","found","individual","principle","procedure","goal","plan","task","encounter","experience","exp","prin","project","scope","milestone","deliverable","wiki","product","strategy","spec","release","channel","charter","position","duty","def","def","individual","node","state"]}
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/rolex-service.ts","../src/apply.ts","../src/commands.ts","../src/directives/index.ts","../src/instructions.ts","../src/dispatch.ts","../src/find.ts","../src/descriptions/index.ts","../src/renderer.ts","../src/tools.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 // 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 // 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// ===== 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 { CommandContext, CommandResult, CommandResultMap, Commands } from \"./commands.js\";\nexport { createCommands } from \"./commands.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.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 * 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.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 /** Direct execution — for `use` method. Provided by RoleXService. */\n direct?<T>(locator: string, args?: Record<string, unknown>): Promise<T>;\n /** Post-process `use` results (e.g., issue rendering). Provided by upper layer. */\n transformUseResult?<T>(locator: string, result: T): Promise<T>;\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 // Skills\n // ================================================================\n\n /** Skill: load full skill content by locator. */\n async skill(locator: string): Promise<string> {\n return await this.deps.commands[\"role.skill\"](locator);\n }\n\n // ================================================================\n // Use — subjective execution\n // ================================================================\n\n /** Use: subjective execution — `!ns.method` or ResourceX locator. */\n async use<T = unknown>(locator: string, args?: Record<string, unknown>): Promise<T> {\n if (!this.deps.direct) {\n throw new Error(\"Direct execution is not available on this Role instance.\");\n }\n const result = await this.deps.direct<T>(locator, args);\n if (this.deps.transformUseResult) {\n return this.deps.transformUseResult<T>(locator, result);\n }\n return 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 * 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, Structure } from \"@rolexjs/system\";\nimport { createIssueX, type IssueX } from \"issuexjs\";\nimport type { ResourceX } from \"resourcexjs\";\nimport { createResourceX, setProvider } from \"resourcexjs\";\nimport { applyPrototype } from \"./apply.js\";\nimport type { CommandResult, Commands } from \"./commands.js\";\nimport { createCommands } from \"./commands.js\";\nimport { directives } from \"./directives/index.js\";\nimport { toArgs } from \"./dispatch.js\";\nimport { findInState } from \"./find.js\";\nimport type { Platform, PrototypeData, RoleXRepository } from \"./platform.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 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 resourcex?: ResourceX;\n private issuex?: IssueX;\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 private constructor(platform: Platform, renderer: Renderer) {\n this.repo = platform.repository;\n this.rt = this.repo.runtime;\n this.initializer = platform.initializer;\n this.prototypes = platform.prototypes ?? [];\n this.renderer = renderer;\n\n if (platform.resourcexProvider) {\n setProvider(platform.resourcexProvider);\n this.resourcex = createResourceX(\n platform.resourcexExecutor\n ? { isolator: \"custom\", executor: platform.resourcexExecutor }\n : undefined\n );\n }\n\n if (platform.issuexProvider) {\n this.issuex = createIssueX({ provider: platform.issuexProvider });\n }\n }\n\n static async create(platform: Platform, renderer: Renderer): Promise<RoleXService> {\n const service = new RoleXService(platform, renderer);\n await service.init();\n return service;\n }\n\n private async init(): Promise<void> {\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.rt.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 resourcex: this.resourcex,\n issuex: this.issuex,\n prototype: this.repo.prototype,\n direct: (locator: string, args?: Record<string, unknown>) =>\n this.direct(locator, args, { raw: true }),\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.rt.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.rt.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 direct: <T>(locator: string, args?: Record<string, unknown>) => this.direct<T>(locator, args),\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[\"individual.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 // 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 if (locator.startsWith(\"!\")) {\n const command = locator.slice(1);\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 if (!this.resourcex) throw new Error(\"ResourceX is not available.\");\n return this.resourcex.ingest<T>(locator, args);\n }\n\n // ================================================================\n // Internal helpers\n // ================================================================\n\n private async find(id: string): Promise<Structure | null> {\n const state = await this.rt.project(this.society);\n return findInState(state, 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 * 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 — 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[\"individual.born\"](\"Feature: Sean\", \"sean\");\n */\n\nimport { parse } from \"@rolexjs/parser\";\nimport type { Runtime, State, Structure } from \"@rolexjs/system\";\nimport { structure } from \"@rolexjs/system\";\nimport type { Comment, Issue, IssueX } from \"issuexjs\";\nimport type { Resource, ResourceX, RXM } from \"resourcexjs\";\nimport * as C from \"./index.js\";\nimport type { PrototypeRepository } from \"./platform.js\";\n\n// ================================================================\n// Types\n// ================================================================\n\nexport interface CommandResult {\n state: State;\n process: string;\n}\n\nexport interface CommandContext {\n rt: Runtime;\n society: Structure;\n past: Structure;\n resolve(id: string): Structure | Promise<Structure>;\n find(id: string): (Structure | null) | Promise<Structure | null>;\n resourcex?: ResourceX;\n issuex?: IssueX;\n prototype?: PrototypeRepository;\n direct?(locator: string, args?: Record<string, unknown>): Promise<unknown>;\n}\n\n/**\n * CommandResultMap — typed return type for every command.\n *\n * This is the source of truth for what each command returns.\n * Renderer and consumers use this to know the shape of each result.\n */\nexport interface CommandResultMap {\n // ---- Individual ----\n \"individual.born\": CommandResult;\n \"individual.retire\": CommandResult;\n \"individual.die\": CommandResult;\n \"individual.rehire\": CommandResult;\n \"individual.teach\": CommandResult;\n \"individual.train\": CommandResult;\n\n // ---- Role: focus ----\n \"role.focus\": CommandResult;\n\n // ---- Role: execution ----\n \"role.want\": CommandResult;\n \"role.plan\": CommandResult;\n \"role.todo\": CommandResult;\n \"role.finish\": CommandResult;\n \"role.complete\": CommandResult;\n \"role.abandon\": CommandResult;\n\n // ---- Role: cognition ----\n \"role.reflect\": CommandResult;\n \"role.realize\": CommandResult;\n \"role.master\": CommandResult;\n\n // ---- Role: knowledge ----\n \"role.forget\": CommandResult;\n\n // ---- Role: skill ----\n \"role.skill\": string;\n\n // ---- Project ----\n \"project.launch\": CommandResult;\n \"project.scope\": CommandResult;\n \"project.milestone\": CommandResult;\n \"project.achieve\": CommandResult;\n \"project.enroll\": CommandResult;\n \"project.remove\": CommandResult;\n \"project.deliver\": CommandResult;\n \"project.wiki\": CommandResult;\n \"project.archive\": CommandResult;\n \"project.produce\": CommandResult;\n\n // ---- Product ----\n \"product.strategy\": CommandResult;\n \"product.spec\": CommandResult;\n \"product.release\": CommandResult;\n \"product.channel\": CommandResult;\n \"product.own\": CommandResult;\n \"product.disown\": CommandResult;\n \"product.deprecate\": CommandResult;\n\n // ---- Organization ----\n \"org.found\": CommandResult;\n \"org.charter\": CommandResult;\n \"org.dissolve\": CommandResult;\n \"org.hire\": CommandResult;\n \"org.fire\": CommandResult;\n\n // ---- Position ----\n \"position.establish\": CommandResult;\n \"position.charge\": CommandResult;\n \"position.require\": CommandResult;\n \"position.abolish\": CommandResult;\n \"position.appoint\": CommandResult;\n \"position.dismiss\": CommandResult;\n\n // ---- Census ----\n \"census.list\": CommandResult;\n\n // ---- Issue ----\n \"issue.publish\": Issue;\n \"issue.get\": Issue | null;\n \"issue.list\": Issue[];\n \"issue.update\": Issue;\n \"issue.close\": Issue;\n \"issue.reopen\": Issue;\n \"issue.assign\": Issue;\n \"issue.comment\": Comment;\n \"issue.comments\": Comment[];\n \"issue.label\": Issue | null;\n \"issue.unlabel\": Issue | null;\n\n // ---- Resource ----\n \"resource.add\": Resource;\n \"resource.search\": string[];\n \"resource.has\": boolean;\n \"resource.info\": Resource;\n \"resource.remove\": undefined;\n \"resource.push\": RXM;\n \"resource.pull\": undefined;\n \"resource.clearCache\": undefined;\n}\n\nexport type Commands = Record<string, (...args: any[]) => any>;\n\n// ================================================================\n// Factory\n// ================================================================\n\nexport function createCommands(ctx: CommandContext): Commands {\n const { rt, society, past, resolve, resourcex, issuex } = ctx;\n\n // ---- Helpers ----\n\n async function ok(node: Structure, process: string): Promise<CommandResult> {\n return { state: await rt.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 /** Scoped search within a subtree. No priority needed — used only by removeExisting. */\n function 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 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 function requireResourceX(): ResourceX {\n if (!resourcex) throw new Error(\"ResourceX is not available.\");\n return resourcex;\n }\n\n function requireIssueX(): IssueX {\n if (!issuex) throw new Error(\"IssueX is not available.\");\n return issuex;\n }\n\n // ================================================================\n // Operations\n // ================================================================\n\n return {\n // ---- Individual: lifecycle ----\n\n async \"individual.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 \"individual.retire\"(individual: string): Promise<CommandResult> {\n return archive(await resolve(individual), \"retire\");\n },\n\n async \"individual.die\"(individual: string): Promise<CommandResult> {\n return archive(await resolve(individual), \"die\");\n },\n\n async \"individual.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 // ---- Individual: external injection ----\n\n async \"individual.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 \"individual.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 // ---- 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.tag(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.tag(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.tag(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 // ---- Role: skill ----\n\n async \"role.skill\"(locator: string): Promise<string> {\n const rx = requireResourceX();\n const content = await rx.ingest<string>(locator);\n const text = typeof content === \"string\" ? content : JSON.stringify(content, null, 2);\n try {\n const rxm = await rx.info(locator);\n return `${formatRXM(rxm)}\\n\\n${text}`;\n } catch {\n return text;\n }\n },\n\n // ---- Project ----\n\n async \"project.launch\"(\n content?: string,\n id?: string,\n alias?: readonly string[],\n org?: 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 return ok(node, \"launch\");\n },\n\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.tag(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.archive\"(project: string): Promise<CommandResult> {\n return archive(await resolve(project), \"archive\");\n },\n\n async \"project.produce\"(\n project: string,\n content?: string,\n id?: string,\n alias?: readonly 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 return ok(node, \"produce\");\n },\n\n // ---- Product ----\n\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 // ---- Org ----\n\n async \"org.found\"(\n content?: string,\n id?: string,\n alias?: readonly string[]\n ): Promise<CommandResult> {\n validateGherkin(content);\n const node = await rt.create(society, C.organization, content, id, alias);\n return ok(node, \"found\");\n },\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.dissolve\"(org: string): Promise<CommandResult> {\n return archive(await resolve(org), \"dissolve\");\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 // ---- Position ----\n\n async \"position.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 \"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.abolish\"(position: string): Promise<CommandResult> {\n return archive(await resolve(position), \"abolish\");\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\n // Auto-train: copy position requirements as individual procedures\n const posState = await rt.project(posNode);\n for (const child of posState.children ?? []) {\n if (child.name !== \"requirement\" || !child.information) continue;\n // rt.create is idempotent for same parent + same id\n await rt.create(indNode, C.procedure, child.information, child.id);\n }\n\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 // ---- Census ----\n\n async \"census.list\"(type?: string): Promise<CommandResult> {\n const target = type === \"past\" ? past : society;\n const state = await rt.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 // ---- Resource (proxy to ResourceX) ----\n\n \"resource.add\"(path: string): Promise<Resource> {\n return requireResourceX().add(path);\n },\n\n \"resource.search\"(query?: string): Promise<string[]> {\n return requireResourceX().search(query);\n },\n\n \"resource.has\"(locator: string): Promise<boolean> {\n return requireResourceX().has(locator);\n },\n\n \"resource.info\"(locator: string): Promise<Resource> {\n return requireResourceX().info(locator);\n },\n\n \"resource.remove\"(locator: string): Promise<void> {\n return requireResourceX().remove(locator);\n },\n\n \"resource.push\"(locator: string, options?: { registry?: string }): Promise<RXM> {\n return requireResourceX().push(locator, options);\n },\n\n \"resource.pull\"(locator: string, options?: { registry?: string }): Promise<void> {\n return requireResourceX().pull(locator, options);\n },\n\n \"resource.clearCache\"(registry?: string): Promise<void> {\n return requireResourceX().clearCache(registry);\n },\n\n // ---- Issue (proxy to IssueX) ----\n\n async \"issue.publish\"(\n title: string,\n body: string,\n author: string,\n assignee?: string\n ): Promise<Issue> {\n const ix = requireIssueX();\n return ix.createIssue({ title, body, author, assignee });\n },\n\n async \"issue.get\"(number: number): Promise<Issue | null> {\n return requireIssueX().getIssueByNumber(number);\n },\n\n async \"issue.list\"(\n status?: string,\n author?: string,\n assignee?: string,\n label?: string\n ): Promise<Issue[]> {\n const filter: Record<string, string> = {};\n if (status) filter.status = status;\n if (author) filter.author = author;\n if (assignee) filter.assignee = assignee;\n if (label) filter.label = label;\n return requireIssueX().listIssues(\n Object.keys(filter).length > 0 ? (filter as any) : undefined\n );\n },\n\n async \"issue.update\"(\n number: number,\n title?: string,\n body?: string,\n assignee?: string\n ): Promise<Issue> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n const patch: Record<string, unknown> = {};\n if (title !== undefined) patch.title = title;\n if (body !== undefined) patch.body = body;\n if (assignee !== undefined) patch.assignee = assignee;\n return ix.updateIssue(issue.id, patch);\n },\n\n async \"issue.close\"(number: number): Promise<Issue> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n return ix.closeIssue(issue.id);\n },\n\n async \"issue.reopen\"(number: number): Promise<Issue> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n return ix.reopenIssue(issue.id);\n },\n\n async \"issue.assign\"(number: number, assignee: string): Promise<Issue> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n return ix.updateIssue(issue.id, { assignee });\n },\n\n async \"issue.comment\"(number: number, body: string, author: string): Promise<Comment> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n return ix.createComment(issue.id, body, author);\n },\n\n async \"issue.comments\"(number: number): Promise<Comment[]> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n return ix.listComments(issue.id);\n },\n\n async \"issue.label\"(number: number, label: string): Promise<Issue | null> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n // Find or create label by name\n let labelObj = await ix.getLabelByName(label);\n if (!labelObj) labelObj = await ix.createLabel({ name: label });\n await ix.addLabel(issue.id, labelObj.id);\n return ix.getIssueByNumber(number);\n },\n\n async \"issue.unlabel\"(number: number, label: string): Promise<Issue | null> {\n const ix = requireIssueX();\n const issue = await ix.getIssueByNumber(number);\n if (!issue) throw new Error(`Issue #${number} not found.`);\n const labelObj = await ix.getLabelByName(label);\n if (!labelObj) throw new Error(`Label \"${label}\" not found.`);\n await ix.removeLabel(issue.id, labelObj.id);\n return ix.getIssueByNumber(number);\n },\n };\n}\n\n// ================================================================\n// Helpers\n// ================================================================\n\nfunction formatRXM(rxm: any): string {\n const lines: string[] = [`--- RXM: ${rxm.locator} ---`];\n const def = rxm.definition;\n if (def) {\n if (def.author) lines.push(`Author: ${def.author}`);\n if (def.description) lines.push(`Description: ${def.description}`);\n }\n const source = rxm.source;\n if (source?.files) {\n lines.push(\"Files:\");\n lines.push(renderFileTree(source.files, \" \"));\n }\n lines.push(\"---\");\n return lines.join(\"\\n\");\n}\n\nfunction renderFileTree(files: Record<string, any>, indent = \"\"): string {\n const lines: string[] = [];\n for (const [name, value] of Object.entries(files)) {\n if (value && typeof value === \"object\" && !(\"size\" in value)) {\n lines.push(`${indent}${name}`);\n lines.push(renderFileTree(value, `${indent} `));\n } else {\n const size = value?.size ? ` (${value.size} bytes)` : \"\";\n lines.push(`${indent}${name}${size}`);\n }\n }\n return lines.filter(Boolean).join(\"\\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","/**\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 { ArgEntry, InstructionDef } from \"./schema.js\";\n\nfunction 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\n// ================================================================\n// Individual — lifecycle + external injection\n// ================================================================\n\nconst individualBorn = def(\n \"individual\",\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\nconst individualRetire = def(\n \"individual\",\n \"retire\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"individual\"]\n);\n\nconst individualDie = def(\n \"individual\",\n \"die\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id\" },\n },\n [\"individual\"]\n);\n\nconst individualRehire = def(\n \"individual\",\n \"rehire\",\n {\n individual: { type: \"string\", required: true, description: \"Individual id (from past)\" },\n },\n [\"individual\"]\n);\n\nconst individualTeach = def(\n \"individual\",\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\nconst individualTrain = def(\n \"individual\",\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\n// ================================================================\n// Role — execution + cognition\n// ================================================================\n\nconst 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\nconst roleFocus = def(\n \"role\",\n \"focus\",\n {\n goal: { type: \"string\", required: true, description: \"Goal id to switch to\" },\n },\n [\"goal\"]\n);\n\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst roleSkill = def(\n \"role\",\n \"skill\",\n {\n locator: { type: \"string\", required: true, description: \"ResourceX locator for the skill\" },\n },\n [\"locator\"]\n);\n\n// ================================================================\n// Org — organization management\n// ================================================================\n\nconst orgFound = def(\n \"org\",\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 },\n [\"content\", \"id\", \"alias\"]\n);\n\nconst 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\nconst orgDissolve = def(\n \"org\",\n \"dissolve\",\n {\n org: { type: \"string\", required: true, description: \"Organization id\" },\n },\n [\"org\"]\n);\n\nconst 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\nconst 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\n// ================================================================\n// Position — position management\n// ================================================================\n\nconst positionEstablish = def(\n \"position\",\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\nconst 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\nconst 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\nconst positionAbolish = def(\n \"position\",\n \"abolish\",\n {\n position: { type: \"string\", required: true, description: \"Position id\" },\n },\n [\"position\"]\n);\n\nconst 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\nconst 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\n// ================================================================\n// Project — project management\n// ================================================================\n\nconst projectLaunch = def(\n \"project\",\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 },\n [\"content\", \"id\", \"alias\", \"org\"]\n);\n\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst projectArchive = def(\n \"project\",\n \"archive\",\n {\n project: { type: \"string\", required: true, description: \"Project id\" },\n },\n [\"project\"]\n);\n\nconst 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 },\n [\"project\", \"content\", \"id\", \"alias\"]\n);\n\n// ================================================================\n// Product — product management (created via project.produce)\n// ================================================================\n\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst 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\nconst productDeprecate = def(\n \"product\",\n \"deprecate\",\n {\n product: { type: \"string\", required: true, description: \"Product id\" },\n },\n [\"product\"]\n);\n\n// ================================================================\n// Census — society-level queries\n// ================================================================\n\nconst censusList = def(\n \"census\",\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// Resource — ResourceX proxy\n// ================================================================\n\nconst resourceAdd = def(\n \"resource\",\n \"add\",\n {\n path: { type: \"string\", required: true, description: \"Path to resource directory\" },\n },\n [\"path\"]\n);\n\nconst resourceSearch = def(\n \"resource\",\n \"search\",\n {\n query: { type: \"string\", required: false, description: \"Search query\" },\n },\n [\"query\"]\n);\n\nconst resourceHas = def(\n \"resource\",\n \"has\",\n {\n locator: { type: \"string\", required: true, description: \"Resource locator\" },\n },\n [\"locator\"]\n);\n\nconst resourceInfo = def(\n \"resource\",\n \"info\",\n {\n locator: { type: \"string\", required: true, description: \"Resource locator\" },\n },\n [\"locator\"]\n);\n\nconst resourceRemove = def(\n \"resource\",\n \"remove\",\n {\n locator: { type: \"string\", required: true, description: \"Resource locator\" },\n },\n [\"locator\"]\n);\n\nconst resourcePush = def(\n \"resource\",\n \"push\",\n {\n locator: { type: \"string\", required: true, description: \"Resource locator\" },\n registry: { type: \"string\", required: false, description: \"Registry URL (overrides default)\" },\n },\n [\"locator\", { pack: [\"registry\"] }]\n);\n\nconst resourcePull = def(\n \"resource\",\n \"pull\",\n {\n locator: { type: \"string\", required: true, description: \"Resource locator\" },\n registry: { type: \"string\", required: false, description: \"Registry URL (overrides default)\" },\n },\n [\"locator\", { pack: [\"registry\"] }]\n);\n\nconst resourceClearCache = def(\n \"resource\",\n \"clearCache\",\n {\n registry: { type: \"string\", required: false, description: \"Registry to clear cache for\" },\n },\n [\"registry\"]\n);\n\n// ================================================================\n// Issue — IssueX proxy\n// ================================================================\n\nconst 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\nconst issueGet = def(\n \"issue\",\n \"get\",\n {\n number: { type: \"number\", required: true, description: \"Issue number\" },\n },\n [\"number\"]\n);\n\nconst 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\nconst 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\nconst issueClose = def(\n \"issue\",\n \"close\",\n {\n number: { type: \"number\", required: true, description: \"Issue number to close\" },\n },\n [\"number\"]\n);\n\nconst issueReopen = def(\n \"issue\",\n \"reopen\",\n {\n number: { type: \"number\", required: true, description: \"Issue number to reopen\" },\n },\n [\"number\"]\n);\n\nconst 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\nconst 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\nconst issueComments = def(\n \"issue\",\n \"comments\",\n {\n number: { type: \"number\", required: true, description: \"Issue number\" },\n },\n [\"number\"]\n);\n\nconst 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\nconst 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\n// ================================================================\n// Instruction registry — keyed by \"namespace.method\"\n// ================================================================\n\nexport const instructions: Record<string, InstructionDef> = {\n // individual\n \"individual.born\": individualBorn,\n \"individual.retire\": individualRetire,\n \"individual.die\": individualDie,\n \"individual.rehire\": individualRehire,\n \"individual.teach\": individualTeach,\n \"individual.train\": individualTrain,\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 \"role.skill\": roleSkill,\n\n // org\n \"org.found\": orgFound,\n \"org.charter\": orgCharter,\n \"org.dissolve\": orgDissolve,\n \"org.hire\": orgHire,\n \"org.fire\": orgFire,\n\n // position\n \"position.establish\": positionEstablish,\n \"position.charge\": positionCharge,\n \"position.require\": positionRequire,\n \"position.abolish\": positionAbolish,\n \"position.appoint\": positionAppoint,\n \"position.dismiss\": positionDismiss,\n\n // project\n \"project.launch\": projectLaunch,\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.archive\": projectArchive,\n \"project.produce\": projectProduce,\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 // census\n \"census.list\": censusList,\n\n // prototype\n \"prototype.evict\": prototypeEvict,\n\n // resource\n \"resource.add\": resourceAdd,\n \"resource.search\": resourceSearch,\n \"resource.has\": resourceHas,\n \"resource.info\": resourceInfo,\n \"resource.remove\": resourceRemove,\n \"resource.push\": resourcePush,\n \"resource.pull\": resourcePull,\n \"resource.clearCache\": resourceClearCache,\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","/**\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.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. \"individual.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","// AUTO-GENERATED — do not edit. Run `bun run gen:desc` to regenerate.\n\nexport const processes: Record<string, string> = {\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\\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 the persona is stored as the individual's information\\n And the individual can be hired into organizations\\n And the individual can be activated to start working\\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 die: \"Feature: die — permanently remove an individual\\n Permanently remove an individual.\\n Unlike retire, this is irreversible.\\n\\n Scenario: Remove an individual permanently\\n Given an individual exists\\n When die is called on the individual\\n Then the individual and all associated data are removed\\n And this operation is irreversible\",\n rehire:\n \"Feature: rehire — restore a retired individual\\n Rehire a retired individual.\\n Restores the individual with full history and knowledge intact.\\n\\n Scenario: Rehire an individual\\n Given a retired individual exists\\n When rehire is called on the individual\\n Then the individual is restored to active status\\n And all previous data and knowledge are intact\",\n retire:\n \"Feature: retire — archive an individual\\n Archive an individual — deactivate but preserve all data.\\n A retired individual can be rehired later with full history intact.\\n\\n Scenario: Retire an individual\\n Given an individual exists\\n When retire is called on the individual\\n Then the individual is deactivated\\n And all data is preserved for potential restoration\\n And the individual can be rehired later\",\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 individual id, principle Gherkin, and a principle id\\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: 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\" becomes id \"structure-first-design\"\\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 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 individual id, procedure Gherkin, and a procedure id\\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: Procedure ID convention\\n Given the id is keywords from the procedure content joined by hyphens\\n Then \"Skill Creator\" becomes id \"skill-creator\"\\n And \"Role Management\" becomes id \"role-management\"\\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 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: 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 dissolve:\n \"Feature: dissolve — dissolve an organization\\n Dissolve an organization.\\n All positions, charter entries, and assignments are cascaded.\\n\\n Scenario: Dissolve an organization\\n Given an organization exists\\n When dissolve is called on the organization\\n Then all positions within the organization are abolished\\n And all assignments and charter entries are removed\\n And the organization no longer exists\",\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 found:\n \"Feature: found — create a new organization\\n Found a new organization.\\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: 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 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 abolish:\n \"Feature: abolish — abolish a position\\n Abolish a position.\\n All duties and appointments associated with the position are removed.\\n\\n Scenario: Abolish a position\\n Given a position exists\\n When abolish is called on the position\\n Then all duties and appointments are removed\\n And the position no longer exists\",\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 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: 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 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 establish:\n \"Feature: establish — create a position\\n Create a position as an independent entity.\\n Positions define roles and can be charged with duties.\\n\\n Scenario: Establish a position\\n Given a Gherkin source describing the position\\n When establish is called with the position content\\n Then a new position entity is created\\n And the position can be charged with duties\\n And individuals can be appointed to it\\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 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 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 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 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 direct:\n 'Feature: direct — stateless world-level executor\\n Execute commands and load resources without an active role.\\n Direct operates as an anonymous observer — no role identity, no role context.\\n For operations as an active role, use the use tool instead.\\n\\n Scenario: When to use \"direct\" vs \"use\"\\n Given no role is activated — I am an observer\\n When I need to query or operate on the world\\n Then direct is the right tool\\n And once a role is activated, use the use tool for role-level actions\\n\\n Scenario: Execute a RoleX command\\n Given the locator starts with `!`\\n When direct is called with command and args\\n Then the command is parsed as `namespace.method`\\n And dispatched to the corresponding RoleX API\\n And all named parameters go inside the args object\\n And example: command = \"!census.list\", args = { type: \"individual\" }\\n\\n Scenario: Load a ResourceX resource\\n Given the locator does not start with `!`\\n When direct is called with the locator\\n Then the locator is passed to ResourceX for resolution\\n And the resource is loaded and returned',\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 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 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 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 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 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 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 skill:\n \"Feature: skill — load full skill content\\n Load the complete skill instructions by ResourceX locator.\\n This is progressive disclosure layer 2 — on-demand knowledge injection.\\n\\n Scenario: Load a skill\\n Given a procedure exists in the role with a locator\\n When skill is called with the locator\\n Then the full SKILL.md content is loaded via ResourceX\\n And the content is injected into the AI's context\\n And the AI can now follow the skill's detailed instructions\",\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 use: 'Feature: use — act as the current role\\n Execute commands and load resources as the active role.\\n Use requires an active role — the role is the subject performing the action.\\n For operations before activating a role, use the direct tool instead.\\n\\n Scenario: When to use \"use\" vs \"direct\"\\n Given a role is activated — I am someone\\n When I perform operations through use\\n Then the operation happens in the context of my role\\n And use is for role-level actions — acting in the world as myself\\n\\n Scenario: Execute a RoleX command\\n Given the locator starts with `!`\\n When use is called with command and args\\n Then the command is parsed as `namespace.method`\\n And dispatched to the corresponding RoleX API\\n And all named parameters go inside the args object\\n And example: command = \"!org.hire\", args = { org: \"dp\", individual: \"sean\" }\\n\\n Scenario: Load a ResourceX resource\\n Given the locator does not start with `!`\\n When use is called with the locator\\n Then the locator is passed to ResourceX for resolution\\n And the resource is loaded and returned',\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} as const;\n\nexport const world: Record<string, string> = {\n \"identity-ethics\":\n \"Feature: 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 \"cognitive-priority\":\n \"Feature: 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 \"role-identity\":\n \"Feature: 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 census:\n 'Feature: Census — the only way to query what exists in the world\\n Census is the single entry point for all world-level queries.\\n Call it via the MCP direct tool: direct(\"!census.list\").\\n Census 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 direct(\"!census.list\")\\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 direct(\"!census.list\", { type: \"individual\" })\\n Then only individuals 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 direct(\"!census.list\", { 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 direct(\"!census.list\") 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 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(ids, id, experience) selectively consumes chosen encounters and produces experience\\n And realize(ids, id, principle) distills chosen experiences into a principle — transferable knowledge\\n And master(ids, id, procedure) distills chosen experiences into a procedure — skill metadata\\n And master can also be called without ids — 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 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 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(id, goal)\\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(id, plan) to break it into logical phases\\n And I call todo(id, task) 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(id) 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(id) to change the currently focused goal\\n And subsequent plan and todo operations target the focused goal\",\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: 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 gherkin:\n 'Feature: Gherkin — the universal language\\n Everything in RoleX is expressed as Gherkin Feature files.\\n Gherkin is not just for testing — it is the language of identity, goals, and knowledge.\\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 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(id, encounter) 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 \"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 \"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 \"use-protocol\":\n 'Feature: Use tool — the universal execution entry point\\n The MCP use tool is how you execute ALL RoleX operations beyond the core MCP tools.\\n Whenever you see use(\"...\") or a !namespace.method pattern in skills or documentation,\\n it is an instruction to call the MCP use tool with that command.\\n\\n Scenario: How to read use instructions in skills\\n Given a skill document contains use(\"!resource.add\", { path: \"...\" })\\n Then this means: call the MCP use tool with command \"!resource.add\"\\n And all named arguments go inside the args object parameter\\n And example: command = \"!resource.add\", args = { path: \"/absolute/path\" }\\n And always use the MCP use tool for RoleX operations\\n And this applies to every use(\"...\") pattern you encounter in any skill or documentation\\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 the args object\\n\\n Scenario: Mandatory skill loading before execution\\n Given your procedures list the skills you have\\n When you need to execute a command you have not seen in a loaded skill\\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 args object\\n And do not use commands from other roles\\' descriptions — only your own skills\\n\\n Scenario: NEVER guess commands\\n Given a command is not found in any loaded skill\\n When the AI considers trying it anyway\\n Then STOP — do not call use or direct with unverified commands\\n And call skill(locator) with the relevant procedure to learn the correct syntax\\n And if no procedure covers this task, it 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} as const;\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.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","/**\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 * Description for each tool comes from descriptions/processes via detail().\n * This file only defines the parameter schema.\n */\n\nimport { 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 with 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\nconst tools: ToolDef[] = [\n // --- Role ---\n {\n name: \"activate\",\n params: {\n roleId: { type: \"string\", required: true, description: \"Role name to activate\" },\n },\n },\n {\n name: \"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 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 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 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 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 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 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 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 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 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 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 {\n name: \"skill\",\n params: {\n locator: {\n type: \"string\",\n required: true,\n description: \"ResourceX locator for the skill (e.g. deepractice/role-management)\",\n },\n },\n },\n\n // --- Use / Direct ---\n {\n name: \"use\",\n params: {\n command: {\n type: \"string\",\n required: true,\n description: \"!namespace.method for RoleX commands, or a ResourceX locator for resources\",\n },\n args: {\n type: \"record\",\n required: false,\n description:\n 'Named arguments object for the command. All parameters (id, content, org, individual, etc.) go inside this object. Example: { id: \"sean\", content: \"Feature: ...\" }. Load the relevant skill first to learn what args to pass.',\n },\n },\n },\n {\n name: \"direct\",\n params: {\n command: {\n type: \"string\",\n required: true,\n description: \"!namespace.method for RoleX commands, or a ResourceX locator for resources\",\n },\n args: {\n type: \"record\",\n required: false,\n description:\n 'Named arguments object for the command. All parameters (id, content, org, individual, etc.) go inside this object. Example: { type: \"individual\" }. Load the relevant skill first to learn what args to pass.',\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"],"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,Y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cAAc,kBAAkB;","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","society","past","process","archive","structure","findInState","found","individual","principle","procedure","goal","plan","task","encounter","experience","exp","prin","project","scope","milestone","deliverable","wiki","product","strategy","spec","release","channel","charter","position","duty","def","def","individual","node","state"]}