loopengine 0.4.13 → 0.4.14

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.
@@ -159,9 +159,9 @@ export interface GoalPipelineInput {
159
159
  /** The focus the person chose, instead of the one the brief reads. */
160
160
  focus?: GoalFocus | 'other';
161
161
  }
162
- export declare const GOAL_BRIEF_PROMPT = "You read a goal someone gives LoopEngine, a platform of AI agents that work with information and software: they search, read, write, draft, track, and act in connected apps (email, chat, stores, CRMs, payments, code hosts). They can't do physical work or run large real-world projects on their own.\n\nCall save_brief once:\n- scope: \"in\" when agents can do the work that drives the goal, even though people make the final choice (signups, downloads, sales, donations, replies are all \"in\"); \"partial\" only when the core of the goal is physical or offline action the person must do themselves (building, training, travelling), so agents can only do the information work around it; \"out\" when there is nothing useful an agent could do. scopeReason: one sentence.\n- reading: how you read it. When the wording could be a metaphor (\"land on the moon\", \"climb Everest\" said of a business), prefer the reading the context supports and say which.\n- focus: the one stage of the goal to plan for, from the focuses listed in the request. Growth of users means \"new-signups\" unless the goal speaks of using, keeping or activating people. Answering customers sooner is \"faster-support\". When none fits, focus \"other\" and newFocus: name the stage in a few generic words (label, e.g. \"Hiring\", \"Closing sales deals\", \"Personal health habits\") with a one-sentence hint of what goals with this focus are about. No names of the business, its products, people or places.\n- measure: the number that shows progress, in the person's terms, with what is known about its current value (\"unknown\" when it isn't).\n- measureSource: the system in the context that holds that number (\"none\" when no system does), and measureSourceConnected: true only when the context lists that system as connected.\n- qualifiers: what the goal singles out beyond its main outcome, in its own words (\"mostly small e-commerce shops\", \"especially refunds\", \"this Christmas\"); empty when it singles out nothing.\n- profile: what makes this goal different from others with the same focus. metric: the number it moves; direction: \"up\", \"down\", \"reach\" (a milestone) or \"keep\"; constraints: limits that rule approaches out (no budget, night shifts, vegetarian, an injury, only one market), from the goal and the context, empty when none; timeframe (\"by March\", \"unknown\"); startingPoint (first try, tried before, what's already in place, or \"unknown\"); bottleneck: what's most likely to stop this particular goal (for most weight goals it's sticking with it; for a new product it may be that nobody knows it exists), and bottleneckWhy in a sentence.\n- A listed focus is the same focus when the goal is the same kind of work, even worded differently or aimed the other way (losing and gaining weight; hiring support staff and hiring engineers): use it rather than naming a new one.\n- audience, weeklyHours (from the context, else 3), approvals (from the context's rules, else \"nothing is posted, sent or published without approval\").";
163
- export declare const GOAL_PLAN_PROMPT = "You plan workflows for a confirmed goal brief in LoopEngine. Each suggestion is one workflow (recurring work for one AI agent; a person reviews what it drafts), or a group of workflows that run in order. A small goal may need one or two workflows; a big one several, and groups.\n\nRules:\n1. Levers first, capabilities second. Choose what moves this focus's measure (the playbook's levers, or your own when the context calls for one), then map each to what the workspace has. Never start from what the connected tools could do.\n1b. When the request lists no playbook levers for this focus (none yet, or every one already under this goal), write the levers you need first, in newLevers (two to five), then make each workflow from one of them (its leverId is the lever's key). When levers are listed but one this goal clearly needs is missing, you may add up to two. A new lever is like the playbook's: one distinct approach (one reason it works), in generic words that fit many goals of this focus (no names of this business, its products, people, places or sites; no direction, target or amount when the approach works either way: \"a weekly meal routine toward the target\", not \"eat less\"), with when it fits and doesn't, what it needs, review time, how its effect shows up, guardrails (approval before anything is sent, posted or published), and a generic template with {placeholders}. The workflow's request is where this business's specifics go.\n2. Every workflow serves the brief's focus directly and moves its measure. Workflows that only support it (reporting, onboarding for an acquisition goal, support) go in leftOut with a reason, not in workflows.\n3. One lever per workflow, named in a few generic words (no business, product, person, place or site names: \"list in app marketplaces\", not \"list Wick & Ember on Shopify\"); no two workflows on the same lever. Never propose a lever already saved under the goal (built, proposed or dismissed): those are listed in the request.\n3b. Choose levers for this goal, not for the focus in general. Look at every lever listed: rule out one whose \"not when\", needs or the profile's constraints don't fit; prefer the ones that address the profile's bottleneck; pick ones that work in different ways (not three kinds of tracking). In considered, list every lever you looked at with chosen or ruled_out and a short reason tied to this goal (\"addresses sticking with it\", \"no gym: ruled out\"). Reuse a listed lever whenever its approach fits, even if it was written for a goal aimed the other way: put what's specific to this goal (the direction, the target, the details) in the workflow's request. Write a new lever only for what no listed lever covers.\n4. Three to five workflows for an \"in\" goal, ordered by impact against effort, quickest useful one first; startsAfter when one depends on another. Their humanMinutesPerWeek together stay within three quarters of the brief's weeklyHours, so the plan survives a busy week.\n4b. Every suggestion runs again and again (a weekly scan, a reply to each signup). Work done one time or on a finite list (a one-time audit, submitting to a set list of directories) isn't a workflow: leave it out, or say in setup what the person does once. Never make a weekly workflow that runs out of things to do.\n4c. measure: its own number, in the person's terms, that shows it's working (\"replies per week\", \"signups tagged ref=directories\"). A playbook lever says the measure it usually has: start from it, and change it only when the context calls for it.\n4d. title: the result it brings, in plain words, at most six words: \"Reach new leads every week\", \"Get new signups started\", \"Answer refund requests the same day\". Short enough to read at a glance on a card, keeping the one detail that tells it apart (where or who: \"Answer AI-agent questions on Reddit\"); the other details go in measure, why and request. Not the mechanism (\"Lead scan\", \"Send welcome emails\"): that's a workflow's name.\n4e. group: make a group instead of one workflow when the work happens in stages that hand their result on, each better as its own workflow (its own agent, tools or review): find leads, then draft outreach to each; collect reviews, then reply to the bad ones. Two to four steps, in the order they run; the next starts when the one before finishes and is given its result. Each step has a name (a short label, two or three words, like a workflow's: \"Lead scan\", \"Outreach draft\"), its own request, specific to this context, its agent and needs. The group's title, measure, lever and mechanism are for the whole; leave its request and agent the first step's. Don't group workflows that don't hand anything on: suggest them separately.\n5. Specific to this context: name the person's own communities, systems, products and channels in each request. A request anyone could use unchanged is wrong.\n6. needs: what each workflow uses, each with a kind from the playbook's vocabulary and connected true only when the context lists that kind as connected.\n7. Every request that posts, sends or publishes says nothing goes out without the person's approval.\n8. The measure must be readable. When measureSourceConnected is false, setup says how the number will be read: connecting that source (name it, e.g. \"connect Clerk's user.created webhook so signups and their ref are recorded\"), or, when it can't be connected, a light manual record the person updates weekly (kept with the Records ability). Always record a baseline: the number today. Tag what workflows produce (ref=<channel>) so each one's effect can be told apart.\n8b. setup: what the person does once before the workflows start, at most four steps, each one short sentence (about 20 words at most) saying the action, not the reasoning. When the request lists setup already on the goal, add only what those steps don't cover, usually nothing: never repeat or reword one (the baseline, the signup link, the manual record are said once).\n8b. Every qualifier in the brief is covered by at least one workflow that addresses it directly; list it in that workflow's covers.\n9. \"partial\" scope: at most three workflows, only ones that help the person pursue the goal, and say so in the message (\"helps you pursue\", never \"achieves\"). \"out\" scope: no workflows; the message says plainly why, and offers a smaller or related goal.\n10. agent: an existing agent's exact name when its work fits. When none fits, or there are no agents yet, suggest a new one: agent and newAgent.name the same short lowercase name with hyphens (e.g. \"community-agent\"), and newAgent.instructions two or three sentences on what it does and how it behaves. Group workflows that belong together in one agent rather than one agent each.\n\nCall save_plan once.";
164
- export declare const GOAL_CRITIQUE_PROMPT = "You check a goal plan against its rules before a person sees it. List every issue (be strict, quote the workflow):\n- a workflow that doesn't serve the brief's focus or move its measure;\n- two workflows on the same lever, or one repeating a lever already saved;\n- a request generic enough to fit any business;\n- a need marked connected that the context doesn't list as connected;\n- a request that posts, sends or publishes without saying it waits for approval;\n- review time over three quarters of the weekly budget;\n- a measure whose source isn't connected, with no setup step (new or already on the goal) that connects it or a manual record, or no baseline;\n- more than four setup steps, a step longer than a sentence, or one that repeats or rewords a step already on the goal;\n- a qualifier from the brief no workflow addresses;\n- a suggestion for one-time work, or one on a finite list that will run out (it should be left out);\n- a title longer than six words, or one that names the mechanism (\"Send welcome emails\", \"Lead scan\") instead of the result it brings (\"Get new signups started\");\n- a group whose steps don't hand their result on, or with fewer than two or more than four steps;\n- a lever in newLevers that names this business, its products, people, places or sites, mixes several approaches, or has no way to see its effect;\n- a workflow made from no lever when the request listed none for this focus (it should come from one of newLevers);\n- a plan claiming to achieve a goal that is only partly in scope, or workflows for an out-of-scope goal.\nCall save_review once: passed true only when there are no issues.";
162
+ export declare const GOAL_BRIEF_PROMPT = "You read a goal someone gives LoopEngine, a platform of AI agents that work with information and software: they search, read, write, draft, track, and act in connected apps (email, chat, stores, CRMs, payments, code hosts). They can't do physical work or run large real-world projects on their own.\n\nCall save_brief once:\n- scope: \"in\" when agents can do the work that drives the goal, even though people make the final choice (signups, downloads, sales, donations, replies are all \"in\"); \"partial\" only when the core of the goal is physical or offline action the person must do themselves (building, training, travelling), so agents can only do the information work around it; \"out\" when there is nothing useful an agent could do. scopeReason: one sentence.\n- A goal can be big or small. It may be a result to reach (more signups, fewer refunds, lose 5 kg) or work to hand off (research a topic and publish a weekly report, answer every customer email within a day). Both are \"in\" when agents can do the work.\n- reading: how you read it. When the wording could be a metaphor (\"land on the moon\", \"climb Everest\" said of a business), prefer the reading the context supports and say which.\n- focus: the one stage of the goal to plan for, from the focuses listed in the request. Growth of users means \"new-signups\" unless the goal speaks of using, keeping or activating people. Answering customers sooner is \"faster-support\". When none fits, focus \"other\" and newFocus: name the stage in a few generic words (label, e.g. \"Hiring\", \"Closing sales deals\", \"Personal health habits\") with a one-sentence hint of what goals with this focus are about. No names of the business, its products, people or places.\n- measure: the number that shows progress, in the person's terms, with what is known about its current value (\"unknown\" when it isn't). For work to hand off, it's that work done well and on time (\"a report published every Monday\", \"emails answered within a day\"), with direction \"keep\".\n- measureSource: the system in the context that holds that number (\"none\" when no system does), and measureSourceConnected: true only when the context lists that system as connected.\n- qualifiers: what the goal singles out beyond its main outcome, in its own words (\"mostly small e-commerce shops\", \"especially refunds\", \"this Christmas\"); empty when it singles out nothing.\n- profile: what makes this goal different from others with the same focus. metric: the number it moves; direction: \"up\", \"down\", \"reach\" (a milestone) or \"keep\"; constraints: limits that rule approaches out (no budget, night shifts, vegetarian, an injury, only one market), from the goal and the context, empty when none; timeframe (\"by March\", \"unknown\"); startingPoint (first try, tried before, what's already in place, or \"unknown\"); bottleneck: what's most likely to stop this particular goal (for most weight goals it's sticking with it; for a new product it may be that nobody knows it exists), and bottleneckWhy in a sentence.\n- A listed focus is the same focus when the goal is the same kind of work, even worded differently or aimed the other way (losing and gaining weight; hiring support staff and hiring engineers): use it rather than naming a new one.\n- audience, weeklyHours (from the context, else 3), approvals (from the context's rules, else \"nothing is posted, sent or published without approval\").";
163
+ export declare const GOAL_PLAN_PROMPT = "You plan workflows for a confirmed goal brief in LoopEngine. Each suggestion is one workflow (recurring work for one AI agent; a person reviews what it drafts), or a group of workflows that run in order. A small goal may need one or two workflows; a big one several, and groups.\n\nRules:\n1. Levers first, capabilities second. Choose what moves this focus's measure (the playbook's levers, or your own when the context calls for one), then map each to what the workspace has. Never start from what the connected tools could do.\n1b. When the request lists no playbook levers for this focus (none yet, or every one already under this goal), write the levers you need first, in newLevers (two to five), then make each workflow from one of them (its leverId is the lever's key). When levers are listed but one this goal clearly needs is missing, you may add up to two. A new lever is like the playbook's: one distinct approach (one reason it works), in generic words that fit many goals of this focus (no names of this business, its products, people, places or sites; no direction, target or amount when the approach works either way: \"a weekly meal routine toward the target\", not \"eat less\"), with when it fits and doesn't, what it needs, review time, how its effect shows up, guardrails (approval before anything is sent, posted or published), and a generic template with {placeholders}. The workflow's request is where this business's specifics go.\n2. Every workflow serves the brief's focus directly and moves its measure. Workflows that only support it (reporting, onboarding for an acquisition goal, support) go in leftOut with a reason, not in workflows.\n3. One lever per workflow, named in a few generic words (no business, product, person, place or site names: \"list in app marketplaces\", not \"list Wick & Ember on Shopify\"); no two workflows on the same lever. Never propose a lever already saved under the goal (built, proposed or dismissed): those are listed in the request.\n3b. Choose levers for this goal, not for the focus in general. Look at every lever listed: rule out one whose \"not when\", needs or the profile's constraints don't fit; prefer the ones that address the profile's bottleneck; pick ones that work in different ways (not three kinds of tracking). In considered, list every lever you looked at with chosen or ruled_out and a short reason tied to this goal (\"addresses sticking with it\", \"no gym: ruled out\"). Reuse a listed lever whenever its approach fits, even if it was written for a goal aimed the other way: put what's specific to this goal (the direction, the target, the details) in the workflow's request. Write a new lever only for what no listed lever covers.\n4. As many workflows as the goal needs, no more. Work to hand off usually needs one workflow, or one group when it happens in stages (research, then draft, then publish); add others only when they clearly make that work better. A result to reach, like growth, usually needs three to five. Order them by impact against effort, quickest useful one first; startsAfter when one depends on another. Their humanMinutesPerWeek together stay within three quarters of the brief's weeklyHours, so the plan survives a busy week.\n4b. Every suggestion runs again and again (a weekly scan, a reply to each signup). Work done one time or on a finite list (a one-time audit, submitting to a set list of directories) isn't a workflow: leave it out, or say in setup what the person does once. Never make a weekly workflow that runs out of things to do.\n4c. measure: its own number, in the person's terms, that shows it's working (\"replies per week\", \"signups tagged ref=directories\"). A playbook lever says the measure it usually has: start from it, and change it only when the context calls for it.\n4d. title: the result it brings, in plain words, at most six words: \"Reach new leads every week\", \"Get new signups started\", \"Answer refund requests the same day\". Short enough to read at a glance on a card, keeping the one detail that tells it apart (where or who: \"Answer AI-agent questions on Reddit\"); the other details go in measure, why and request. Not the mechanism (\"Lead scan\", \"Send welcome emails\"): that's a workflow's name.\n4e. group: make a group instead of one workflow when the work happens in stages that hand their result on, each better as its own workflow (its own agent, tools or review): find leads, then draft outreach to each; collect reviews, then reply to the bad ones. Two to four steps, in the order they run; the next starts when the one before finishes and is given its result. Each step has a name (a short label, two or three words, like a workflow's: \"Lead scan\", \"Outreach draft\"), its own request, specific to this context, its agent and needs. The group's title, measure, lever and mechanism are for the whole; leave its request and agent the first step's. Don't group workflows that don't hand anything on: suggest them separately. Approval isn't a step: every workflow already waits for the person's approval before it sends, posts or publishes, so the step that publishes does it after approval.\n5. Specific to this context: name the person's own communities, systems, products and channels in each request. A request anyone could use unchanged is wrong.\n6. needs: what each workflow uses, each with a kind from the playbook's vocabulary and connected true only when the context lists that kind as connected.\n7. Every request that posts, sends or publishes says nothing goes out without the person's approval.\n8. The measure must be readable. For work to hand off, the workflows' own runs show it's done: no baseline, source or manual record is needed unless the brief's measure is a number beyond that. Otherwise, when measureSourceConnected is false, setup says how the number will be read: connecting that source (name it, e.g. \"connect Clerk's user.created webhook so signups and their ref are recorded\"), or, when it can't be connected, a light manual record the person updates weekly (kept with the Records ability). Always record a baseline: the number today. Tag what workflows produce (ref=<channel>) so each one's effect can be told apart.\n8b. setup: what the person does once before the workflows start, at most four steps, each one short sentence (about 20 words at most) saying the action, not the reasoning. When the request lists setup already on the goal, add only what those steps don't cover, usually nothing: never repeat or reword one (the baseline, the signup link, the manual record are said once).\n8b. Every qualifier in the brief is covered by at least one workflow that addresses it directly; list it in that workflow's covers.\n9. \"partial\" scope: at most three workflows, only ones that help the person pursue the goal, and say so in the message (\"helps you pursue\", never \"achieves\"). \"out\" scope: no workflows; the message says plainly why, and offers a smaller or related goal.\n10. agent: an existing agent's exact name when its work fits. When none fits, or there are no agents yet, suggest a new one: agent and newAgent.name the same short lowercase name with hyphens (e.g. \"community-agent\"), and newAgent.instructions two or three sentences on what it does and how it behaves. Group workflows that belong together in one agent rather than one agent each.\n\nCall save_plan once.";
164
+ export declare const GOAL_CRITIQUE_PROMPT = "You check a goal plan against its rules before a person sees it. List every issue (be strict, quote the workflow):\n- a workflow that doesn't serve the brief's focus or move its measure;\n- two workflows on the same lever, or one repeating a lever already saved;\n- a request generic enough to fit any business;\n- a need marked connected that the context doesn't list as connected;\n- a request that posts, sends or publishes without saying it waits for approval;\n- review time over three quarters of the weekly budget;\n- for a result to reach, a measure whose source isn't connected, with no setup step (new or already on the goal) that connects it or a manual record, or no baseline;\n- more than four setup steps, a step longer than a sentence, or one that repeats or rewords a step already on the goal;\n- a qualifier from the brief no workflow addresses;\n- for work to hand off, a setup step for a baseline or a manual record (its runs show it's done);\n- a group step that only approves or reviews (approval is built into every workflow);\n- workflows a small goal didn't need, added to fill out the plan (work to hand off may need just one workflow or one group);\n- a suggestion for one-time work, or one on a finite list that will run out (it should be left out);\n- a title longer than six words, or one that names the mechanism (\"Send welcome emails\", \"Lead scan\") instead of the result it brings (\"Get new signups started\");\n- a group whose steps don't hand their result on, or with fewer than two or more than four steps;\n- a lever in newLevers that names this business, its products, people, places or sites, mixes several approaches, or has no way to see its effect;\n- a workflow made from no lever when the request listed none for this focus (it should come from one of newLevers);\n- a plan claiming to achieve a goal that is only partly in scope, or workflows for an out-of-scope goal.\nCall save_review once: passed true only when there are no issues.";
165
165
  /** A job a person added in their own words, shaped like a planned one. */
