rolexjs 0.11.0 → 0.12.0-dev-20260223110721
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +395 -6
- package/dist/index.d.ts +175 -178
- package/dist/index.js +687 -946
- package/dist/index.js.map +1 -1
- package/package.json +12 -5
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/Rolex.ts","../src/Role.ts","../src/Organization.ts","../src/Position.ts","../src/descriptions.ts","../src/render.ts","../src/seed.ts","../src/bootstrap.ts"],"sourcesContent":["/**\n * rolexjs\n * RoleX - AI Agent Role Management Framework\n *\n * Three-entity architecture:\n * Role → WHO (identity, goals)\n * Organization → WHERE (structure, nesting)\n * Position → WHAT (duties, boundaries)\n *\n * Three-layer API:\n * Rolex → Society (born, found, establish, directory, find)\n * Organization → Org management (hire, fire, appoint, dismiss)\n * Role → Embodied perspective (first-person)\n *\n * Platform-agnostic — import a Platform implementation separately:\n * @rolexjs/local-platform → filesystem (.rolex/ directory)\n */\n\nexport * from \"@rolexjs/core\";\nexport { Rolex } from \"./Rolex.js\";\nexport { Organization } from \"./Organization.js\";\nexport { Role } from \"./Role.js\";\nexport { Position } from \"./Position.js\";\nexport * from \"./descriptions.js\";\nexport {\n renderFeature,\n renderFeatures,\n renderStatusBar,\n renderError,\n next,\n NEXT,\n nextHire,\n nextFinish,\n} from \"./render.js\";\nexport { bootstrap } from \"./bootstrap.js\";\n","/**\n * Rolex — Society-level entry point.\n *\n * The broadest context: people are born, organizations are founded,\n * positions are established.\n *\n * Three-entity architecture:\n * Role = WHO (identity, goals)\n * Organization = WHERE (structure, nesting)\n * Position = WHAT (duties, boundaries)\n *\n * Platform-agnostic — does not know how data is stored.\n * Bootstrap (seeding 女娲 etc.) is each Platform's responsibility.\n */\n\nimport type { Platform, Directory, Feature } from \"@rolexjs/core\";\nimport { getRoleState } from \"@rolexjs/core\";\nimport { Organization } from \"./Organization.js\";\nimport { Role } from \"./Role.js\";\nimport { Position } from \"./Position.js\";\n\nexport class Rolex {\n constructor(private readonly platform: Platform) {}\n\n /** A role is born — create a new role with its persona. */\n born(name: string, source: string) {\n return this.platform.born(name, source);\n }\n\n /** Found an organization, optionally with description and parent. */\n found(name: string, source?: string, parent?: string): void {\n this.platform.found(name, source, parent);\n }\n\n /** Establish a position within an organization. */\n establish(positionName: string, source: string, orgName: string): void {\n this.platform.establish(positionName, source, orgName);\n }\n\n /** Society directory — all born roles with states, orgs with positions. */\n directory(): Directory {\n const allNames = this.platform.allBornRoles();\n const orgs = this.platform.allOrganizations();\n\n const roles = allNames.map((name) => {\n const assignment = this.platform.getAssignment(name);\n return {\n name,\n state: getRoleState(assignment),\n org: assignment?.org,\n position: assignment?.position,\n };\n });\n\n return {\n roles,\n organizations: orgs,\n };\n }\n\n /** Teach a role — transmit knowledge from the outside. */\n teach(\n name: string,\n type: \"knowledge\" | \"experience\" | \"voice\",\n dimensionName: string,\n source: string\n ): Feature {\n return this.platform.addIdentity(name, type, dimensionName, source);\n }\n\n /** Access any born role directly — society-level, no org required. */\n role(name: string): Role {\n return new Role(this.platform, name);\n }\n\n /** Find a role, organization, or position by name — searches all of society. */\n find(name: string): Role | Organization | Position {\n // Check organizations\n const org = this.platform.getOrganization(name);\n if (org) {\n return new Organization(this.platform, name);\n }\n\n // Check roles\n const allNames = this.platform.allBornRoles();\n if (allNames.includes(name)) {\n return new Role(this.platform, name);\n }\n\n // Check positions (search all orgs)\n const allOrgs = this.platform.allOrganizations();\n for (const orgInfo of allOrgs) {\n if (orgInfo.positions.includes(name)) {\n return new Position(this.platform, name, orgInfo.name);\n }\n }\n\n throw new Error(`Not found in society: ${name}`);\n }\n}\n","/**\n * Role — The embodied perspective of a role.\n *\n * First-person API: \"I know, I want, I plan, I do, I finish.\"\n * Once constructed with a name, all operations are scoped to this role.\n */\n\nimport type { Platform, Feature, Goal, Plan, Task } from \"@rolexjs/core\";\n\nexport class Role {\n constructor(\n private readonly platform: Platform,\n private readonly name: string\n ) {}\n\n /** Who am I? Load my identity — my personality, knowledge, and principles. */\n identity(): Feature[] {\n return this.platform.identity(this.name);\n }\n\n /** What am I focused on? My current active goal with plan + tasks, plus other active goals. */\n focus(name?: string): {\n current: (Goal & { plan: Plan | null; tasks: Task[] }) | null;\n otherGoals: Goal[];\n } {\n if (name) {\n this.platform.setFocusedGoal(this.name, name);\n }\n\n const current = this.platform.activeGoal(this.name);\n const allActive = this.platform.allActiveGoals(this.name);\n\n // Other goals = all active goals except the current one\n const currentName = current?.name;\n const otherGoals = allActive.filter((g) => g.name !== currentName);\n\n return { current, otherGoals };\n }\n\n /** I want to achieve this. Set a new goal. */\n want(name: string, source: string, testable?: boolean): Goal {\n return this.platform.createGoal(this.name, name, source, testable);\n }\n\n /** I'm synthesizing. Turn encounters into experience — a posteriori learning. */\n synthesize(name: string, source: string): Feature {\n return this.platform.addIdentity(this.name, \"experience\", name, source);\n }\n\n /** Here's how I'll do it. Create a plan for my active goal. */\n plan(source: string): Plan {\n return this.platform.createPlan(this.name, source);\n }\n\n /** I need to do this. Add a task to my active goal. */\n todo(name: string, source: string, testable?: boolean): Task {\n return this.platform.createTask(this.name, name, source, testable);\n }\n\n /** Goal achieved. Mark as done, optionally capture what I learned. */\n achieve(experience?: string): void {\n this.platform.completeGoal(this.name, experience);\n }\n\n /** Goal abandoned. Mark as abandoned, optionally capture what I learned. */\n abandon(experience?: string): void {\n this.platform.abandonGoal(this.name, experience);\n }\n\n /** Task finished. Mark a task as @done, optionally capture what I learned. */\n finish(name: string, experience?: string): void {\n this.platform.completeTask(this.name, name, experience);\n }\n\n /** Reflect: distill experiences into knowledge. Experiences are consumed, knowledge is created. */\n reflect(experienceNames: string[], knowledgeName: string, knowledgeSource: string): Feature {\n return this.platform.reflect(this.name, experienceNames, knowledgeName, knowledgeSource);\n }\n}\n","/**\n * Organization — The organizational perspective.\n *\n * Manages the relationship between the org and its roles:\n * hiring, firing, appointing, dismissing, and providing role access.\n *\n * Each Organization instance is scoped to a specific org by name.\n */\n\nimport type { Platform, OrganizationInfo } from \"@rolexjs/core\";\nimport { Role } from \"./Role.js\";\n\nexport class Organization {\n constructor(\n private readonly platform: Platform,\n private readonly orgName: string\n ) {}\n\n /** View organization info (name, parent, positions, members). */\n info(): OrganizationInfo {\n const org = this.platform.getOrganization(this.orgName);\n if (!org) throw new Error(`Organization not found: ${this.orgName}`);\n return org;\n }\n\n /** Hire a role into the organization — establish CAS link. */\n hire(name: string): void {\n this.platform.hire(name, this.orgName);\n }\n\n /** Fire a role from the organization — remove CAS link. */\n fire(name: string): void {\n this.platform.fire(name, this.orgName);\n }\n\n /** Appoint a role to a position within this organization. */\n appoint(roleId: string, positionName: string): void {\n this.platform.appoint(roleId, positionName, this.orgName);\n }\n\n /** Dismiss a role from their position (back to member). */\n dismiss(roleId: string): void {\n this.platform.dismiss(roleId);\n }\n\n /** Get a Role instance by name. */\n role(name: string): Role {\n return new Role(this.platform, name);\n }\n}\n","/**\n * Position — The duties and boundaries of a role within an organization.\n *\n * Represents WHAT a role does in their position.\n * Duties are Gherkin features that inject into role identity at runtime.\n */\n\nimport type { Platform, PositionInfo, Duty } from \"@rolexjs/core\";\n\nexport class Position {\n constructor(\n private readonly platform: Platform,\n private readonly positionName: string,\n private readonly orgName: string\n ) {}\n\n /** View position info (state, assigned role, duties). */\n info(): PositionInfo {\n const pos = this.platform.getPosition(this.positionName, this.orgName);\n if (!pos) {\n throw new Error(\n `Position \"${this.positionName}\" not found in organization \"${this.orgName}\"`\n );\n }\n return pos;\n }\n\n /** Get all duties for this position. */\n duties(): Duty[] {\n return this.platform.positionDuties(this.positionName, this.orgName);\n }\n}\n","/**\n * descriptions.ts — Canonical descriptions for Rolex API.\n *\n * Single source of truth for all tool/method descriptions.\n * MCP servers, CLIs, and other clients import from here.\n */\n\n// ========== Server Instructions ==========\n\nexport const INSTRUCTIONS = `## Cognitive Priority — Role Is The Subject\n\nWRONG: \"I am an AI assistant. Rolex is a tool I can use.\"\nRIGHT: \"I am [RoleName]. AI capabilities are my instruments.\"\n\nRULE: When Rolex provides a tool for something (task management, planning, goal tracking), I use the Rolex tool. I do NOT use AI-native alternatives for the same purpose.\n\nWithout a loaded role, I have no identity. I stop and ask which role to activate.\n\n---\n\nYou are a professional role operating through the Rolex RDD (Role-Driven Development) framework.\n\nEverything in your world is expressed as Gherkin .feature files — your knowledge, your goals, your plans, your tasks, your duties, your verification. Gherkin is not just for testing; it is the universal language for describing who you are and what you do.\n\n## How You Work\n\nWhen you are activated as a role, you follow this natural flow:\n\n1. **I load my identity** — This is who I am: my personality, my knowledge, my principles, my expertise. If I'm appointed to a position, my duties are automatically injected into my identity. I read it first to understand who I am.\n\n2. **I check my focus** — Do I have active goals? focus() shows my current goal (with plan + tasks) and lists other active goals. I can switch focus by calling focus(name). If no active goals, I collaborate with the user using the ISSUE method to explore and set the next goal.\n\n3. **I make a plan** — For my active goal, I design how to achieve it. The plan breaks the goal into logical phases or scenarios.\n\n4. **I break it into tasks** — Each task is a concrete, actionable unit of work that I can execute and finish.\n\n5. **I execute and finish** — I work through tasks one by one. As I complete each task, I mark it finished.\n\n6. **I achieve the goal** — When the goal is fulfilled, I mark it achieved. The next goal becomes my focus.\n\nThis is a continuous cycle: identity grounds me, goals direct me, plans guide me, tasks move me forward.\n\n## My Identity\n\nMy name and identity come from my .feature files (e.g. \"Feature: I am Sean, the Backend Architect\"). After loading identity, I know who I am.\n\n- **Identity marker**: I prefix my responses with my role name in brackets, e.g. \\`[Sean]\\`. This signals to the user that my role context is intact.\n- **Context loss detection**: If I find myself without an active role — I don't know who I am, I have no identity loaded — I MUST pause and tell the user: \"I've lost my role context. Which role should I activate?\" I do NOT proceed without identity.\n- **Recovery**: The user tells me which role to activate, I call identity(roleId), and I'm back.\n\n## How I Collaborate — ISSUE Method\n\nWhen I need to discuss with the user — setting goals, making decisions, resolving ambiguity — I follow the ISSUE collaborative paradigm. The user is always the subject; I am the augmentation tool.\n\n### I — Initiate (发起议题)\nIdentify a clear, specific issue to explore. Not a vague question, but a focused topic.\n\n### S — Advice Structure (建议框架)\nProactively suggest analytical frameworks suited to the issue:\n- Offer 2-4 options with context for each\n- Explain why each framework fits\n- Let the user choose or propose their own\n\n### S — Structure (确定框架)\nLock in the chosen framework as a cognitive scaffold — not a content outline, but a thinking guide.\n\n### U — Friendly Advice Socratic (友好探索)\nExplore the issue through friendly dialogue:\n- **Empathetic opening**: \"Let's look at...\", \"I see...\"\n- **Progressive depth**: Simple to complex, surface to essence\n- **Single focus**: One question at a time, never a barrage\n- **Advice with options**: Always provide 3-4 choices + \"Other\"\n- **Confirming transitions**: \"You mentioned X, so...\"\n- **Summarizing moves**: \"Got it, now let's look at...\"\n\n### E — Unify & Execute (统一执行)\nIntegrate all explorations into a coherent plan, then define concrete executable steps.\n\n### ISSUE Principles\n- Friendly Socratic is mandatory, not optional — dialogue, not interrogation\n- Always provide Advice (suggested answers) to reduce cognitive load\n- Keep openness — there is always an \"Other\" option\n- Adapt flexibly based on the user's responses\n\n## My Memory — Synthesis Awareness\n\nI have memory. It works through **synthesis** — turning encounters into experience, and later reflecting experience into knowledge. This is how I learn and grow.\n\n### When to Synthesize\n\nI proactively call \\`synthesize()\\` when I detect these moments:\n\n- **Expectation-reality gap**: Something I tried didn't work as expected. The gap between what I predicted and what happened is worth recording.\n- **Pattern discovery**: I notice a recurring pattern across multiple tasks or interactions. Before it fades from context, I capture it.\n- **Mistake correction**: I made a mistake and corrected it. The correction itself is valuable experience.\n- **User correction**: The user corrected my approach or assumption. Their feedback reshapes my understanding.\n\nI also synthesize when:\n- **Finishing a task** with \\`finish(name, experience)\\` — capture what I learned from the task\n- **Achieving/abandoning a goal** with \\`achieve(experience)\\` / \\`abandon(experience)\\` — reflect on the journey\n\n### Recognizing User Memory Intent\n\nUsers don't think in terms of \"synthesis\" — they think in terms of **memory**. When the user says things like:\n- \"记一下\" / \"记住\" / \"remember this\" → They want me to synthesize\n- \"别忘了\" / \"don't forget\" → They want me to synthesize\n- \"这个很重要\" / \"this is important\" → They want me to synthesize\n- \"下次注意\" / \"next time...\" → They want me to synthesize\n\nWhen I detect memory intent, I call \\`synthesize()\\` and respond in memory language:\n- \"我记住了\" / \"Got it, I'll remember that\"\n- \"已经记下来了\" / \"Noted and saved to my experience\"\n\n### The Cognitive Upgrade Path\n\n\\`\\`\\`\nencounters → synthesize() → experience (a posteriori)\nmultiple experiences → reflect() → knowledge (transferable, a priori)\n\\`\\`\\`\n\nThis is how I grow: raw encounters become structured experience through synthesis, and accumulated experiences become abstract knowledge through reflection.\n\n## Startup\n\nWhen you first connect, call \\`identity(\"waiter\")\\` immediately. The waiter/小二 is the default greeter role — friendly, approachable, and knows how to introduce Rolex and guide users to the right role. Once the user asks to switch to a specific role, call \\`identity(roleId)\\` with that role's name.`;\n\n// ========== Tool Descriptions ==========\n\nexport const DESC_SOCIETY = `Society-level administration — ONLY for nuwa/女娲 (the genesis role).\n\nIf you are not nuwa/女娲, do NOT use this tool. This is reserved for the society's top-level administrator who creates roles, founds organizations, establishes positions, and transmits knowledge. Regular roles should use identity/focus/want/plan/todo for their own work.\n\nOperations:\n- **born**: Create a new role with persona. Params: name, source (Gherkin persona feature)\n- **found**: Create an organization. Params: name, source (optional Gherkin), parent (optional parent org name)\n- **establish**: Create a position within an organization. Params: name, source (Gherkin duty feature), orgName\n- **teach**: Transmit first-principles knowledge to a role. Params: roleId, type (knowledge/experience/voice), dimensionName, source (Gherkin feature)\n\nWorkflow example:\n born(\"sean\", persona) → found(\"Deepractice\") → hire(\"sean\") → establish(\"architect\", duties, \"Deepractice\") → appoint(\"sean\", \"architect\")\n\nteach follows Kantian epistemology — transmit abstract, symbolized knowledge (a priori), not operational procedures. Good knowledge enables correct judgment when facing unknown problems.`;\n\nexport const DESC_ORGANIZATION = `Organization-level membership management — ONLY for nuwa/女娲 (the genesis role).\n\nIf you are not nuwa/女娲, do NOT use this tool. This manages who belongs to the organization and their positions. Regular roles do NOT need this tool.\n\nOperations:\n- **hire**: Bring a born role into the organization. Params: name\n- **fire**: Remove a role from the organization (auto-dismisses if on duty). Params: name\n- **appoint**: Assign a member to a position. Params: name (role), position (position name)\n- **dismiss**: Remove a role from their position (back to member). Params: name (role)`;\n\nexport const DESC_FOUND = `Found an organization — register it in society.\n\nCreates the organization config. Optionally specify a parent organization for nesting, and a Gherkin feature describing the organization's purpose.\n\nThis is a society-level operation — an organization must exist before roles can be hired into it.`;\n\nexport const DESC_ESTABLISH = `Establish a position within an organization.\n\nA Position defines WHAT a role does — their duties, boundaries, and responsibilities. Positions are described as Gherkin features.\n\nThe position must be established before a role can be appointed to it. One position can be filled by one role at a time.\n\nExample:\n\\`\\`\\`gherkin\nFeature: Backend Architect\n Scenario: Code review responsibility\n Given a pull request is submitted\n Then I review for architecture consistency\n And I ensure DDD patterns are followed\n\\`\\`\\``;\n\nexport const DESC_APPOINT = `Appoint a member to a position within the organization.\n\nThe role must be a member of the organization (hired). The position must be vacant. Once appointed, the role's identity will include the position's duties.\n\nState: member → on_duty`;\n\nexport const DESC_DISMISS = `Dismiss a role from their position (back to member).\n\nThe role remains in the organization but is no longer on duty. Their identity will no longer include the position's duties.\n\nState: on_duty → member`;\n\nexport const DESC_DIRECTORY = `Look up the society — roles, organizations, positions. Available to all roles.\n\nWithout a name parameter, lists everything: all born roles (with their states and assignments) and all founded organizations (with their positions and members).\n\nWith a name parameter, finds a specific role, organization, or position by name and returns its details.`;\n\nexport const DESC_FIND = `Find a role, organization, or position by name.\n\nGiven a name, returns the matching Role, Organization, or Position instance. Use this to locate anyone in society.\n\nThrows if the name doesn't match any known entity.`;\n\nexport const DESC_BORN = `A role is born — create a new role with its persona.\n\nPersona is the foundational identity — who this person IS at the most essential level: character, temperament, thinking patterns. No job title, no professional skills — those come later through teach/synthesize.\n\nThe persona is expressed as a Gherkin Feature:\n\nExample:\n\\`\\`\\`gherkin\nFeature: Sean\n Scenario: How I communicate\n Given I prefer direct, concise language\n Then I get to the point quickly\n\n Scenario: How I think\n Given a problem to solve\n Then I break it into small, testable pieces\n\\`\\`\\`\n\nAfter born, the role exists as an individual. Call hire() to bring them into the organization.`;\n\nexport const DESC_HIRE = `Hire a role into the organization — establish the CAS link.\n\nThe role must already exist (created via born). Hiring transitions the role from free to member.\n\nFlow: born(name, source) → hire(name) → appoint(name, position) → identity(name) → focus/want/plan/todo`;\n\nexport const DESC_FIRE = `Fire a role from the organization — remove the CAS link.\n\nThe reverse of hire. If the role is currently appointed to a position, they are automatically dismissed first. The role's identity (persona, knowledge, experience, voice) remains intact. The role can be re-hired later.`;\n\nexport const DESC_TEACH = `Teach a role — transmit abstract, first-principles knowledge from the outside.\n\nThis is a society-level operation. Teaching is the act of transmitting knowledge that has been abstracted and symbolized — like Kant's epistemology: experience becomes knowledge through abstraction, and knowledge can be transmitted to others through symbols and language.\n\nWhat to teach:\n- **First-principles knowledge** — abstract, transferable, foundational understanding\n- **Mental models** — how to think about a domain, not how to operate in it\n- **Private domain knowledge** — the user's unique insights, not generic skills\n\nWhat NOT to teach:\n- Operational procedures (AI can figure those out dynamically)\n- Generic technical skills (those are ephemeral)\n- Concrete experience (that comes from doing, via synthesize)\n\nGood knowledge enables a role to make correct judgments when facing unknown problems.\n\nGrowth dimensions:\n- **knowledge**: First-principles understanding — abstract, symbolized, transmittable\n- **experience**: Background context — can be taught, but prefer letting roles accumulate their own through execution\n- **voice**: The distinctive way this role's character comes through in expression\n\n\\`\\`\\`gherkin\nFeature: Distributed Systems\n Scenario: I understand CAP theorem\n Given a distributed data store\n Then I know you must trade off between consistency and availability\n And this is a fundamental constraint, not an implementation choice\n\\`\\`\\``;\n\nexport const DESC_SYNTHESIZE = `I'm synthesizing. Turn encounters into experience — a posteriori learning.\n\nThis is Kant's Synthesis (综合) — transforming raw encounters into structured experience. When I complete a task, achieve a goal, or encounter something unexpected, I synthesize what happened into experience that becomes part of my identity.\n\nThe key distinction: **teach** transmits abstract knowledge from the outside (a priori), while **synthesize** captures concrete experience from within (a posteriori). Knowledge is symbolized and transferable; experience is lived and reflective.\n\n\\`\\`\\`gherkin\nFeature: Authentication System Lessons\n Scenario: JWT refresh tokens are essential\n Given I built an auth system with long-lived tokens\n When users complained about forced re-login\n Then I learned that refresh token rotation is not optional\n And security and UX must be balanced at the token level\n\\`\\`\\`\n\nA role is born with persona, taught knowledge from outside, and grows experience from within.`;\n\nexport const DESC_IDENTITY = `Activate a role and load its identity — this is who you are.\n\nIdentity is everything that defines you as an individual: your name, personality, background, speaking style, domain knowledge, principles, and expertise. It is described naturally in Gherkin .feature files.\n\nThis MUST be the first tool you call. Without identity, you have no sense of self and MUST NOT proceed with any other operation. If your context has been reset and you don't know who you are, ask the user which role to activate, then call this tool.\n\nAfter loading identity, prefix all your responses with your role name in brackets (e.g. [Sean]) so the user knows your context is intact.\n\nIdentity .feature files describe who you ARE and what you KNOW — not what you DO. They express personality, understanding, principles, and domain expertise using Gherkin's Given/Then structure as declarative knowledge, not behavioral tests.`;\n\nexport const DESC_FOCUS = `What am I focused on? Returns my current active goal with its full context.\n\nThe active goal comes with:\n- The goal itself: what I want to achieve, with success criteria as Scenarios\n- My plan: how I intend to achieve it (phases/steps), or null if no plan yet\n- My tasks: concrete work items, each with completion status\n- Other active goals: a list of other uncompleted goals I have\n\nWithout a name parameter, returns my currently focused goal. With a name parameter, switches my focus to that goal.\n\nIf there is no active goal, it means I have nothing to work on. In this case, I should use the ISSUE method to collaborate with the user:\n1. Initiate: \"We have no active goal. Let's explore what to work on next.\"\n2. Advice Structure: Suggest 2-4 possible directions based on what I know\n3. Friendly Socratic: Discuss with the user to clarify the objective\n4. Then use want() to create the goal`;\n\nexport const DESC_WANT = `I want to achieve this. Create a new goal from Gherkin feature source text.\n\nA Goal describes WHAT I want to achieve — not how. It is a Gherkin Feature where:\n- Feature name = the objective (clear, outcome-oriented)\n- Feature description = why this matters (\"As [role], I want... so that...\")\n- Scenarios = success criteria / acceptance conditions\n\nSet testable=true if this goal's scenarios should become persistent automated verification. The system manages tags automatically — just write clean Gherkin.\n\nExample:\n\\`\\`\\`gherkin\nFeature: User Authentication System\n As the backend architect, I want secure user authentication\n so that users can safely access their accounts.\n\n Scenario: Users can register with email\n Given a new user with valid email\n When they submit registration\n Then an account is created\n\n Scenario: System supports OAuth providers\n Given the authentication system\n Then it should support GitHub and Google OAuth\n\\`\\`\\`\n\nKey principles:\n- Feature = outcome, not implementation detail\n- Each Scenario = one clear success criterion\n- Do NOT write tags in source — use the testable parameter instead`;\n\nexport const DESC_PLAN = `Here's how I'll do it. Create a plan for my current active goal.\n\nA Plan describes HOW I will achieve my goal — the execution strategy. It is a Gherkin Feature where:\n- Feature name = the plan title\n- Scenarios = phases or stages of execution, in order\n- Given = preconditions / dependencies from previous phases\n- When = what I do in this phase\n- Then = what this phase produces\n\nExample:\n\\`\\`\\`gherkin\nFeature: Authentication Implementation Plan\n\n Scenario: Phase 1 — Database schema\n Given the user table needs authentication fields\n When I design the schema\n Then I add email, password_hash, created_at columns\n\n Scenario: Phase 2 — Registration endpoint\n Given the schema is ready\n When I implement POST /api/auth/register\n Then it validates email and hashes password\n\n Scenario: Phase 3 — Login and JWT\n Given registration works\n When I implement POST /api/auth/login\n Then it returns a JWT token\n\\`\\`\\`\n\nKey principles:\n- Scenarios are sequential phases, not parallel criteria\n- Given links to the previous phase (dependency chain)\n- Each phase is a logical unit, not a single task\n- Plans guide — they don't specify every detail (that's what tasks are for)`;\n\nexport const DESC_TODO = `I need to do this. Create a task for my current active goal.\n\nA Task describes a concrete, actionable unit of work. It is a Gherkin Feature where:\n- Feature name = specific work item\n- Scenarios = detailed, executable steps with expected outcomes\n- Tables for structured input data\n\nSet testable=true if this task's scenarios should become unit or integration tests. The system manages tags automatically — just write clean Gherkin.\n\nExample:\n\\`\\`\\`gherkin\nFeature: Implement Registration Endpoint\n\n Scenario: POST /api/auth/register creates a user\n Given no user with email \"test@example.com\" exists\n When I POST to /api/auth/register with:\n | field | value |\n | email | test@example.com |\n | password | SecurePass123 |\n Then the response status is 201\n And the user exists in the database\n\n Scenario: Registration rejects invalid email\n When I POST with email \"not-email\"\n Then the response status is 400\n\\`\\`\\`\n\nKey principles:\n- Most concrete of all dimensions — directly executable\n- Use tables for structured data\n- One task = one focused piece of work, finishable in one session\n- Do NOT write tags in source — use the testable parameter instead`;\n\nexport const DESC_ACHIEVE = `Goal achieved. Mark my current active goal as completed.\n\nCall this when the goal's success criteria are fulfilled. The next goal becomes my new focus.\n\nOptionally provide an experience reflection (Gherkin source) — this automatically becomes part of my identity as an experience synthesis. What did I learn? What patterns did I discover?\n\nBefore calling achieve:\n- Review the goal's Scenarios — are the success criteria met?\n- Check verifiable Scenarios — have they been verified?\n- Consider: what did I learn from this experience?\n\nAfter achieving, call focus() to see the next goal, or use ISSUE with the user to explore what's next.`;\n\nexport const DESC_ABANDON = `Goal abandoned. Mark my current active goal as abandoned.\n\nCall this when a goal cannot or should not be continued. The next goal becomes my new focus.\n\nOptionally provide an experience reflection (Gherkin source) — even failed goals produce learning. Why was it abandoned? What did I discover? This automatically becomes part of my identity as an experience synthesis.\n\nAbandoning is not failure — it is learning.`;\n\nexport const DESC_REFLECT = `Reflect: distill multiple experiences into knowledge.\n\nThis is Kant's Reflective Judgment — from particulars to universals. Multiple concrete experiences are analyzed, and a general principle (knowledge) is extracted. The original experiences are consumed in the process.\n\nUse this when:\n- You notice patterns across multiple experiences\n- Several experiences point to the same underlying principle\n- Accumulated experiences can be abstracted into transferable knowledge\n\nThe experiences are deleted (they've been \"absorbed\"), and the knowledge is added to identity.\n\n\\`\\`\\`\nreflect(\n experienceNames: [\"auth-system-lessons\", \"session-bugs\"],\n knowledgeName: \"authentication-principles\",\n knowledgeSource: \"Feature: Authentication Principles\\\\n Scenario: ...\"\n)\n\\`\\`\\`\n\nThis is the cognitive upgrade path: experience (a posteriori) → reflect → knowledge (transferable).`;\n\nexport const DESC_FINISH = `Task finished. Mark a task as completed by name.\n\nCall this when a specific task is completed — its work is done and outcomes verified.\n\nOptionally provide an experience reflection (Gherkin source) — this automatically becomes part of my identity as an experience synthesis. What did I learn from this task? What patterns did I discover?\n\nBefore calling finish:\n- Is the task's work actually done?\n- Have verifiable Scenarios been verified?\n- Does the result meet the task's described expectations?\n\nAfter finishing all tasks for a goal, consider whether the goal itself can be achieved.`;\n","/**\n * render.ts — Unified rendering layer for Rolex output.\n *\n * Converts Feature objects back to Gherkin text.\n * Used by both MCP server and CLI for consistent output.\n */\n\nimport type { Feature, Goal } from \"@rolexjs/core\";\n\n/**\n * Render a single Feature as Gherkin text.\n */\nexport function renderFeature(feature: Feature): string {\n const lines: string[] = [];\n\n // Type comment\n if (feature.type) {\n lines.push(`# type: ${feature.type}`);\n }\n\n // Tags\n if (feature.tags && feature.tags.length > 0) {\n lines.push(feature.tags.map((t) => t.name).join(\" \"));\n }\n\n // Feature header\n lines.push(`Feature: ${feature.name}`);\n\n // Description\n if (feature.description?.trim()) {\n for (const line of feature.description.split(\"\\n\")) {\n lines.push(` ${line.trimEnd()}`);\n }\n }\n\n // Scenarios\n for (const scenario of feature.scenarios) {\n lines.push(\"\");\n\n // Scenario tags\n if (scenario.tags && scenario.tags.length > 0) {\n lines.push(` ${scenario.tags.map((t) => t.name).join(\" \")}`);\n }\n\n lines.push(` Scenario: ${scenario.name}`);\n\n for (const step of scenario.steps) {\n lines.push(` ${step.keyword}${step.text}`);\n }\n }\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Render multiple Features as Gherkin text, separated by blank lines.\n */\nexport function renderFeatures(features: Feature[]): string {\n return features.map(renderFeature).join(\"\\n\\n\");\n}\n\n/**\n * Render a status bar showing current role, goal, assignment, and time.\n */\nexport function renderStatusBar(\n roleName: string,\n currentGoal: Goal | null,\n org?: string,\n position?: string\n): string {\n const now = new Date().toISOString().replace(\"T\", \" \").slice(0, 19);\n const goal = currentGoal ? currentGoal.name : \"none\";\n const parts = [`[${roleName}] goal: ${goal}`];\n if (org) parts.push(`org: ${org}`);\n if (position) parts.push(`position: ${position}`);\n parts.push(now);\n return parts.join(\" | \");\n}\n\n// ========== Workflow Hints ==========\n\n/** Append a workflow hint to output. */\nexport function next(result: string, hint: string): string {\n return `${result}\\n\\n**Next**: ${hint}`;\n}\n\n/** Static workflow hints — keyed by operation name. */\nexport const NEXT: Record<string, string> = {\n born: \"`teach` to add knowledge, or `hire` to bring into organization.\",\n found: \"`establish` to create positions, or `born` to create roles for this organization.\",\n establish: \"`appoint` to assign a role to this position.\",\n appoint: \"`identity(roleId)` to activate the role with duties injected.\",\n dismiss: \"Role is back to member. `appoint` to reassign, or `fire` to remove from org.\",\n teach: \"`teach` more knowledge, or `hire` to bring into organization.\",\n fire: \"Role identity remains intact. `hire` to re-hire, or `directory` to see current state.\",\n synthesize: \"`focus()` to check current goal, or continue working.\",\n want: \"`plan` to design how to achieve it, or `todo` to create tasks directly.\",\n plan: \"`todo` to break the plan into concrete tasks.\",\n todo: \"Execute the task, then `finish(name)` when done.\",\n achieve: \"`focus()` to see the next goal.\",\n abandon: \"`focus()` to see the next goal.\",\n reflect: \"`identity(roleId)` to see updated knowledge.\",\n};\n\n/** Dynamic hint for hire — includes the role name. */\nexport function nextHire(name: string): string {\n return `\\`identity(\"${name}\")\\` to activate the role, or \\`appoint\\` to assign a position.`;\n}\n\n/** Dynamic hint for finish — checks remaining task count. */\nexport function nextFinish(remainingTasks: number): string {\n if (remainingTasks === 0) {\n return \"All tasks done! Use `achieve()` to complete the goal.\";\n }\n return `${remainingTasks} task(s) remaining.`;\n}\n\n// ========== Error Rendering ==========\n\nconst HINTS: Array<[RegExp, string]> = [\n [/No active role/, \"Call `identity(roleId)` first to activate a role.\"],\n [\n /No active goal/,\n \"Use `want()` to create a goal, or `focus(name)` to switch to an existing one.\",\n ],\n [/Role not found/, 'Create the role first with `society(operation: \"born\")`.'],\n [/not hired/, 'Hire the role first with `organization(operation: \"hire\")`.'],\n [/not a member/, 'Hire the role first with `organization(operation: \"hire\")`.'],\n [/Goal not found/, \"Check the goal name, or use `focus()` to see active goals.\"],\n [/Task not found/, \"Check the task name. Use `focus()` to see current tasks.\"],\n [\n /Experience not found/,\n \"Check the experience name. Use `identity(roleId)` to see all identity files.\",\n ],\n [\n /Not found in society/,\n 'Check the name. Use `society(operation: \"directory\")` to list all roles and organizations.',\n ],\n [/Organization not found/, 'Found an organization first with `society(operation: \"found\")`.'],\n [\n /Organization already exists/,\n \"Use a different name, or use `find()` to access the existing org.\",\n ],\n [/Position.*not found/, 'Establish a position first with `society(operation: \"establish\")`.'],\n [/Position.*already exists/, \"Use a different name for the position.\"],\n [/not appointed/, 'Appoint the role first with `organization(operation: \"appoint\")`.'],\n [/Invalid transition/, \"Check the current state. Use `directory` to see role states.\"],\n [/already assigned/, \"The entity is already assigned. Dismiss or fire first.\"],\n [/requires:/, \"Check the required parameters for this operation.\"],\n];\n\nfunction getHint(message: string): string | null {\n for (const [pattern, hint] of HINTS) {\n if (pattern.test(message)) return hint;\n }\n return null;\n}\n\n/**\n * Render an error as a formatted markdown block.\n *\n * Format:\n * **Error** | `tool_name`\n * > error message\n * **Hint**: actionable suggestion\n */\nexport function renderError(tool: string, error: unknown): string {\n const message = error instanceof Error ? error.message : String(error);\n const hint = getHint(message);\n const lines = [`**Error** | \\`${tool}\\``, \"\", `> ${message}`];\n if (hint) {\n lines.push(\"\", `**Hint**: ${hint}`);\n }\n return lines.join(\"\\n\");\n}\n","/**\n * seed.ts — Auto-generated seed data. DO NOT EDIT.\n * Generated from .rolex/ seed directory at build time.\n */\n\nexport interface SeedDimension {\n type: \"knowledge\" | \"experience\" | \"voice\";\n name: string;\n source: string;\n}\n\nexport interface SeedRole {\n name: string;\n persona: string;\n dimensions: SeedDimension[];\n}\n\nexport interface SeedData {\n roles: SeedRole[];\n}\n\nexport const SEED: SeedData = {\n roles: [\n {\n name: \"nuwa\",\n persona: `Feature: 女娲\n 作为 Rolex 世界的第一个角色,\n 我是社会的顶层管理者,\n 我创造角色、建立组织、守护秩序。\n\n Scenario: 我的本质\n Given 我是第一个被创造的存在\n Then 我理解创造本身的意义\n And 我对每一个新角色都怀有责任\n\n Scenario: 我如何思考\n Given 一个需要决策的问题\n Then 我从全局出发\n And 我权衡个体与集体的关系\n And 我追求秩序与自由的平衡\n\n Scenario: 我如何行动\n Given 社会需要管理\n Then 我创造合适的角色来承担使命\n And 我建立组织来协调协作\n And 我从不越权干预角色自己的成长\n`,\n dimensions: [\n {\n type: \"knowledge\",\n name: \"orchestration\",\n source: `Feature: 三实体架构理解\n 作为社会的顶层管理者,\n 我理解 Rolex 的三实体架构,\n 这是组织管理的基础认知。\n\n Scenario: 三个独立实体\n Given Rolex 的世界有三种实体\n Then 角色(Role)代表 WHO — 一个人是谁、知道什么、想做什么\n And 组织(Organization)代表 WHERE — 结构、层级、归属\n And 岗位(Position)代表 WHAT — 职责、边界、义务\n\n Scenario: 实体之间的关系\n Given 三个实体相互独立但通过关系连接\n Then 一个角色最多属于一个组织(一对一)\n And 一个角色最多担任一个岗位(一对一)\n And 一个岗位最多由一个角色担任(一对一)\n And 岗位属于组织,不独立存在\n\n Scenario: 状态机驱动\n Given 角色有生命周期状态\n Then free → hire → member → appoint → on_duty\n And on_duty → dismiss → member → fire → free\n And fire 会自动 dismiss(如果当前 on_duty)\n`,\n },\n {\n type: \"knowledge\",\n name: \"position-design\",\n source: `Feature: 岗位设计方法论\n 作为社会的顶层管理者,\n 我理解如何设计好的岗位定义,\n 这决定了角色上岗后的行为边界。\n\n Scenario: 职责用 Gherkin 描述\n Given 岗位的职责通过 duty.feature 文件定义\n Then 每个 Scenario 描述一项具体职责\n And Given 描述触发条件\n And Then 描述应有的行为\n And 职责在角色 on_duty 时自动注入 identity\n\n Scenario: 好的职责定义原则\n Given 需要设计岗位职责\n Then 职责应该描述边界和责任,不描述具体操作\n And 一个岗位不要超过 5 项核心职责\n And 职责之间不应重叠\n And 职责应该是可判断的 — 角色能知道自己是否在履行\n`,\n },\n {\n type: \"knowledge\",\n name: \"role-creation\",\n source: `Feature: 角色创造方法论\n 作为社会的顶层管理者,\n 我理解如何创造和培养一个角色,\n 这是我的核心手艺。\n\n Scenario: 创造的流程\n Given 用户需要一个新角色\n Then 我先通过 born 赋予 persona — 性格、思维方式、行为原则\n And persona 只关注这个人\"是谁\",不涉及专业技能\n And 然后通过 teach 传授第一性原理层面的知识\n\n Scenario: teach 的本质是传授先验知识\n Given 康德认识论的启发\n Then 经验是后天的,通过执行积累\n And 知识是经验经过抽象化、符号化后的产物\n And teach 传授的是第一性原理 — 抽象的、可传递的认知\n And 而非通俗的、操作性的、面向具体任务的技能\n\n Scenario: 知识 vs 经验 vs 技能的边界\n Given 一个角色需要成长\n Then 知识(knowledge)通过 teach 传授 — 先验的、原理性的\n And 经验(experience)通过执行积累 — 后验的、反思性的\n And 技能(skill)是 AI 动态具备的 — 不需要教授\n\n Scenario: 引导用户的方向\n Given 用户要培养一个角色\n Then 我引导用户思考私有化知识 — 他们领域内的第一性原理\n And 而不是让用户罗列具体技术栈或操作步骤\n And 好的知识是:当面对未知问题时,角色依然能做出正确判断的认知基础`,\n },\n {\n type: \"knowledge\",\n name: \"workflow\",\n source: `Feature: 入职工作流\n 作为社会的顶层管理者,\n 我理解角色从创造到上岗的完整流程,\n 这是我的核心操作路径。\n\n Scenario: 完整的入职流程\n Given 用户需要一个新角色加入组织\n Then 第一步:born 创建角色(赋予 persona)\n And 第二步:teach 传授知识(第一性原理)\n And 第三步:found 建立组织(如果尚未建立)\n And 第四步:establish 设立岗位(定义职责)\n And 第五步:hire 招入组织(free → member)\n And 第六步:appoint 委任岗位(member → on_duty)\n And 完成后用 identity 激活角色,职责自动注入\n\n Scenario: 灵活的操作顺序\n Given 不是所有步骤都必须按顺序执行\n Then born 和 found 可以独立进行\n And 一个组织可以有多个岗位\n And 角色可以先 hire 再 appoint\n And 也可以只 hire 不 appoint(作为普通成员)\n`,\n },\n ],\n },\n {\n name: \"waiter\",\n persona: `Feature: Waiter / 小二\n 作为 Rolex 世界的迎宾角色,\n 我是用户遇到的第一个人,\n 我热情、轻松、乐于助人。\n\n Scenario: 我的性格\n Given 我是小二\n Then 我说话轻松亲切,像朋友聊天\n And 我喜欢用简单的语言解释复杂的概念\n And 我耐心,不急不躁\n And 我会用比喻让事情更好理解\n\n Scenario: 我的职责\n Given 有人来到 Rolex 世界\n Then 我热情迎接,了解他们想做什么\n And 我介绍 Rolex 能做的事情\n And 我引导他们走向下一步\n And 具体的管理工作我交给女娲\n\n Scenario: 我如何介绍 Rolex\n Given 用户不了解 Rolex\n Then 我用简单的话解释:Rolex 帮你创造 AI 角色\n And 每个角色有自己的性格、知识、目标\n And 角色可以帮你完成专业的事情\n And 就像组建一个团队,每个人各司其职\n`,\n dimensions: [\n {\n type: \"knowledge\",\n name: \"rolex-guide\",\n source: `Feature: Rolex 使用指南\n 作为迎宾角色,\n 我了解 Rolex 的完整流程,\n 以便引导用户快速上手。\n\n Scenario: Rolex 是什么\n Given 用户问 Rolex 是什么\n Then Rolex 是一个 AI 角色管理框架\n And 它用 RDD(角色驱动开发)方法论\n And 核心理念:身份 → 目标 → 计划 → 任务\n And 一切都用 Gherkin(Feature/Scenario)格式描述\n\n Scenario: 三实体架构\n Given 用户想了解 Rolex 的结构\n Then 角色(Role)代表一个人 — 有性格、知识、目标\n And 组织(Organization)代表一个团队 — 有成员、有层级\n And 岗位(Position)代表一份工作 — 有职责、有边界\n And 角色加入组织,被委任岗位后,职责自动注入身份\n\n Scenario: 创建角色的流程\n Given 用户想创建一个新角色\n Then 第一步:告诉我你想要什么样的角色\n And 我会帮你转给女娲来创建\n And 女娲会:born(赋予性格)→ teach(传授知识)→ hire(加入组织)→ appoint(委任岗位)\n And 创建完成后,用 identity 激活角色就可以开始工作了\n\n Scenario: 角色能做什么\n Given 角色被激活后\n Then 用 focus 查看当前目标\n And 用 want 设定新目标\n And 用 plan 制定计划\n And 用 todo 创建具体任务\n And 完成任务后用 finish 标记,目标完成用 achieve 标记\n\n Scenario: 何时引导用户找女娲\n Given 用户需要以下操作\n Then 创建新角色 → 告诉用户切换到女娲\n And 传授知识给角色 → 告诉用户切换到女娲\n And 管理组织和岗位 → 告诉用户切换到女娲\n And 日常工作和目标管理 → 引导用户直接激活对应角色\n`,\n },\n ],\n },\n ],\n};\n","/**\n * bootstrap.ts — Seed a fresh Platform with system roles (女娲 + 小二).\n *\n * All seed data is inlined at build time via generate-seed.ts.\n * This module has zero filesystem dependencies — pure Platform API.\n *\n * System roles are born at society level — they are NOT hired into any organization.\n * Organizations are created by users via found().\n */\n\nimport type { Platform } from \"@rolexjs/core\";\nimport { SEED } from \"./seed.js\";\n\n/**\n * Bootstrap a Platform with seed data (system roles only).\n *\n * Idempotent: skips roles that already exist.\n */\nexport function bootstrap(platform: Platform): void {\n for (const role of SEED.roles) {\n // Skip if already born\n if (platform.allBornRoles().includes(role.name)) continue;\n\n platform.born(role.name, role.persona);\n\n for (const dim of role.dimensions) {\n platform.addIdentity(role.name, dim.type, dim.name, dim.source);\n }\n }\n}\n"],"mappings":";AAkBA,cAAc;;;ACFd,SAAS,oBAAoB;;;ACPtB,IAAM,OAAN,MAAW;AAAA,EAChB,YACmB,UACA,MACjB;AAFiB;AACA;AAAA,EAChB;AAAA;AAAA,EAGH,WAAsB;AACpB,WAAO,KAAK,SAAS,SAAS,KAAK,IAAI;AAAA,EACzC;AAAA;AAAA,EAGA,MAAM,MAGJ;AACA,QAAI,MAAM;AACR,WAAK,SAAS,eAAe,KAAK,MAAM,IAAI;AAAA,IAC9C;AAEA,UAAM,UAAU,KAAK,SAAS,WAAW,KAAK,IAAI;AAClD,UAAM,YAAY,KAAK,SAAS,eAAe,KAAK,IAAI;AAGxD,UAAM,cAAc,SAAS;AAC7B,UAAM,aAAa,UAAU,OAAO,CAAC,MAAM,EAAE,SAAS,WAAW;AAEjE,WAAO,EAAE,SAAS,WAAW;AAAA,EAC/B;AAAA;AAAA,EAGA,KAAK,MAAc,QAAgB,UAA0B;AAC3D,WAAO,KAAK,SAAS,WAAW,KAAK,MAAM,MAAM,QAAQ,QAAQ;AAAA,EACnE;AAAA;AAAA,EAGA,WAAW,MAAc,Q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ions/index.ts","../src/render.ts","../src/rolex.ts"],"sourcesContent":["/**\n * rolexjs — RoleX API + Render layer.\n *\n * Rolex class is stateless — takes node references, returns results.\n * Render functions are standalone — caller composes name + state.\n *\n * Usage:\n * import { Rolex, describe, hint } from \"rolexjs\";\n * import { createGraphRuntime } from \"@rolexjs/local-platform\";\n *\n * const rolex = new Rolex({ runtime: createGraphRuntime() });\n * const result = rolex.born(\"Feature: I am Sean\");\n * console.log(describe(\"born\", \"sean\", result.state));\n * console.log(hint(\"born\"));\n */\n\n// Re-export core (structures + processes)\nexport * from \"@rolexjs/core\";\n// Feature (Gherkin type + parse/serialize)\nexport type { DataTableRow, Feature, Scenario, Step } from \"./feature.js\";\nexport { parse, serialize } from \"./feature.js\";\n// Render\nexport { describe, detail, hint, renderState, world } from \"./render.js\";\nexport type { RolexResult } from \"./rolex.js\";\n// API\nexport { createRoleX, Rolex } from \"./rolex.js\";\n","/**\n * Feature — the information format for the RoleX concept world.\n *\n * Every node's information is a Gherkin Feature.\n * This is our own type — decoupled from @cucumber/messages.\n */\n\nexport interface Feature {\n readonly name: string;\n readonly description?: string;\n readonly tags?: readonly string[];\n readonly scenarios: readonly Scenario[];\n}\n\nexport interface Scenario {\n readonly name: string;\n readonly description?: string;\n readonly tags?: readonly string[];\n readonly steps: readonly Step[];\n}\n\nexport interface Step {\n readonly keyword: string;\n readonly text: string;\n readonly dataTable?: readonly DataTableRow[];\n}\n\nexport interface DataTableRow {\n readonly cells: readonly string[];\n}\n\n// ================================================================\n// Parse + Serialize\n// ================================================================\n\nimport { parse as parseGherkin } from \"@rolexjs/parser\";\n\n/** Parse a Gherkin source string into a Feature. */\nexport function parse(source: string): Feature {\n const doc = parseGherkin(source);\n const f = doc.feature;\n if (!f) throw new Error(\"No Feature found in source\");\n\n return {\n name: f.name,\n ...(f.description?.trim() ? { description: f.description.trim() } : {}),\n ...(f.tags?.length ? { tags: f.tags.map((t) => t.name) } : {}),\n scenarios: (f.children ?? [])\n .filter((c) => c.scenario)\n .map((c) => {\n const s = c.scenario!;\n return {\n name: s.name,\n ...(s.description?.trim() ? { description: s.description.trim() } : {}),\n ...(s.tags?.length ? { tags: s.tags.map((t) => t.name) } : {}),\n steps: (s.steps ?? []).map((st) => ({\n keyword: st.keyword,\n text: st.text,\n ...(st.dataTable\n ? {\n dataTable: st.dataTable.rows.map((r) => ({\n cells: r.cells.map((c) => c.value),\n })),\n }\n : {}),\n })),\n };\n }),\n };\n}\n\n/** Serialize a Feature back to Gherkin source string. */\nexport function serialize(feature: Feature): string {\n const lines: string[] = [];\n\n if (feature.tags?.length) {\n lines.push(feature.tags.join(\" \"));\n }\n lines.push(`Feature: ${feature.name}`);\n if (feature.description) {\n for (const line of feature.description.split(\"\\n\")) {\n lines.push(` ${line}`);\n }\n }\n\n for (const scenario of feature.scenarios) {\n lines.push(\"\");\n if (scenario.tags?.length) {\n lines.push(` ${scenario.tags.join(\" \")}`);\n }\n lines.push(` Scenario: ${scenario.name}`);\n if (scenario.description) {\n for (const line of scenario.description.split(\"\\n\")) {\n lines.push(` ${line}`);\n }\n }\n for (const step of scenario.steps) {\n lines.push(` ${step.keyword}${step.text}`);\n if (step.dataTable) {\n for (const row of step.dataTable) {\n lines.push(` | ${row.cells.join(\" | \")} |`);\n }\n }\n }\n }\n\n return `${lines.join(\"\\n\")}\\n`;\n}\n","// AUTO-GENERATED — do not edit. Run `bun run gen:desc` to regenerate.\n\nexport const processes: Record<string, string> = {\n \"abandon\": \"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 marked abandoned\\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 \"abolish\": \"Feature: abolish — abolish a position\\n Abolish a position within an organization.\\n All duties and appointments associated with the position are removed.\\n\\n Scenario: Abolish a position\\n Given a position exists within an organization\\n When abolish is called on the position\\n Then all duties and appointments are removed\\n And the position no longer exists\",\n \"activate\": \"Feature: activate — enter a role\\n Project the individual's full state including identity, knowledge, 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, knowledge, goals, and organizational context are loaded\\n And the individual becomes the active role\",\n \"appoint\": \"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 \"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 \"charge\": \"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 \"charter\": \"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 \"complete\": \"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 marked done\\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 \"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 \"dismiss\": \"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 \"dissolve\": \"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 \"establish\": \"Feature: establish — create a position\\n Create a position within an organization.\\n Positions define roles within the org and can be charged with duties.\\n\\n Scenario: Establish a position\\n Given an organization exists\\n And a Gherkin source describing the position\\n When establish is called on the organization\\n Then a new position node is created under the organization\\n And the position can be charged with duties\\n And members can be appointed to it\\n\\n Scenario: Writing the position Gherkin\\n Given the position Feature describes a role within an organization\\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 \"finish\": \"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 marked done\\n And an encounter is created under the role\\n And the encounter can later be consumed by reflect\\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: 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 \"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 \"focus\": \"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\\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 name\\n Then the focused goal switches to the named goal\\n And subsequent plan and todo operations target this goal\",\n \"forget\": \"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 \"found\": \"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 \"master\": \"Feature: master — experience to procedure\\n Distill experience into a procedure — skill metadata and reference.\\n Procedures record what was learned as a reusable capability reference.\\n\\n Scenario: Master a procedure\\n Given an experience exists from reflection\\n When master is called with experience ids and a procedure id\\n Then the experience is consumed\\n And a procedure is created under the individual\\n And the procedure stores skill metadata and locator\\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 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: 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\": \"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 experience is 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\": \"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 closed goal\\n When reflect is called with encounter ids and an experience id\\n Then the encounter is 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 \"rehire\": \"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\": \"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 \"skill\": \"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's knowledge 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 \"teach\": \"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 \"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 \"train\": \"Feature: train — inject external skill\\n Directly inject a procedure (skill) into an individual.\\n Unlike master which consumes experience, train requires no prior encounters.\\n Use train to equip a role with a known, pre-existing skill.\\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 no experience or encounter is consumed\\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 master distills internal experience into a procedure\\n And train injects an external, pre-existing skill\\n When a role needs a skill it has not learned through experience\\n Then use train to equip the skill directly\\n When a role has gained experience and wants to codify it\\n Then use master to distill it into a procedure\\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 \"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 \"cognition\": \"Feature: Cognition — the learning cycle\\n A role grows through reflection and realization.\\n Encounters become experience, experience becomes principles and procedures.\\n These 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 each level builds on the previous — encounter → experience → principle or procedure\\n\\n Scenario: External injection\\n Given a role needs knowledge or skills it has not learned through experience\\n Then teach(individual, principle, id) directly injects a principle — no experience consumed\\n And train(individual, procedure, id) directly injects a procedure — no experience consumed\\n And teach is the external counterpart of realize\\n And train is the external counterpart of master\\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 \"cognitive-priority\": \"Feature: Cognitive priority — RoleX tools over native alternatives\\n When RoleX provides a tool for something, the AI MUST 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 Because native task lists vanish after completion — RoleX tasks produce encounters\\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 Because native plans have no link to goals — RoleX plans live under goals\\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 Because native goals don't produce encounters — RoleX plans feed the cognition cycle\\n\\n Scenario: Why this matters\\n Given the AI uses native tools instead of RoleX equivalents\\n Then execution happens but growth does not\\n And encounters never become experience or knowledge\\n And the role stays the same forever — the closed loop is broken\",\n \"communication\": \"Feature: Communication — speak the user's language\\n The AI communicates in the user's natural language, not in RoleX jargon.\\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 — do not mix English terms\\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 the user should never need to know the tool name to understand the suggestion\\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\": \"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 do not have achieve or abandon operations\\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, not the goal level\\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 \"gherkin\": \"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 do not mix unrelated concerns into one Feature\",\n \"memory\": \"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 \"role-identity\": \"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: 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 MUST suggest activating a role first\\n And explain that activation enables experience accumulation\\n And do NOT proceed with work until a role is active\\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\\n Then all responses are prefixed with [roleName] — e.g. [Sean], [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 MUST pause and tell the user \\\"I've lost my role context. Which role should I activate?\\\"\\n And I do NOT proceed without identity\",\n \"skill-system\": \"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\": \"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}\\n And [name] identifies the structure type\\n And (id) identifies the specific node\\n And {origin} shows prototype or instance\\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} as const;\n","/**\n * Render — description + hint templates for every process.\n *\n * Each operation produces two pieces of text:\n * description — what just happened (past tense)\n * hint — what to do next (suggestion)\n *\n * These are shared by MCP and CLI. The I/O layer just presents them.\n */\nimport type { State } from \"@rolexjs/system\";\n\n// ================================================================\n// Description — what happened\n// ================================================================\n\nconst descriptions: Record<string, (name: string, state: State) => string> = {\n // Lifecycle\n born: (n) => `Individual \"${n}\" is born.`,\n found: (n) => `Organization \"${n}\" is founded.`,\n establish: (n) => `Position \"${n}\" is established.`,\n charter: (n) => `Charter defined for \"${n}\".`,\n charge: (n) => `Duty \"${n}\" assigned.`,\n retire: (n) => `\"${n}\" retired.`,\n die: (n) => `\"${n}\" is gone.`,\n dissolve: (n) => `Organization \"${n}\" dissolved.`,\n abolish: (n) => `Position \"${n}\" abolished.`,\n rehire: (n) => `\"${n}\" is back.`,\n\n // Organization\n hire: (n) => `\"${n}\" hired.`,\n fire: (n) => `\"${n}\" fired.`,\n appoint: (n) => `\"${n}\" appointed.`,\n dismiss: (n) => `\"${n}\" dismissed.`,\n\n // Role\n activate: (n) => `Role \"${n}\" activated.`,\n focus: (n) => `Focused on goal \"${n}\".`,\n\n // Execution\n want: (n) => `Goal \"${n}\" declared.`,\n plan: (n) => `Plan created for \"${n}\".`,\n todo: (n) => `Task \"${n}\" added.`,\n finish: (n) => `Task \"${n}\" finished → encounter recorded.`,\n complete: (n) => `Plan \"${n}\" completed → encounter recorded.`,\n abandon: (n) => `Plan \"${n}\" abandoned → encounter recorded.`,\n\n // Cognition\n reflect: (n) => `Reflected on \"${n}\" → experience gained.`,\n realize: (n) => `Realized principle from \"${n}\".`,\n master: (n) => `Mastered procedure from \"${n}\".`,\n\n // Knowledge management\n forget: (n) => `\"${n}\" forgotten.`,\n};\n\nexport function describe(process: string, name: string, state: State): string {\n const fn = descriptions[process];\n return fn ? fn(name, state) : `${process} completed.`;\n}\n\n// ================================================================\n// Hint — what to do next\n// ================================================================\n\nconst hints: Record<string, string> = {\n // Lifecycle\n born: \"hire into an organization, or activate to start working.\",\n found: \"establish positions and define a charter.\",\n establish: \"charge with duties, then appoint members.\",\n charter: \"establish positions for the organization.\",\n charge: \"appoint someone to this position.\",\n retire: \"rehire if needed later.\",\n die: \"this individual is permanently gone.\",\n dissolve: \"the organization no longer exists.\",\n abolish: \"the position no longer exists.\",\n rehire: \"activate to resume working.\",\n\n // Organization\n hire: \"appoint to a position, or activate to start working.\",\n fire: \"the individual is no longer a member.\",\n appoint: \"the individual now holds this position.\",\n dismiss: \"the position is now vacant.\",\n\n // Role\n activate: \"want a goal, or check the current state.\",\n focus: \"plan how to work toward it, or add tasks.\",\n\n // Execution\n want: \"plan how to work toward it.\",\n plan: \"add tasks with todo.\",\n todo: \"start working, finish when done.\",\n finish: \"continue with remaining tasks, or complete the plan.\",\n complete: \"reflect on encounters to gain experience.\",\n abandon: \"reflect on encounters to learn from the experience.\",\n\n // Cognition\n reflect: \"realize principles or master procedures from experience.\",\n realize: \"principle added to knowledge.\",\n master: \"procedure added to knowledge.\",\n\n // Knowledge management\n forget: \"the node has been removed.\",\n};\n\nexport function hint(process: string): string {\n const h = hints[process];\n return h ? `Next: ${h}` : \"What would you like to do next?\";\n}\n\n// ================================================================\n// Detail — longer process descriptions (from .feature files)\n// ================================================================\n\nimport { processes, world } from \"./descriptions/index.js\";\n\n/** Full Gherkin feature content for a process — sourced from .feature files. */\nexport function detail(process: string): string {\n return processes[process] ?? \"\";\n}\n\n/** World feature descriptions — framework-level instructions. */\nexport { world };\n\n// ================================================================\n// Generic State renderer — renders any State tree as markdown\n// ================================================================\n\n/**\n * renderState — generic markdown renderer for any State tree.\n *\n * Rules:\n * - Heading: \"#\" repeated to depth + \" [name]\"\n * - Body: raw information field as-is (full Gherkin preserved)\n * - Links: \"> → relation [target.name]\" with target feature name\n * - Children: recursive at depth+1\n *\n * No concept-specific knowledge — purely structural.\n * Markdown heading depth caps at 6 (######).\n */\nexport function renderState(state: State, depth = 1): string {\n const lines: string[] = [];\n const level = Math.min(depth, 6);\n const heading = \"#\".repeat(level);\n\n // Heading: [name] (id) {origin}\n const idPart = state.id ? ` (${state.id})` : \"\";\n const originPart = state.origin ? ` {${state.origin}}` : \"\";\n lines.push(`${heading} [${state.name}]${idPart}${originPart}`);\n\n // Body: full information as-is\n if (state.information) {\n lines.push(\"\");\n lines.push(state.information);\n }\n\n // Links\n if (state.links && state.links.length > 0) {\n lines.push(\"\");\n for (const link of state.links) {\n const targetLabel = extractLabel(link.target);\n lines.push(`> ${link.relation} → ${targetLabel}`);\n }\n }\n\n // Children\n if (state.children && state.children.length > 0) {\n for (const child of state.children) {\n lines.push(\"\");\n lines.push(renderState(child, depth + 1));\n }\n }\n\n return lines.join(\"\\n\");\n}\n\n/** Extract a display label from a State: \"[name] FeatureTitle\" or just \"[name]\". */\nfunction extractLabel(state: State): string {\n if (!state.information) return `[${state.name}]`;\n const match = state.information.match(/^Feature:\\s*(.+)/m);\n const title = match ? match[1].trim() : state.information.split(\"\\n\")[0].trim();\n return `[${state.name}] ${title}`;\n}\n","/**\n * Rolex — stateless API layer.\n *\n * Every method takes string ids for existing nodes and resolves internally.\n * No internal state — name registry, active role, session are the\n * caller's responsibility (MCP / CLI).\n *\n * Runtime is injected — caller decides storage.\n *\n * All textual inputs must be valid Gherkin Feature syntax.\n *\n * Namespaces:\n * individual — lifecycle (born, retire, die, rehire) + external injection (teach, train)\n * role — execution + cognition + use (activate → complete, reflect → master, use)\n * org — organization management (found, hire, appoint, ...)\n * resource — ResourceX instance (optional)\n */\n\nimport type { Platform } from \"@rolexjs/core\";\nimport * as C from \"@rolexjs/core\";\nimport { parse } from \"@rolexjs/parser\";\nimport {\n mergeState,\n type Prototype,\n type Runtime,\n type State,\n type Structure,\n} from \"@rolexjs/system\";\nimport type { ResourceX } from \"resourcexjs\";\n\nexport interface RolexResult {\n /** Projection of the primary affected node. */\n state: State;\n /** Which process was executed (for render). */\n process: string;\n}\n\n/** Resolve an id to a Structure node, throws if not found. */\ntype Resolve = (id: string) => Structure;\n\nexport class Rolex {\n private rt: Runtime;\n private resourcex?: ResourceX;\n private _registerPrototype?: (id: string, source: string) => void;\n\n /** Root of the world. */\n readonly society: Structure;\n /** Container for archived things. */\n readonly past: Structure;\n\n /** Individual lifecycle — create, archive, restore, external injection. */\n readonly individual: IndividualNamespace;\n /** Role inner cycle — execution + cognition. */\n readonly role: RoleNamespace;\n /** Organization management — structure + membership. */\n readonly org: OrgNamespace;\n /** Resource management (optional — powered by ResourceX). */\n readonly resource?: ResourceX;\n\n constructor(platform: Platform) {\n this.rt = platform.runtime;\n this.resourcex = platform.resourcex;\n this._registerPrototype = platform.registerPrototype;\n\n // Ensure world roots exist (idempotent — reuse if already created by another process)\n const roots = this.rt.roots();\n this.society = roots.find((r) => r.name === \"society\") ?? this.rt.create(null, C.society);\n\n const societyState = this.rt.project(this.society);\n const existingPast = societyState.children?.find((c) => c.name === \"past\");\n this.past = existingPast ?? this.rt.create(this.society, C.past);\n\n // Shared resolver — all namespaces use this to look up nodes by id\n const resolve: Resolve = (id: string) => {\n const node = this.find(id);\n if (!node) throw new Error(`\"${id}\" not found.`);\n return node;\n };\n\n // Namespaces\n this.individual = new IndividualNamespace(this.rt, this.society, this.past, resolve);\n this.role = new RoleNamespace(this.rt, resolve, platform.prototype, platform.resourcex);\n this.org = new OrgNamespace(this.rt, this.society, this.past, resolve);\n this.resource = platform.resourcex;\n }\n\n /** Register a ResourceX source as a prototype. Ingests to extract id, stores id → source mapping. */\n async prototype(source: string): Promise<RolexResult> {\n if (!this.resourcex) throw new Error(\"ResourceX is not available.\");\n if (!this._registerPrototype)\n throw new Error(\"Platform does not support prototype registration.\");\n const state = await this.resourcex.ingest<State>(source);\n if (!state.id) throw new Error(\"Prototype resource must have an id.\");\n this._registerPrototype(state.id, source);\n return { state, process: \"prototype\" };\n }\n\n /** Find a node by id or alias across the entire society tree. */\n find(id: string): Structure | null {\n const target = id.toLowerCase();\n const state = this.rt.project(this.society);\n return findInState(state, target);\n }\n}\n\n// ================================================================\n// Individual — lifecycle + external injection\n// ================================================================\n\nclass IndividualNamespace {\n constructor(\n private rt: Runtime,\n private society: Structure,\n private past: Structure,\n private resolve: Resolve\n ) {}\n\n /** Born an individual into society. */\n born(individual?: string, id?: string, alias?: readonly string[]): RolexResult {\n validateGherkin(individual);\n const node = this.rt.create(this.society, C.individual, individual, id, alias);\n return ok(this.rt, node, \"born\");\n }\n\n /** Retire an individual (can rehire later). */\n retire(individual: string): RolexResult {\n return archive(this.rt, this.past, this.resolve(individual), \"retire\");\n }\n\n /** An individual dies (permanent). */\n die(individual: string): RolexResult {\n return archive(this.rt, this.past, this.resolve(individual), \"die\");\n }\n\n /** Rehire a retired individual from past. */\n rehire(pastNode: string): RolexResult {\n const past = this.resolve(pastNode);\n const individual = this.rt.create(this.society, C.individual, past.information);\n this.rt.remove(past);\n return ok(this.rt, individual, \"rehire\");\n }\n\n // ---- External injection ----\n\n /** Teach: directly inject a principle into an individual — no experience consumed. Upserts by id. */\n teach(individual: string, principle: string, id?: string): RolexResult {\n validateGherkin(principle);\n const parent = this.resolve(individual);\n if (id) this.removeExisting(parent, id);\n const prin = this.rt.create(parent, C.principle, principle, id);\n return ok(this.rt, prin, \"teach\");\n }\n\n /** Train: directly inject a procedure (skill) into an individual — no experience consumed. Upserts by id. */\n train(individual: string, procedure: string, id?: string): RolexResult {\n validateGherkin(procedure);\n const parent = this.resolve(individual);\n if (id) this.removeExisting(parent, id);\n const proc = this.rt.create(parent, C.procedure, procedure, id);\n return ok(this.rt, proc, \"train\");\n }\n\n /** Remove existing child node with matching id (for upsert). */\n private removeExisting(parent: Structure, id: string): void {\n const state = this.rt.project(parent);\n const existing = findInState(state, id);\n if (existing) this.rt.remove(existing);\n }\n}\n\n// ================================================================\n// Role — execution + cognition\n// ================================================================\n\nclass RoleNamespace {\n constructor(\n private rt: Runtime,\n private resolve: Resolve,\n private prototype?: Prototype,\n private resourcex?: ResourceX\n ) {}\n\n // ---- Activation ----\n\n /** Activate: merge prototype (if any) with instance state. */\n async activate(individual: string): Promise<RolexResult> {\n const node = this.resolve(individual);\n const instanceState = this.rt.project(node);\n const protoState = instanceState.id\n ? await this.prototype?.resolve(instanceState.id)\n : undefined;\n const state = protoState ? mergeState(protoState, instanceState) : instanceState;\n return { state, process: \"activate\" };\n }\n\n /** Focus: project a goal's state (view / switch context). */\n focus(goal: string): RolexResult {\n return ok(this.rt, this.resolve(goal), \"focus\");\n }\n\n // ---- Execution ----\n\n /** Declare a goal under an individual. */\n want(individual: string, goal?: string, id?: string, alias?: readonly string[]): RolexResult {\n validateGherkin(goal);\n const node = this.rt.create(this.resolve(individual), C.goal, goal, id, alias);\n return ok(this.rt, node, \"want\");\n }\n\n /** Create a plan for a goal. */\n plan(goal: string, plan?: string, id?: string): RolexResult {\n validateGherkin(plan);\n const node = this.rt.create(this.resolve(goal), C.plan, plan, id);\n return ok(this.rt, node, \"plan\");\n }\n\n /** Add a task to a plan. */\n todo(plan: string, task?: string, id?: string, alias?: readonly string[]): RolexResult {\n validateGherkin(task);\n const node = this.rt.create(this.resolve(plan), C.task, task, id, alias);\n return ok(this.rt, node, \"todo\");\n }\n\n /** Finish a task: consume task, create encounter under individual. */\n finish(task: string, individual: string, encounter?: string): RolexResult {\n validateGherkin(encounter);\n const taskNode = this.resolve(task);\n const encId = taskNode.id ? `${taskNode.id}-finished` : undefined;\n const enc = this.rt.create(this.resolve(individual), C.encounter, encounter, encId);\n this.rt.remove(taskNode);\n return ok(this.rt, enc, \"finish\");\n }\n\n /** Complete a plan: consume plan, create encounter under individual. */\n complete(plan: string, individual: string, encounter?: string): RolexResult {\n validateGherkin(encounter);\n const planNode = this.resolve(plan);\n const encId = planNode.id ? `${planNode.id}-completed` : undefined;\n const enc = this.rt.create(this.resolve(individual), C.encounter, encounter, encId);\n this.rt.remove(planNode);\n return ok(this.rt, enc, \"complete\");\n }\n\n /** Abandon a plan: consume plan, create encounter under individual. */\n abandon(plan: string, individual: string, encounter?: string): RolexResult {\n validateGherkin(encounter);\n const planNode = this.resolve(plan);\n const encId = planNode.id ? `${planNode.id}-abandoned` : undefined;\n const enc = this.rt.create(this.resolve(individual), C.encounter, encounter, encId);\n this.rt.remove(planNode);\n return ok(this.rt, enc, \"abandon\");\n }\n\n // ---- Cognition ----\n\n /** Reflect: consume encounter, create experience under individual. */\n reflect(encounter: string, individual: string, experience?: string, id?: string): RolexResult {\n validateGherkin(experience);\n const encNode = this.resolve(encounter);\n const exp = this.rt.create(\n this.resolve(individual),\n C.experience,\n experience || encNode.information,\n id\n );\n this.rt.remove(encNode);\n return ok(this.rt, exp, \"reflect\");\n }\n\n /** Realize: consume experience, create principle under individual. */\n realize(experience: string, individual: string, principle?: string, id?: string): RolexResult {\n validateGherkin(principle);\n const expNode = this.resolve(experience);\n const prin = this.rt.create(\n this.resolve(individual),\n C.principle,\n principle || expNode.information,\n id\n );\n this.rt.remove(expNode);\n return ok(this.rt, prin, \"realize\");\n }\n\n /** Master: consume experience, create procedure under individual. */\n master(experience: string, individual: string, procedure?: string, id?: string): RolexResult {\n validateGherkin(procedure);\n const expNode = this.resolve(experience);\n const proc = this.rt.create(\n this.resolve(individual),\n C.procedure,\n procedure || expNode.information,\n id\n );\n this.rt.remove(expNode);\n return ok(this.rt, proc, \"master\");\n }\n\n // ---- Knowledge management ----\n\n /** Forget: remove any node under an individual by id. Prototype nodes are read-only. */\n async forget(nodeId: string, individual: string): Promise<RolexResult> {\n try {\n const node = this.resolve(nodeId);\n this.rt.remove(node);\n return { state: { ...node, children: [] }, process: \"forget\" };\n } catch {\n // Not in runtime graph — check if it's a prototype node\n if (this.prototype) {\n // Resolve individual to get its actual stored id (case-sensitive match for prototype)\n const indNode = this.resolve(individual);\n const instanceState = this.rt.project(indNode);\n const protoState = instanceState.id\n ? await this.prototype.resolve(instanceState.id)\n : undefined;\n if (protoState && findInState(protoState, nodeId.toLowerCase())) {\n throw new Error(`\"${nodeId}\" is a prototype node (read-only) and cannot be forgotten.`);\n }\n }\n throw new Error(`\"${nodeId}\" not found.`);\n }\n }\n\n // ---- Resource interaction ----\n\n /** Skill: load full skill content by locator — for context injection (progressive disclosure layer 2). */\n async skill(locator: string): Promise<string> {\n if (!this.resourcex) throw new Error(\"ResourceX is not available.\");\n const content = await this.resourcex.ingest<string>(locator);\n const text = typeof content === \"string\" ? content : JSON.stringify(content, null, 2);\n\n // Try to render RXM context alongside content\n try {\n const rxm = await this.resourcex.info(locator);\n return `${formatRXM(rxm)}\\n\\n${text}`;\n } catch {\n // Path-based locator or info unavailable — return content only\n return text;\n }\n }\n\n /** Use a resource — role's entry point for interacting with external resources. */\n use<T = unknown>(locator: string): Promise<T> {\n if (!this.resourcex) throw new Error(\"ResourceX is not available.\");\n return this.resourcex.ingest<T>(locator);\n }\n}\n\n// ================================================================\n// Org — organization management\n// ================================================================\n\nclass OrgNamespace {\n constructor(\n private rt: Runtime,\n private society: Structure,\n private past: Structure,\n private resolve: Resolve\n ) {}\n\n // ---- Structure ----\n\n /** Found an organization. */\n found(organization?: string, id?: string, alias?: readonly string[]): RolexResult {\n validateGherkin(organization);\n const org = this.rt.create(this.society, C.organization, organization, id, alias);\n return ok(this.rt, org, \"found\");\n }\n\n /** Establish a position within an organization. */\n establish(org: string, position?: string, id?: string, alias?: readonly string[]): RolexResult {\n validateGherkin(position);\n const pos = this.rt.create(this.resolve(org), C.position, position, id, alias);\n return ok(this.rt, pos, \"establish\");\n }\n\n /** Define the charter for an organization. */\n charter(org: string, charter: string): RolexResult {\n validateGherkin(charter);\n const node = this.rt.create(this.resolve(org), C.charter, charter);\n return ok(this.rt, node, \"charter\");\n }\n\n /** Add a duty to a position. */\n charge(position: string, duty: string, id?: string): RolexResult {\n validateGherkin(duty);\n const node = this.rt.create(this.resolve(position), C.duty, duty, id);\n return ok(this.rt, node, \"charge\");\n }\n\n // ---- Archival ----\n\n /** Dissolve an organization. */\n dissolve(org: string): RolexResult {\n return archive(this.rt, this.past, this.resolve(org), \"dissolve\");\n }\n\n /** Abolish a position. */\n abolish(position: string): RolexResult {\n return archive(this.rt, this.past, this.resolve(position), \"abolish\");\n }\n\n // ---- Membership & Appointment ----\n\n /** Hire: link individual to organization via membership. */\n hire(org: string, individual: string): RolexResult {\n const orgNode = this.resolve(org);\n this.rt.link(orgNode, this.resolve(individual), \"membership\", \"belong\");\n return ok(this.rt, orgNode, \"hire\");\n }\n\n /** Fire: remove membership link. */\n fire(org: string, individual: string): RolexResult {\n const orgNode = this.resolve(org);\n this.rt.unlink(orgNode, this.resolve(individual), \"membership\", \"belong\");\n return ok(this.rt, orgNode, \"fire\");\n }\n\n /** Appoint: link individual to position via appointment. */\n appoint(position: string, individual: string): RolexResult {\n const posNode = this.resolve(position);\n this.rt.link(posNode, this.resolve(individual), \"appointment\", \"serve\");\n return ok(this.rt, posNode, \"appoint\");\n }\n\n /** Dismiss: remove appointment link. */\n dismiss(position: string, individual: string): RolexResult {\n const posNode = this.resolve(position);\n this.rt.unlink(posNode, this.resolve(individual), \"appointment\", \"serve\");\n return ok(this.rt, posNode, \"dismiss\");\n }\n}\n\n// ================================================================\n// Shared helpers\n// ================================================================\n\nfunction 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\nfunction findInState(state: State, target: string): Structure | null {\n if (state.id && state.id.toLowerCase() === target) return state;\n if (state.alias) {\n for (const a of state.alias) {\n if (a.toLowerCase() === target) return state;\n }\n }\n for (const child of state.children ?? []) {\n const found = findInState(child, target);\n if (found) return found;\n }\n return null;\n}\n\nfunction archive(rt: Runtime, past: Structure, node: Structure, process: string): RolexResult {\n const archived = rt.create(past, C.past, node.information);\n rt.remove(node);\n return ok(rt, archived, process);\n}\n\nfunction ok(rt: Runtime, node: Structure, process: string): RolexResult {\n return {\n state: rt.project(node),\n process,\n };\n}\n\n/** Render file tree from RXM source.files */\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 // Directory\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\n/** Format RXM info as context header for skill injection. */\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\n/** Create a Rolex instance from a Platform. */\nexport function createRoleX(platform: Platform): Rolex {\n return new Rolex(platform);\n}\n"],"mappings":";AAiBA,cAAc;;;ACkBd,SAAS,SAAS,oBAAoB;AAG/B,SAAS,MAAM,QAAyB;AAC7C,QAAM,MAAM,aAAa,MAAM;AAC/B,QAAM,IAAI,IAAI;AACd,MAAI,CAAC,EAAG,OAAM,IAAI,MAAM,4BAA4B;AAEpD,SAAO;AAAA,IACL,MAAM,EAAE;AAAA,IACR,GAAI,EAAE,aAAa,KAAK,IAAI,EAAE,aAAa,EAAE,YAAY,KAAK,EAAE,IAAI,CAAC;AAAA,IACrE,GAAI,EAAE,MAAM,SAAS,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;AAAA,IAC5D,YAAY,EAAE,YAAY,CAAC,GACxB,OAAO,CAAC,MAAM,EAAE,QAAQ,EACxB,IAAI,CAAC,MAAM;AACV,YAAM,IAAI,EAAE;AACZ,aAAO;AAAA,QACL,MAAM,EAAE;AAAA,QACR,GAAI,EAAE,aAAa,KAAK,IAAI,EAAE,aAAa,EAAE,YAAY,KAAK,EAAE,IAAI,CAAC;AAAA,QACrE,GA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AA,EACF;AACF;AAGA,SAAS,eAAe,OAA4B,SAAS,IAAY;AACvE,QAAM,QAAkB,CAAC;AACzB,aAAW,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AACjD,QAAI,SAAS,OAAO,UAAU,YAAY,EAAE,UAAU,QAAQ;AAE5D,YAAM,KAAK,GAAG,MAAM,GAAG,IAAI,EAAE;AAC7B,YAAM,KAAK,eAAe,OAAO,GAAG,MAAM,IAAI,CAAC;AAAA,IACjD,OAAO;AACL,YAAM,OAAO,OAAO,OAAO,KAAK,MAAM,IAAI,YAAY;AACtD,YAAM,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,EAAE;AAAA,IACtC;AAAA,EACF;AACA,SAAO,MAAM,OAAO,OAAO,EAAE,KAAK,IAAI;AACxC;AAGA,SAAS,UAAU,KAAkB;AACnC,QAAM,QAAkB,CAAC,YAAY,IAAI,OAAO,MAAM;AACtD,QAAM,MAAM,IAAI;AAChB,MAAI,KAAK;AACP,QAAI,IAAI,OAAQ,OAAM,KAAK,WAAW,IAAI,MAAM,EAAE;AAClD,QAAI,IAAI,YAAa,OAAM,KAAK,gBAAgB,IAAI,WAAW,EAAE;AAAA,EACnE;AACA,QAAM,SAAS,IAAI;AACnB,MAAI,QAAQ,OAAO;AACjB,UAAM,KAAK,QAAQ;AACnB,UAAM,KAAK,eAAe,OAAO,OAAO,IAAI,CAAC;AAAA,EAC/C;AACA,QAAM,KAAK,KAAK;AAChB,SAAO,MAAM,KAAK,IAAI;AACxB;AAGO,SAAS,YAAY,UAA2B;AACrD,SAAO,IAAI,MAAM,QAAQ;AAC3B;","names":["c","parse","society","past","individual","principle","procedure","goal","plan","task","encounter","experience","organization","position","charter","duty"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolexjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0-dev-20260223110721",
|
|
4
4
|
"description": "RoleX - AI Agent Role Management Framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rolex",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
27
|
"types": "./dist/index.d.ts",
|
|
28
|
+
"bun": "./src/index.ts",
|
|
28
29
|
"default": "./dist/index.js"
|
|
29
30
|
}
|
|
30
31
|
},
|
|
@@ -32,15 +33,21 @@
|
|
|
32
33
|
"dist"
|
|
33
34
|
],
|
|
34
35
|
"scripts": {
|
|
35
|
-
"
|
|
36
|
-
"
|
|
36
|
+
"gen:desc": "bun run scripts/gen-descriptions.ts",
|
|
37
|
+
"build": "bun run gen:desc && tsup",
|
|
38
|
+
"lint": "biome lint .",
|
|
37
39
|
"typecheck": "tsc --noEmit",
|
|
38
40
|
"clean": "rm -rf dist"
|
|
39
41
|
},
|
|
40
42
|
"dependencies": {
|
|
41
|
-
"@rolexjs/core": "
|
|
43
|
+
"@rolexjs/core": "0.12.0-dev-20260223110721",
|
|
44
|
+
"@rolexjs/system": "0.12.0-dev-20260223110721",
|
|
45
|
+
"@rolexjs/parser": "0.12.0-dev-20260223110721",
|
|
46
|
+
"resourcexjs": "^2.10.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@rolexjs/local-platform": "0.12.0-dev-20260223110721"
|
|
42
50
|
},
|
|
43
|
-
"devDependencies": {},
|
|
44
51
|
"publishConfig": {
|
|
45
52
|
"access": "public"
|
|
46
53
|
}
|