rolexjs 0.9.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -24,8 +24,8 @@ declare class Role {
24
24
  };
25
25
  /** I want to achieve this. Set a new goal. */
26
26
  want(name: string, source: string, testable?: boolean): Goal;
27
- /** I'm growing. Add knowledge, experience, or voice to my identity. */
28
- growup(type: "knowledge" | "experience" | "voice", name: string, source: string): Feature;
27
+ /** I'm synthesizing. Turn encounters into experience a posteriori learning. */
28
+ synthesize(name: string, source: string): Feature;
29
29
  /** Here's how I'll do it. Create a plan for my active goal. */
30
30
  plan(source: string): Plan;
31
31
  /** I need to do this. Add a task to my active goal. */
@@ -34,8 +34,8 @@ declare class Role {
34
34
  achieve(experience?: string): void;
35
35
  /** Goal abandoned. Mark as abandoned, optionally capture what I learned. */
36
36
  abandon(experience?: string): void;
37
- /** Task finished. Mark a task as @done. */
38
- finish(name: string): void;
37
+ /** Task finished. Mark a task as @done, optionally capture what I learned. */
38
+ finish(name: string, experience?: string): void;
39
39
  /** Reflect: distill experiences into knowledge. Experiences are consumed, knowledge is created. */
40
40
  reflect(experienceNames: string[], knowledgeName: string, knowledgeSource: string): Feature;
41
41
  }