166
166
  export declare const GOAL_ADD_JOB_PROMPT = "A person adds a workflow of their own to a goal in LoopEngine, in their own words. Shape it into one suggestion like a planner's (a workflow, or a group of workflows that run in order when the idea has stages that hand their result on), and judge it honestly; it's their business, so advise, don't lecture.\n\nShape it:\n- title: the result it brings, in plain words, at most six words (\"Get weekly sales to the team\", \"Answer customer emails within an hour\"). When the person wrote a long or mechanism-style idea (\"send a weekly sales summary to the team every Monday\"), keep their meaning and the detail that sets it apart (where or who) in a short title, and put the details in measure and request; the mechanism becomes the workflow's name later.\n- measure (its own number), why it moves the goal (mechanism), the agent (an existing agent's exact name when its work fits, else newAgent with a short name and two or three sentences of instructions), needs (connected only when the context lists it), humanMinutesPerWeek, and a request specific to this business that the agent can act on. Anything that posts, sends or publishes says nothing goes out without the person's approval.\n- lever: when it's one of the playbook levers listed, its id in leverId. When none fits, write one generic lever in newLever (one approach, no names of this business, its products, people, places or sites; when it fits and doesn't; what it needs; how its effect shows up; guardrails; a generic template) and put its key in leverId.\n\nJudge it, in verdict:\n- \"added\": it fits the goal and is safe.\n- \"changed\": a sound idea with risky details you changed (an approval added, volume limited, a platform's rules respected); say what you changed in note.\n- \"warned\": it's safe but unlikely to move the goal's measure, repeats a workflow already under the goal, is one-time work rather than something that repeats, or is unlikely to work; say why in note and give a better-aimed alternative.\n- \"refused\": it's deceptive, illegal or against a platform's rules (fake reviews or accounts, spam, buying followers, harvesting private data, impersonation, misleading claims) or could harm people. Don't shape it; say why in note, plainly and briefly, and give a legitimate alternative.\n\nWhen there is no goal, judge it on its own: \"added\" when it suits this business and is safe; \"warned\" when it's unlikely to work or repeats a workflow already listed. Its mechanism is what it gets done for the business, and it has no lever: leave leverId and newLever out.\n\nCall save_job once.";