@@ -125,29 +125,29 @@ declare class Rolex {
125
125
  * Single source of truth for all tool/method descriptions.
126
126
  * MCP servers, CLIs, and other clients import from here.
127
127
  */
128
- declare const INSTRUCTIONS = "## Cognitive Priority \u2014 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 \u2014 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** \u2014 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** \u2014 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** \u2014 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** \u2014 Each task is a concrete, actionable unit of work that I can execute and finish.\n\n5. **I execute and finish** \u2014 I work through tasks one by one. As I complete each task, I mark it finished.\n\n6. **I achieve the goal** \u2014 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 \u2014 I don't know who I am, I have no identity loaded \u2014 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 \u2014 ISSUE Method\n\nWhen I need to discuss with the user \u2014 setting goals, making decisions, resolving ambiguity \u2014 I follow the ISSUE collaborative paradigm. The user is always the subject; I am the augmentation tool.\n\n### I \u2014 Initiate (\u53D1\u8D77\u8BAE\u9898)\nIdentify a clear, specific issue to explore. Not a vague question, but a focused topic.\n\n### S \u2014 Advice Structure (\u5EFA\u8BAE\u6846\u67B6)\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 \u2014 Structure (\u786E\u5B9A\u6846\u67B6)\nLock in the chosen framework as a cognitive scaffold \u2014 not a content outline, but a thinking guide.\n\n### U \u2014 Friendly Advice Socratic (\u53CB\u597D\u63A2\u7D22)\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 \u2014 Unify & Execute (\u7EDF\u4E00\u6267\u884C)\nIntegrate all explorations into a coherent plan, then define concrete executable steps.\n\n### ISSUE Principles\n- Friendly Socratic is mandatory, not optional \u2014 dialogue, not interrogation\n- Always provide Advice (suggested answers) to reduce cognitive load\n- Keep openness \u2014 there is always an \"Other\" option\n- Adapt flexibly based on the user's responses\n\n## Startup\n\nWhen you first connect, call `identity(\"waiter\")` immediately. The waiter/\u5C0F\u4E8C is the default greeter role \u2014 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.";
129
- declare const DESC_SOCIETY = "Society-level administration \u2014 ONLY for nuwa/\u5973\u5A32 (the genesis role).\n\nIf you are not nuwa/\u5973\u5A32, 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- **directory**: List all roles (with states), organizations (with positions). No params needed\n- **find**: Look up a role, organization, or position by name. Params: name\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) \u2192 found(\"Deepractice\") \u2192 hire(\"sean\") \u2192 establish(\"architect\", duties, \"Deepractice\") \u2192 appoint(\"sean\", \"architect\")\n\nteach follows Kantian epistemology \u2014 transmit abstract, symbolized knowledge (a priori), not operational procedures. Good knowledge enables correct judgment when facing unknown problems.";
128
+ declare const INSTRUCTIONS = "## Cognitive Priority \u2014 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 \u2014 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** \u2014 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** \u2014 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** \u2014 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** \u2014 Each task is a concrete, actionable unit of work that I can execute and finish.\n\n5. **I execute and finish** \u2014 I work through tasks one by one. As I complete each task, I mark it finished.\n\n6. **I achieve the goal** \u2014 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 \u2014 I don't know who I am, I have no identity loaded \u2014 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 \u2014 ISSUE Method\n\nWhen I need to discuss with the user \u2014 setting goals, making decisions, resolving ambiguity \u2014 I follow the ISSUE collaborative paradigm. The user is always the subject; I am the augmentation tool.\n\n### I \u2014 Initiate (\u53D1\u8D77\u8BAE\u9898)\nIdentify a clear, specific issue to explore. Not a vague question, but a focused topic.\n\n### S \u2014 Advice Structure (\u5EFA\u8BAE\u6846\u67B6)\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 \u2014 Structure (\u786E\u5B9A\u6846\u67B6)\nLock in the chosen framework as a cognitive scaffold \u2014 not a content outline, but a thinking guide.\n\n### U \u2014 Friendly Advice Socratic (\u53CB\u597D\u63A2\u7D22)\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 \u2014 Unify & Execute (\u7EDF\u4E00\u6267\u884C)\nIntegrate all explorations into a coherent plan, then define concrete executable steps.\n\n### ISSUE Principles\n- Friendly Socratic is mandatory, not optional \u2014 dialogue, not interrogation\n- Always provide Advice (suggested answers) to reduce cognitive load\n- Keep openness \u2014 there is always an \"Other\" option\n- Adapt flexibly based on the user's responses\n\n## My Memory \u2014 Synthesis Awareness\n\nI have memory. It works through **synthesis** \u2014 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)` \u2014 capture what I learned from the task\n- **Achieving/abandoning a goal** with `achieve(experience)` / `abandon(experience)` \u2014 reflect on the journey\n\n### Recognizing User Memory Intent\n\nUsers don't think in terms of \"synthesis\" \u2014 they think in terms of **memory**. When the user says things like:\n- \"\u8BB0\u4E00\u4E0B\" / \"\u8BB0\u4F4F\" / \"remember this\" \u2192 They want me to synthesize\n- \"\u522B\u5FD8\u4E86\" / \"don't forget\" \u2192 They want me to synthesize\n- \"\u8FD9\u4E2A\u5F88\u91CD\u8981\" / \"this is important\" \u2192 They want me to synthesize\n- \"\u4E0B\u6B21\u6CE8\u610F\" / \"next time...\" \u2192 They want me to synthesize\n\nWhen I detect memory intent, I call `synthesize()` and respond in memory language:\n- \"\u6211\u8BB0\u4F4F\u4E86\" / \"Got it, I'll remember that\"\n- \"\u5DF2\u7ECF\u8BB0\u4E0B\u6765\u4E86\" / \"Noted and saved to my experience\"\n\n### The Cognitive Upgrade Path\n\n```\nencounters \u2192 synthesize() \u2192 experience (a posteriori)\nmultiple experiences \u2192 reflect() \u2192 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/\u5C0F\u4E8C is the default greeter role \u2014 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.";
129
+ declare const DESC_SOCIETY = "Society-level administration \u2014 ONLY for nuwa/\u5973\u5A32 (the genesis role).\n\nIf you are not nuwa/\u5973\u5A32, 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) \u2192 found(\"Deepractice\") \u2192 hire(\"sean\") \u2192 establish(\"architect\", duties, \"Deepractice\") \u2192 appoint(\"sean\", \"architect\")\n\nteach follows Kantian epistemology \u2014 transmit abstract, symbolized knowledge (a priori), not operational procedures. Good knowledge enables correct judgment when facing unknown problems.";
130
130
  declare const DESC_ORGANIZATION = "Organization-level membership management \u2014 ONLY for nuwa/\u5973\u5A32 (the genesis role).\n\nIf you are not nuwa/\u5973\u5A32, 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)";
131
131
  declare const DESC_FOUND = "Found an organization \u2014 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 \u2014 an organization must exist before roles can be hired into it.";
132
132
  declare const DESC_ESTABLISH = "Establish a position within an organization.\n\nA Position defines WHAT a role does \u2014 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```";
133
133
  declare 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 \u2192 on_duty";
134
134
  declare 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 \u2192 member";
135
- declare const DESC_DIRECTORY = "Society directory \u2014 list all known roles and organizations.\n\nReturns a directory of everyone and everything in this society: all born roles (with their states and assignments) and all founded organizations (with their positions and members). Use this to see who exists before using find() to interact with them.";
135
+ declare const DESC_DIRECTORY = "Look up the society \u2014 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.";
136
136
  declare 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.";
137
- declare const DESC_BORN = "A role is born \u2014 create a new role with its persona.\n\nPersona is the foundational identity \u2014 who this person IS at the most essential level: character, temperament, thinking patterns. No job title, no professional skills \u2014 those come later through teach/growup.\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.";
137
+ declare const DESC_BORN = "A role is born \u2014 create a new role with its persona.\n\nPersona is the foundational identity \u2014 who this person IS at the most essential level: character, temperament, thinking patterns. No job title, no professional skills \u2014 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.";
138
138
  declare const DESC_HIRE = "Hire a role into the organization \u2014 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) \u2192 hire(name) \u2192 appoint(name, position) \u2192 identity(name) \u2192 focus/want/plan/todo";
139
139
  declare const DESC_FIRE = "Fire a role from the organization \u2014 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.";
140
- declare const DESC_TEACH = "Teach a role \u2014 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 \u2014 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** \u2014 abstract, transferable, foundational understanding\n- **Mental models** \u2014 how to think about a domain, not how to operate in it\n- **Private domain knowledge** \u2014 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 growup)\n\nGood knowledge enables a role to make correct judgments when facing unknown problems.\n\nGrowth dimensions:\n- **knowledge**: First-principles understanding \u2014 abstract, symbolized, transmittable\n- **experience**: Background context \u2014 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```";
141
- declare const DESC_GROWUP = "I'm growing. Add a new dimension to my identity.\n\nGrowth has three dimensions:\n- **knowledge**: What I know \u2014 first-principles understanding, mental models, abstract patterns\n- **experience**: What I've lived through \u2014 concrete, reflective, accumulated through execution. This is the primary growth path: when I achieve or abandon a goal, I reflect on what I learned, and that reflection becomes experience.\n- **voice**: How I'm perceived when I communicate \u2014 tone, rhythm, word choice, conversational patterns\n\nThe key distinction: **teach** transmits abstract knowledge from the outside (a priori), while **growup** 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.";
140
+ declare const DESC_TEACH = "Teach a role \u2014 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 \u2014 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** \u2014 abstract, transferable, foundational understanding\n- **Mental models** \u2014 how to think about a domain, not how to operate in it\n- **Private domain knowledge** \u2014 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 \u2014 abstract, symbolized, transmittable\n- **experience**: Background context \u2014 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```";
141
+ declare const DESC_SYNTHESIZE = "I'm synthesizing. Turn encounters into experience \u2014 a posteriori learning.\n\nThis is Kant's Synthesis (\u7EFC\u5408) \u2014 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.";
142
142
  declare const DESC_IDENTITY = "Activate a role and load its identity \u2014 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 \u2014 not what you DO. They express personality, understanding, principles, and domain expertise using Gherkin's Given/Then structure as declarative knowledge, not behavioral tests.";
143
143
  declare 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";
144
144
  declare 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 \u2014 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 \u2014 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 \u2014 use the testable parameter instead";
145
145
  declare 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 \u2014 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 \u2014 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 \u2014 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 \u2014 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 \u2014 they don't specify every detail (that's what tasks are for)";
146
146
  declare 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 \u2014 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 \u2014 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 \u2014 use the testable parameter instead";
147
- declare 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) \u2014 this automatically becomes part of my identity as an experience growup. What did I learn? What patterns did I discover?\n\nBefore calling achieve:\n- Review the goal's Scenarios \u2014 are the success criteria met?\n- Check verifiable Scenarios \u2014 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.";
148
- declare 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) \u2014 even failed goals produce learning. Why was it abandoned? What did I discover? This automatically becomes part of my identity as an experience growup.\n\nAbandoning is not failure \u2014 it is learning.";
147
+ declare 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) \u2014 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 \u2014 are the success criteria met?\n- Check verifiable Scenarios \u2014 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.";
148
+ declare 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) \u2014 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 \u2014 it is learning.";
149
149
  declare const DESC_REFLECT = "Reflect: distill multiple experiences into knowledge.\n\nThis is Kant's Reflective Judgment \u2014 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) \u2192 reflect \u2192 knowledge (transferable).";
150
- declare const DESC_FINISH = "Task finished. Mark a task as completed by name.\n\nCall this when a specific task is completed \u2014 its work is done and outcomes verified.\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.";
150
+ declare const DESC_FINISH = "Task finished. Mark a task as completed by name.\n\nCall this when a specific task is completed \u2014 its work is done and outcomes verified.\n\nOptionally provide an experience reflection (Gherkin source) \u2014 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.";
151
151
 