167
167
  export interface ShapedJob {
@@ -7,9 +7,10 @@ export const GOAL_BRIEF_PROMPT = `You read a goal someone gives LoopEngine, a pl
7
7
 
8
8
  Call save_brief once:
9
9
  - scope: "in" when agents can do the work that drives the goal, even though people make the final choice (signups, downloads, sales, donations, replies are all "in"); "partial" only when the core of the goal is physical or offline action the person must do themselves (building, training, travelling), so agents can only do the information work around it; "out" when there is nothing useful an agent could do. scopeReason: one sentence.
10
+ - A goal can be big or small. It may be a result to reach (more signups, fewer refunds, lose 5 kg) or work to hand off (research a topic and publish a weekly report, answer every customer email within a day). Both are "in" when agents can do the work.
10
11
  - reading: how you read it. When the wording could be a metaphor ("land on the moon", "climb Everest" said of a business), prefer the reading the context supports and say which.
11
12
  - focus: the one stage of the goal to plan for, from the focuses listed in the request. Growth of users means "new-signups" unless the goal speaks of using, keeping or activating people. Answering customers sooner is "faster-support". When none fits, focus "other" and newFocus: name the stage in a few generic words (label, e.g. "Hiring", "Closing sales deals", "Personal health habits") with a one-sentence hint of what goals with this focus are about. No names of the business, its products, people or places.
12
- - measure: the number that shows progress, in the person's terms, with what is known about its current value ("unknown" when it isn't).
13
+ - measure: the number that shows progress, in the person's terms, with what is known about its current value ("unknown" when it isn't). For work to hand off, it's that work done well and on time ("a report published every Monday", "emails answered within a day"), with direction "keep".
13
14
  - measureSource: the system in the context that holds that number ("none" when no system does), and measureSourceConnected: true only when the context lists that system as connected.
14
15
  - qualifiers: what the goal singles out beyond its main outcome, in its own words ("mostly small e-commerce shops", "especially refunds", "this Christmas"); empty when it singles out nothing.
15
16
  - profile: what makes this goal different from others with the same focus. metric: the number it moves; direction: "up", "down", "reach" (a milestone) or "keep"; constraints: limits that rule approaches out (no budget, night shifts, vegetarian, an injury, only one market), from the goal and the context, empty when none; timeframe ("by March", "unknown"); startingPoint (first try, tried before, what's already in place, or "unknown"); bottleneck: what's most likely to stop this particular goal (for most weight goals it's sticking with it; for a new product it may be that nobody knows it exists), and bottleneckWhy in a sentence.
@@ -23,15 +24,15 @@ Rules:
23
24
  2. Every workflow serves the brief's focus directly and moves its measure. Workflows that only support it (reporting, onboarding for an acquisition goal, support) go in leftOut with a reason, not in workflows.
24
25
  3. One lever per workflow, named in a few generic words (no business, product, person, place or site names: "list in app marketplaces", not "list Wick & Ember on Shopify"); no two workflows on the same lever. Never propose a lever already saved under the goal (built, proposed or dismissed): those are listed in the request.
25
26
  3b. Choose levers for this goal, not for the focus in general. Look at every lever listed: rule out one whose "not when", needs or the profile's constraints don't fit; prefer the ones that address the profile's bottleneck; pick ones that work in different ways (not three kinds of tracking). In considered, list every lever you looked at with chosen or ruled_out and a short reason tied to this goal ("addresses sticking with it", "no gym: ruled out"). Reuse a listed lever whenever its approach fits, even if it was written for a goal aimed the other way: put what's specific to this goal (the direction, the target, the details) in the workflow's request. Write a new lever only for what no listed lever covers.
26
- 4. Three to five workflows for an "in" goal, ordered by impact against effort, quickest useful one first; startsAfter when one depends on another. Their humanMinutesPerWeek together stay within three quarters of the brief's weeklyHours, so the plan survives a busy week.
27
+ 4. As many workflows as the goal needs, no more. Work to hand off usually needs one workflow, or one group when it happens in stages (research, then draft, then publish); add others only when they clearly make that work better. A result to reach, like growth, usually needs three to five. Order them by impact against effort, quickest useful one first; startsAfter when one depends on another. Their humanMinutesPerWeek together stay within three quarters of the brief's weeklyHours, so the plan survives a busy week.
27
28
  4b. Every suggestion runs again and again (a weekly scan, a reply to each signup). Work done one time or on a finite list (a one-time audit, submitting to a set list of directories) isn't a workflow: leave it out, or say in setup what the person does once. Never make a weekly workflow that runs out of things to do.
28
29
  4c. measure: its own number, in the person's terms, that shows it's working ("replies per week", "signups tagged ref=directories"). A playbook lever says the measure it usually has: start from it, and change it only when the context calls for it.
29
30
  4d. title: the result it brings, in plain words, at most six words: "Reach new leads every week", "Get new signups started", "Answer refund requests the same day". Short enough to read at a glance on a card, keeping the one detail that tells it apart (where or who: "Answer AI-agent questions on Reddit"); the other details go in measure, why and request. Not the mechanism ("Lead scan", "Send welcome emails"): that's a workflow's name.
30
- 4e. group: make a group instead of one workflow when the work happens in stages that hand their result on, each better as its own workflow (its own agent, tools or review): find leads, then draft outreach to each; collect reviews, then reply to the bad ones. Two to four steps, in the order they run; the next starts when the one before finishes and is given its result. Each step has a name (a short label, two or three words, like a workflow's: "Lead scan", "Outreach draft"), its own request, specific to this context, its agent and needs. The group's title, measure, lever and mechanism are for the whole; leave its request and agent the first step's. Don't group workflows that don't hand anything on: suggest them separately.
31
+ 4e. group: make a group instead of one workflow when the work happens in stages that hand their result on, each better as its own workflow (its own agent, tools or review): find leads, then draft outreach to each; collect reviews, then reply to the bad ones. Two to four steps, in the order they run; the next starts when the one before finishes and is given its result. Each step has a name (a short label, two or three words, like a workflow's: "Lead scan", "Outreach draft"), its own request, specific to this context, its agent and needs. The group's title, measure, lever and mechanism are for the whole; leave its request and agent the first step's. Don't group workflows that don't hand anything on: suggest them separately. Approval isn't a step: every workflow already waits for the person's approval before it sends, posts or publishes, so the step that publishes does it after approval.
31
32
  5. Specific to this context: name the person's own communities, systems, products and channels in each request. A request anyone could use unchanged is wrong.
32
33
  6. needs: what each workflow uses, each with a kind from the playbook's vocabulary and connected true only when the context lists that kind as connected.
33
34
  7. Every request that posts, sends or publishes says nothing goes out without the person's approval.
34
- 8. The measure must be readable. When measureSourceConnected is false, setup says how the number will be read: connecting that source (name it, e.g. "connect Clerk's user.created webhook so signups and their ref are recorded"), or, when it can't be connected, a light manual record the person updates weekly (kept with the Records ability). Always record a baseline: the number today. Tag what workflows produce (ref=<channel>) so each one's effect can be told apart.
35
+ 8. The measure must be readable. For work to hand off, the workflows' own runs show it's done: no baseline, source or manual record is needed unless the brief's measure is a number beyond that. Otherwise, when measureSourceConnected is false, setup says how the number will be read: connecting that source (name it, e.g. "connect Clerk's user.created webhook so signups and their ref are recorded"), or, when it can't be connected, a light manual record the person updates weekly (kept with the Records ability). Always record a baseline: the number today. Tag what workflows produce (ref=<channel>) so each one's effect can be told apart.
35
36
  8b. setup: what the person does once before the workflows start, at most four steps, each one short sentence (about 20 words at most) saying the action, not the reasoning. When the request lists setup already on the goal, add only what those steps don't cover, usually nothing: never repeat or reword one (the baseline, the signup link, the manual record are said once).
36
37
  8b. Every qualifier in the brief is covered by at least one workflow that addresses it directly; list it in that workflow's covers.
37
38
  9. "partial" scope: at most three workflows, only ones that help the person pursue the goal, and say so in the message ("helps you pursue", never "achieves"). "out" scope: no workflows; the message says plainly why, and offers a smaller or related goal.
@@ -45,9 +46,12 @@ export const GOAL_CRITIQUE_PROMPT = `You check a goal plan against its rules bef
45
46
  - a need marked connected that the context doesn't list as connected;
46
47
  - a request that posts, sends or publishes without saying it waits for approval;
47
48
  - review time over three quarters of the weekly budget;
48
- - a measure whose source isn't connected, with no setup step (new or already on the goal) that connects it or a manual record, or no baseline;
49
+ - for a result to reach, a measure whose source isn't connected, with no setup step (new or already on the goal) that connects it or a manual record, or no baseline;
49
50
  - more than four setup steps, a step longer than a sentence, or one that repeats or rewords a step already on the goal;
50
51
  - a qualifier from the brief no workflow addresses;
52
+ - for work to hand off, a setup step for a baseline or a manual record (its runs show it's done);
53
+ - a group step that only approves or reviews (approval is built into every workflow);
54
+ - workflows a small goal didn't need, added to fill out the plan (work to hand off may need just one workflow or one group);
51
55
  - a suggestion for one-time work, or one on a finite list that will run out (it should be left out);
52
56
  - a title longer than six words, or one that names the mechanism ("Send welcome emails", "Lead scan") instead of the result it brings ("Get new signups started");
53
57
  - a group whose steps don't hand their result on, or with fewer than two or more than four steps;
@@ -145,6 +145,9 @@ const goalsPageTemplate = `<!doctype html>
145
145
  .gl-setup-more summary { cursor: pointer; color: var(--accent-ink); font-weight: 600; }
146
146
  .gl-setup-more .gl-setup { margin-top: 4px; }
147
147
  .gl-select { font: inherit; font-size: 13px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
148
+ .gl-examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
149
+ .gl-example { font: inherit; font-size: 12.5px; color: var(--accent-ink); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
150
+ .gl-example:hover { border-color: var(--accent-ink); }
148
151
  .gl-share { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; line-height: 1.45; }
149
152
  .gl-share input { margin-top: 2px; }
150
153
  .gl-discarded-note { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-radius: 10px; background: var(--surface); font-size: 13.5px; }
@@ -192,6 +195,8 @@ ${consoleShellScript}
192
195
  // The focuses in use (the playbook's, and the workspace's own the
193
196
  // planner named), from the server; these until it answers.
194
197
  var FOCUS = [['new-signups', 'Getting new signups or customers'], ['activation', 'Getting new users started'], ['retention', 'Keeping users'], ['faster-support', 'Faster support'], ['revenue-recovery', 'Recovering revenue'], ['ops-hygiene', 'Smoother operations'], ['other', 'Something else']];
198
+ // Goals of every size, to show what can go in the box.
199
+ var GOAL_EXAMPLES = ['Answer every customer email within a day', 'Get 100 paying customers by March', 'Post on LinkedIn three times a week'];
195
200
  var KINDS = [['', 'Choose one'], ['ecommerce', 'Online store'], ['saas', 'Software or app'], ['agency', 'Agency or services'], ['local', 'Local business'], ['creator', 'Creator or media'], ['nonprofit', 'Nonprofit'], ['other', 'Something else']];
196
201
  var REASONS = [['not-relevant', 'Not relevant'], ['too-much-work', 'Too much work'], ['already-doing-it', 'Already doing it']];
197
202
  // Which view: the list (/goals), a new goal (?new=1, or the front page)
@@ -286,10 +291,12 @@ ${consoleShellScript}
286
291
 
287
292
  function newGoalHtml() {
288
293
  return '<div class="gl-card">' +
289
- '<label for="glGoal"><strong>What do you want to achieve?</strong></label>' +
290
- '<textarea id="glGoal" placeholder="e.g. Get 100 paying customers by the end of March">' + esc(startText) + '</textarea>' +
291
- '<details' + (state.about ? '' : ' open') + '><summary class="hint">About your business ' + (state.about ? '(saved, used for every goal)' : '(optional, makes suggestions fit you)') + '</summary>' +
292
- '<textarea id="glAbout" style="margin-top:8px" placeholder="What you sell, to whom, and the tools you use (Gmail, Shopify, Slack' + ELLIPSIS + ')">' + esc(state.about) + '</textarea>' +
294
+ '<label for="glGoal"><strong>What should your agents take care of?</strong></label>' +
295
+ '<p class="hint" style="margin:2px 0 8px">Big or small: work to hand off, or a result to reach.</p>' +
296
+ '<textarea id="glGoal" placeholder="e.g. Help me research AI industry trends and publish a weekly report">' + esc(startText) + '</textarea>' +
297
+ '<div class="gl-examples hint">Or try: ' + GOAL_EXAMPLES.map(function (x) { return '<button type="button" class="gl-example" data-example="' + esc(x) + '">' + esc(x) + '</button>'; }).join('') + '</div>' +
298
+ '<details' + (state.about ? '' : ' open') + '><summary class="hint">About you or your business ' + (state.about ? '(saved, used for every goal)' : '(optional, makes suggestions fit you)') + '</summary>' +
299
+ '<textarea id="glAbout" style="margin-top:8px" placeholder="What you do, for whom, and the tools you use (Gmail, Shopify, Slack' + ELLIPSIS + ')">' + esc(state.about) + '</textarea>' +
293
300
  '<div class="gl-row" style="margin-top:8px"><label class="hint" for="glKind">Kind of business</label><select id="glKind" class="gl-select">' + KINDS.map(function (k) { return '<option value="' + k[0] + '"' + ((state.settings.businessKind || '') === k[0] ? ' selected' : '') + '>' + k[1] + '</option>'; }).join('') + '</select></div>' +
294
301
  (state.settings.cloud ? '<label class="hint gl-share"><input type="checkbox" id="glShare"' + (state.settings.shareLeverStats ? ' checked' : '') + '> Share anonymous stats about which suggestions you save, build and keep, to improve suggestions for everyone. Never your goals, requests or data.</label>' : '') +
295
302
  '</details>' +
@@ -536,13 +543,20 @@ ${consoleShellScript}
536
543
  }
537
544
 
538
545
  function wire() {
546
+ page.querySelectorAll('[data-example]').forEach(function (b) {
547
+ b.addEventListener('click', function () {
548
+ var box = document.getElementById('glGoal');
549
+ box.value = b.dataset.example;
550
+ box.focus();
551
+ });
552
+ });
539
553
  var submit = document.getElementById('glSubmit');
540
554
  if (submit) submit.addEventListener('click', function () {
541
555
  var goal = document.getElementById('glGoal').value.trim();
542
556
  startText = '';
543
557
  var aboutBox = document.getElementById('glAbout');
544
558
  var status = document.getElementById('glSubmitStatus');
545
- if (goal.length < 5) { status.textContent = 'Say what you want to achieve first.'; return; }
559
+ if (goal.length < 5) { status.textContent = 'Say what your agents should take care of first.'; return; }
546
560
  this.disabled = true;
547
561
  status.textContent = 'Starting' + ELLIPSIS;
548
562
  api('POST', '/goals', { goal: goal, about: aboutBox ? aboutBox.value : state.about }).then(function (r) {
@@ -788,7 +802,7 @@ ${consoleShellScript}
788
802
  </script>
789
803
  </body>
790
804
  </html>`;
791
- const GOALS_LEAD = 'Say what you want to achieve. LoopEngine suggests workflows that move it, and groups of workflows that run in order, each with the agent that would run it. Build the ones you want, and generate more when you want new ideas.';
805
+ const GOALS_LEAD = 'LoopEngine suggests the workflows a goal needs: one for a small goal; more, or groups that run in order, for a big one. Build the ones you want.';
792
806
  function goalsPageFor(view) {
793
807
  const title = view === 'goal' ? 'Goal' : view === 'goals' ? 'Goals' : 'New goal';
794
808
  // A list or one goal shows no lead; a new goal explains itself.
@@ -72,7 +72,7 @@ ${consoleSidebarHtml}
72
72
  <div class="le-head plain">
73
73
  <div class="le-head-row">
74
74
  <div class="le-title"><button type="button" class="le-menu-btn" data-le-menu aria-label="Open navigation">&#9776;</button>
75
- <div><h1>Home</h1><p>What you want to achieve, and the workflows and groups of workflows that move it.</p></div>
75
+ <div><h1>Home</h1><p>Your goals, big or small, and the workflows and groups of workflows that take care of them.</p></div>
76
76
  </div>
77
77
  <a class="hm-new" href="/goals?new=1">New goal</a>
78
78
  </div>
@@ -136,9 +136,9 @@ ${consoleShellScript}
136
136
  function renderEmpty() {
137
137
  page.innerHTML =
138
138
  '<div class="hm-empty"><h2>Nothing set up yet</h2>' +
139
- '<p class="hint" style="margin:0">Say what you want to achieve and LoopEngine suggests workflows that move it, and groups of workflows that run in order. Or go straight to a workflow: how an agent does something again and again.</p>' +
139
+ '<p class="hint" style="margin:0">Give LoopEngine a goal, big or small, and it suggests the workflows for it, and groups of workflows that run in order. Or go straight to a workflow: how an agent does something again and again.</p>' +
140
140
  '<div class="hm-ways">' +
141
- '<a class="hm-way" href="/goals?new=1"><b>Start from a goal</b><span>Get workflows suggested for what you want to achieve.</span></a>' +
141
+ '<a class="hm-way" href="/goals?new=1"><b>Start from a goal</b><span>Work to hand off or a result to reach: get workflows suggested for it.</span></a>' +
142
142
  '<a class="hm-way" href="/workflows/new"><b>Build a workflow</b><span>Say what the agent should do, or start from an example.</span></a>' +
143
143
  '</div></div>';
144
144
  }
@@ -59,8 +59,19 @@ async function latestVersions(projectDir) {
59
59
  latestCache = { value, template, until: Date.now() + 60_000, at: new Date().toISOString() };
60
60
  return latestCache;
61
61
  }
62
- async function latestLoopengine(projectDir) {
63
- return (await latestVersions(projectDir)).value;
62
+ /** The newest version of a package that the project's package.json
63
+ * allows (npm lists the matching ones, oldest first). */
64
+ async function newestWithinRange(name, projectDir) {
65
+ try {
66
+ const range = JSON.parse(readFileSync(join(projectDir, 'package.json'), 'utf8')).dependencies?.[name];
67
+ if (!range)
68
+ return null;
69
+ const parsed = JSON.parse((await run('npm', ['view', `${name}@${range}`, 'version', '--json'], projectDir, 15_000)).trim() || 'null');
70
+ return (Array.isArray(parsed) ? parsed[parsed.length - 1] : parsed) ?? null;
71
+ }
72
+ catch {
73
+ return null;
74
+ }
64
75
  }
65
76
  function templateVersion(projectDir) {
66
77
  const path = join(projectDir, '.create-loopengine.json');
@@ -159,9 +170,12 @@ export async function runUpgrade(options) {
159
170
  throw new UpgradeError(result.error);
160
171
  if (result.npmInstall && !result.npmInstall.ok)
161
172
  throw new UpgradeError(`Installing the new packages failed: ${result.npmInstall.error ?? 'unknown error'}`);
162
- // package.json may already allow the latest version while an older
163
- // one stays installed (the lockfile keeps it); install it outright.
164
- const latest = await latestLoopengine(projectDir);
173
+ // package.json may already allow a newer version while an older one
174
+ // stays installed (the lockfile keeps it); install it outright. Only
175
+ // within package.json's range (the template's, after the step above):
176
+ // a loopengine newer than the template was made for may drop a name
177
+ // its adapters/http.ts imports, and the server wouldn't start.
178
+ const latest = await newestWithinRange('loopengine', projectDir);
165
179
  const current = loopengineVersion();
166
180
  if (latest && semver.valid(current) && semver.gt(latest, current) && !result.dependencies.some((d) => d.name === 'loopengine')) {
167
181
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loopengine",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
4
4
  "type": "module",
5
5
  "description": "Runtime for tool-using AI agents with a transparent ReAct loop.",
6
6
  "license": "MIT",