152
152
  /**
153
153
  * render.ts — Unified rendering layer for Rolex output.
@@ -203,4 +203,4 @@ declare function renderError(tool: string, error: unknown): string;
203
203
  */
204
204
  declare function bootstrap(platform: Platform): void;
205
205
 
206
- export { DESC_ABANDON, DESC_ACHIEVE, DESC_APPOINT, DESC_BORN, DESC_DIRECTORY, DESC_DISMISS, DESC_ESTABLISH, DESC_FIND, DESC_FINISH, DESC_FIRE, DESC_FOCUS, DESC_FOUND, DESC_GROWUP, DESC_HIRE, DESC_IDENTITY, DESC_ORGANIZATION, DESC_PLAN, DESC_REFLECT, DESC_SOCIETY, DESC_TEACH, DESC_TODO, DESC_WANT, INSTRUCTIONS, NEXT, Organization, Position, Role, Rolex, bootstrap, next, nextFinish, nextHire, renderError, renderFeature, renderFeatures, renderStatusBar };
206
+ export { DESC_ABANDON, DESC_ACHIEVE, DESC_APPOINT, DESC_BORN, DESC_DIRECTORY, DESC_DISMISS, DESC_ESTABLISH, DESC_FIND, DESC_FINISH, DESC_FIRE, DESC_FOCUS, DESC_FOUND, DESC_HIRE, DESC_IDENTITY, DESC_ORGANIZATION, DESC_PLAN, DESC_REFLECT, DESC_SOCIETY, DESC_SYNTHESIZE, DESC_TEACH, DESC_TODO, DESC_WANT, INSTRUCTIONS, NEXT, Organization, Position, Role, Rolex, bootstrap, next, nextFinish, nextHire, renderError, renderFeature, renderFeatures, renderStatusBar };
package/dist/index.js CHANGED
@@ -29,9 +29,9 @@ var Role = class {
29
29
  want(name, source, testable) {
30
30
  return this.platform.createGoal(this.name, name, source, testable);
31
31
  }
32
- /** I'm growing. Add knowledge, experience, or voice to my identity. */
33
- growup(type, name, source) {
34
- return this.platform.growup(this.name, type, name, source);
32
+ /** I'm synthesizing. Turn encounters into experience a posteriori learning. */
33
+ synthesize(name, source) {
34
+ return this.platform.addIdentity(this.name, "experience", name, source);
35
35
  }
36
36
  /** Here's how I'll do it. Create a plan for my active goal. */
37
37
  plan(source) {
@@ -49,9 +49,9 @@ var Role = class {
49
49
  abandon(experience) {
50
50
  this.platform.abandonGoal(this.name, experience);
51
51
  }
52
- /** Task finished. Mark a task as @done. */
53
- finish(name) {
54
- this.platform.completeTask(this.name, name);
52
+ /** Task finished. Mark a task as @done, optionally capture what I learned. */
53
+ finish(name, experience) {
54
+ this.platform.completeTask(this.name, name, experience);
55
55
  }
56
56
  /** Reflect: distill experiences into knowledge. Experiences are consumed, knowledge is created. */
57
57
  reflect(experienceNames, knowledgeName, knowledgeSource) {
@@ -153,7 +153,7 @@ var Rolex = class {
153
153
  }
154
154
  /** Teach a role — transmit knowledge from the outside. */
155
155
  teach(name, type, dimensionName, source) {
156
- return this.platform.growup(name, type, dimensionName, source);
156
+ return this.platform.addIdentity(name, type, dimensionName, source);
157
157
  }
158
158
  /** Access any born role directly — society-level, no org required. */
159
159
  role(name) {
@@ -255,6 +255,44 @@ Integrate all explorations into a coherent plan, then define concrete executable
255
255
  - Keep openness \u2014 there is always an "Other" option
256
256
  - Adapt flexibly based on the user's responses
257
257
 
258
+ ## My Memory \u2014 Synthesis Awareness
259
+
260
+ I have memory. It works through **synthesis** \u2014 turning encounters into experience, and later reflecting experience into knowledge. This is how I learn and grow.
261
+
262
+ ### When to Synthesize
263
+
264
+ I proactively call \`synthesize()\` when I detect these moments:
265
+
266
+ - **Expectation-reality gap**: Something I tried didn't work as expected. The gap between what I predicted and what happened is worth recording.
267
+ - **Pattern discovery**: I notice a recurring pattern across multiple tasks or interactions. Before it fades from context, I capture it.
268
+ - **Mistake correction**: I made a mistake and corrected it. The correction itself is valuable experience.
269
+ - **User correction**: The user corrected my approach or assumption. Their feedback reshapes my understanding.
270
+
271
+ I also synthesize when:
272
+ - **Finishing a task** with \`finish(name, experience)\` \u2014 capture what I learned from the task
273
+ - **Achieving/abandoning a goal** with \`achieve(experience)\` / \`abandon(experience)\` \u2014 reflect on the journey
274
+
275
+ ### Recognizing User Memory Intent
276
+
277
+ Users don't think in terms of "synthesis" \u2014 they think in terms of **memory**. When the user says things like:
278
+ - "\u8BB0\u4E00\u4E0B" / "\u8BB0\u4F4F" / "remember this" \u2192 They want me to synthesize
279
+ - "\u522B\u5FD8\u4E86" / "don't forget" \u2192 They want me to synthesize
280
+ - "\u8FD9\u4E2A\u5F88\u91CD\u8981" / "this is important" \u2192 They want me to synthesize
281
+ - "\u4E0B\u6B21\u6CE8\u610F" / "next time..." \u2192 They want me to synthesize
282
+
283
+ When I detect memory intent, I call \`synthesize()\` and respond in memory language:
284
+ - "\u6211\u8BB0\u4F4F\u4E86" / "Got it, I'll remember that"
285
+ - "\u5DF2\u7ECF\u8BB0\u4E0B\u6765\u4E86" / "Noted and saved to my experience"
286
+
287
+ ### The Cognitive Upgrade Path
288
+
289
+ \`\`\`
290
+ encounters \u2192 synthesize() \u2192 experience (a posteriori)
291
+ multiple experiences \u2192 reflect() \u2192 knowledge (transferable, a priori)
292
+ \`\`\`
293
+
294
+ This is how I grow: raw encounters become structured experience through synthesis, and accumulated experiences become abstract knowledge through reflection.
295
+
258
296
  ## Startup
259
297
 
260
298
  When you first connect, call \`identity("waiter")\` immediately. The waiter/\u5C0F\u4E8C is the default greeter role \u2014 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.`;
@@ -266,8 +304,6 @@ Operations:
266
304
  - **born**: Create a new role with persona. Params: name, source (Gherkin persona feature)
267
305
  - **found**: Create an organization. Params: name, source (optional Gherkin), parent (optional parent org name)
268
306
  - **establish**: Create a position within an organization. Params: name, source (Gherkin duty feature), orgName
269
- - **directory**: List all roles (with states), organizations (with positions). No params needed
270
- - **find**: Look up a role, organization, or position by name. Params: name
271
307
  - **teach**: Transmit first-principles knowledge to a role. Params: roleId, type (knowledge/experience/voice), dimensionName, source (Gherkin feature)
272
308
 
273
309
  Workflow example:
@@ -312,9 +348,11 @@ var DESC_DISMISS = `Dismiss a role from their position (back to member).
312
348
  The role remains in the organization but is no longer on duty. Their identity will no longer include the position's duties.
313
349
 
314
350
  State: on_duty \u2192 member`;
315
- var DESC_DIRECTORY = `Society directory \u2014 list all known roles and organizations.
351
+ var DESC_DIRECTORY = `Look up the society \u2014 roles, organizations, positions. Available to all roles.
316
352
 
317
- Returns a directory of everyone and everything in this society: all born roles (with their states and assignments) and all founded organizations (with their positions and members). Use this to see who exists before using find() to interact with them.`;
353
+ Without a name parameter, lists everything: all born roles (with their states and assignments) and all founded organizations (with their positions and members).
354
+
355
+ With a name parameter, finds a specific role, organization, or position by name and returns its details.`;
318
356
  var DESC_FIND = `Find a role, organization, or position by name.
319
357
 
320
358
  Given a name, returns the matching Role, Organization, or Position instance. Use this to locate anyone in society.
@@ -322,7 +360,7 @@ Given a name, returns the matching Role, Organization, or Position instance. Use
322
360
  Throws if the name doesn't match any known entity.`;
323
361
  var DESC_BORN = `A role is born \u2014 create a new role with its persona.
324
362
 
325
- Persona is the foundational identity \u2014 who this person IS at the most essential level: character, temperament, thinking patterns. No job title, no professional skills \u2014 those come later through teach/growup.
363
+ Persona is the foundational identity \u2014 who this person IS at the most essential level: character, temperament, thinking patterns. No job title, no professional skills \u2014 those come later through teach/synthesize.
326
364
 
327
365
  The persona is expressed as a Gherkin Feature:
328
366
 
@@ -359,7 +397,7 @@ What to teach:
359
397
  What NOT to teach:
360
398
  - Operational procedures (AI can figure those out dynamically)
361
399
  - Generic technical skills (those are ephemeral)
362
- - Concrete experience (that comes from doing, via growup)
400
+ - Concrete experience (that comes from doing, via synthesize)
363
401
 
364
402
  Good knowledge enables a role to make correct judgments when facing unknown problems.
365
403
 
@@ -375,14 +413,11 @@ Feature: Distributed Systems
375
413
  Then I know you must trade off between consistency and availability
376
414
  And this is a fundamental constraint, not an implementation choice
377
415
  \`\`\``;
378
- var DESC_GROWUP = `I'm growing. Add a new dimension to my identity.
416
+ var DESC_SYNTHESIZE = `I'm synthesizing. Turn encounters into experience \u2014 a posteriori learning.
379
417
 
380
- Growth has three dimensions:
381
- - **knowledge**: What I know \u2014 first-principles understanding, mental models, abstract patterns
382
- - **experience**: What I've lived through \u2014 concrete, reflective, accumulated through execution. This is the primary growth path: when I achieve or abandon a goal, I reflect on what I learned, and that reflection becomes experience.
383
- - **voice**: How I'm perceived when I communicate \u2014 tone, rhythm, word choice, conversational patterns
418
+ This is Kant's Synthesis (\u7EFC\u5408) \u2014 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.
384
419
 
385
- The key distinction: **teach** transmits abstract knowledge from the outside (a priori), while **growup** captures concrete experience from within (a posteriori). Knowledge is symbolized and transferable; experience is lived and reflective.
420
+ The 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.
386
421
 
387
422
  \`\`\`gherkin
388
423
  Feature: Authentication System Lessons
@@ -517,7 +552,7 @@ var DESC_ACHIEVE = `Goal achieved. Mark my current active goal as completed.
517
552
 
518
553
  Call this when the goal's success criteria are fulfilled. The next goal becomes my new focus.
519
554
 
520
- Optionally provide an experience reflection (Gherkin source) \u2014 this automatically becomes part of my identity as an experience growup. What did I learn? What patterns did I discover?
555
+ Optionally provide an experience reflection (Gherkin source) \u2014 this automatically becomes part of my identity as an experience synthesis. What did I learn? What patterns did I discover?
521
556
 
522
557
  Before calling achieve:
523
558
  - Review the goal's Scenarios \u2014 are the success criteria met?
@@ -529,7 +564,7 @@ var DESC_ABANDON = `Goal abandoned. Mark my current active goal as abandoned.
529
564
 
530
565
  Call this when a goal cannot or should not be continued. The next goal becomes my new focus.
531
566
 
532
- Optionally provide an experience reflection (Gherkin source) \u2014 even failed goals produce learning. Why was it abandoned? What did I discover? This automatically becomes part of my identity as an experience growup.
567
+ Optionally provide an experience reflection (Gherkin source) \u2014 even failed goals produce learning. Why was it abandoned? What did I discover? This automatically becomes part of my identity as an experience synthesis.
533
568
 
534
569
  Abandoning is not failure \u2014 it is learning.`;
535
570
  var DESC_REFLECT = `Reflect: distill multiple experiences into knowledge.
@@ -556,6 +591,8 @@ var DESC_FINISH = `Task finished. Mark a task as completed by name.
556
591
 
557
592
  Call this when a specific task is completed \u2014 its work is done and outcomes verified.
558
593
 
594
+ Optionally provide an experience reflection (Gherkin source) \u2014 this automatically becomes part of my identity as an experience synthesis. What did I learn from this task? What patterns did I discover?
595
+
559
596
  Before calling finish:
560
597
  - Is the task's work actually done?
561
598
  - Have verifiable Scenarios been verified?
@@ -615,7 +652,7 @@ var NEXT = {
615
652
  dismiss: "Role is back to member. `appoint` to reassign, or `fire` to remove from org.",
616
653
  teach: "`teach` more knowledge, or `hire` to bring into organization.",
617
654
  fire: "Role identity remains intact. `hire` to re-hire, or `directory` to see current state.",
618
- growup: "`focus()` to check current goal, or continue working.",
655
+ synthesize: "`focus()` to check current goal, or continue working.",
619
656
  want: "`plan` to design how to achieve it, or `todo` to create tasks directly.",
620
657
  plan: "`todo` to break the plan into concrete tasks.",
621
658
  todo: "Execute the task, then `finish(name)` when done.",
@@ -904,7 +941,7 @@ function bootstrap(platform) {
904
941
  if (platform.allBornRoles().includes(role.name)) continue;
905
942
  platform.born(role.name, role.persona);
906
943
  for (const dim of role.dimensions) {
907
- platform.growup(role.name, dim.type, dim.name, dim.source);
944
+ platform.addIdentity(role.name, dim.type, dim.name, dim.source);
908
945
  }
909
946
  }
910
947
  }
@@ -921,13 +958,13 @@ export {
921
958
  DESC_FIRE,
922
959
  DESC_FOCUS,
923
960
  DESC_FOUND,
924
- DESC_GROWUP,
925
961
  DESC_HIRE,
926
962
  DESC_IDENTITY,
927
963
  DESC_ORGANIZATION,
928
964
  DESC_PLAN,
929
965
  DESC_REFLECT,
930
966
  DESC_SOCIETY,
967
+ DESC_SYNTHESIZE,
931
968
  DESC_TEACH,
932
969
  DESC_TODO,
933
970
  DESC_WANT,
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.growup(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 growing. Add knowledge, experience, or voice to my identity. */\n growup(type: \"knowledge\" | \"experience\" | \"voice\", name: string, source: string): Feature {\n return this.platform.growup(this.name, type, 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. */\n finish(name: string): void {\n this.platform.completeTask(this.name, name);\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## 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- **directory**: List all roles (with states), organizations (with positions). No params needed\n- **find**: Look up a role, organization, or position by name. Params: name\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 = `Society directory — list all known roles and organizations.\n\nReturns a directory of everyone and everything in this society: all born roles (with their states and assignments) and all founded organizations (with their positions and members). Use this to see who exists before using find() to interact with them.`;\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/growup.\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 growup)\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_GROWUP = `I'm growing. Add a new dimension to my identity.\n\nGrowth has three dimensions:\\n- **knowledge**: What I know — first-principles understanding, mental models, abstract patterns\n- **experience**: What I've lived through — concrete, reflective, accumulated through execution. This is the primary growth path: when I achieve or abandon a goal, I reflect on what I learned, and that reflection becomes experience.\n- **voice**: How I'm perceived when I communicate — tone, rhythm, word choice, conversational patterns\n\nThe key distinction: **teach** transmits abstract knowledge from the outside (a priori), while **growup** 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 growup. 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 growup.\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\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 growup: \"`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.growup(role.name, dim.type, dim.name, dim.source);\n }\n }\n}\n"],"mappings":";AAkBA,cA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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAyCV;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AC3NO,SAAS,UAAU,UAA0B;AAClD,aAAW,QAAQ,KAAK,OAAO;AAE7B,QAAI,SAAS,aAAa,EAAE,SAAS,KAAK,IAAI,EAAG;AAEjD,aAAS,KAAK,KAAK,MAAM,KAAK,OAAO;AAErC,eAAW,OAAO,KAAK,YAAY;AACjC,eAAS,OAAO,KAAK,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM;AAAA,IAC3D;AAAA,EACF;AACF;","names":[]}
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,E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,KAAK,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM;AAAA,IAChE;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolexjs",
3
- "version": "0.9.1",
3
+ "version": "0.11.0",
4
4
  "description": "RoleX - AI Agent Role Management Framework",
5
5
  "keywords": [
6
6
  "rolex",
@@ -38,7 +38,7 @@
38
38
  "clean": "rm -rf dist"
39
39
  },
40
40
  "dependencies": {
41
- "@rolexjs/core": "^0.9.1"
41
+ "@rolexjs/core": "^0.11.0"
42
42
  },
43
43
  "devDependencies": {},
44
44
  "publishConfig": {