@telora/daemon 0.16.42 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +6 -3
- package/dist/completion/event.d.ts +17 -0
- package/dist/completion/event.d.ts.map +1 -1
- package/dist/completion/event.js +46 -12
- package/dist/completion/event.js.map +1 -1
- package/dist/directive/directive-queue.d.ts +117 -0
- package/dist/directive/directive-queue.d.ts.map +1 -0
- package/dist/directive/directive-queue.js +114 -0
- package/dist/directive/directive-queue.js.map +1 -0
- package/dist/directive/stage-tracker.d.ts +23 -0
- package/dist/directive/stage-tracker.d.ts.map +1 -0
- package/dist/directive/stage-tracker.js +27 -0
- package/dist/directive/stage-tracker.js.map +1 -0
- package/dist/directive-executor.d.ts +3 -102
- package/dist/directive-executor.d.ts.map +1 -1
- package/dist/directive-executor.js +14 -112
- package/dist/directive-executor.js.map +1 -1
- package/dist/escalations.d.ts +38 -0
- package/dist/escalations.d.ts.map +1 -0
- package/dist/escalations.js +38 -0
- package/dist/escalations.js.map +1 -0
- package/dist/focus-engine.d.ts.map +1 -1
- package/dist/focus-engine.js +28 -0
- package/dist/focus-engine.js.map +1 -1
- package/dist/focus-executor.d.ts.map +1 -1
- package/dist/focus-executor.js +1 -0
- package/dist/focus-executor.js.map +1 -1
- package/dist/prd-clearance-engine.d.ts +121 -0
- package/dist/prd-clearance-engine.d.ts.map +1 -0
- package/dist/prd-clearance-engine.js +164 -0
- package/dist/prd-clearance-engine.js.map +1 -0
- package/dist/prd-controller.d.ts +87 -0
- package/dist/prd-controller.d.ts.map +1 -0
- package/dist/prd-controller.js +319 -0
- package/dist/prd-controller.js.map +1 -0
- package/dist/prd-divergence.d.ts +76 -0
- package/dist/prd-divergence.d.ts.map +1 -0
- package/dist/prd-divergence.js +148 -0
- package/dist/prd-divergence.js.map +1 -0
- package/dist/prompt-sections/context-sections.d.ts +32 -0
- package/dist/prompt-sections/context-sections.d.ts.map +1 -0
- package/dist/prompt-sections/context-sections.js +86 -0
- package/dist/prompt-sections/context-sections.js.map +1 -0
- package/dist/prompt-sections/execution-sections.d.ts +82 -0
- package/dist/prompt-sections/execution-sections.d.ts.map +1 -0
- package/dist/prompt-sections/execution-sections.js +601 -0
- package/dist/prompt-sections/execution-sections.js.map +1 -0
- package/dist/prompt-sections/persona-sections.d.ts +133 -0
- package/dist/prompt-sections/persona-sections.d.ts.map +1 -0
- package/dist/prompt-sections/persona-sections.js +317 -0
- package/dist/prompt-sections/persona-sections.js.map +1 -0
- package/dist/prompt-sections/role-sections.d.ts +24 -0
- package/dist/prompt-sections/role-sections.d.ts.map +1 -0
- package/dist/prompt-sections/role-sections.js +78 -0
- package/dist/prompt-sections/role-sections.js.map +1 -0
- package/dist/prompt-sections/shared.d.ts +66 -0
- package/dist/prompt-sections/shared.d.ts.map +1 -0
- package/dist/prompt-sections/shared.js +33 -0
- package/dist/prompt-sections/shared.js.map +1 -0
- package/dist/queries/prd.d.ts +79 -0
- package/dist/queries/prd.d.ts.map +1 -0
- package/dist/queries/prd.js +116 -0
- package/dist/queries/prd.js.map +1 -0
- package/dist/team-prompt-base.d.ts +16 -287
- package/dist/team-prompt-base.d.ts.map +1 -1
- package/dist/team-prompt-base.js +20 -1089
- package/dist/team-prompt-base.js.map +1 -1
- package/dist/templates/claude-md.d.ts.map +1 -1
- package/dist/templates/claude-md.js +0 -1
- package/dist/templates/claude-md.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persona and framing section builders: review-defect remediation directive,
|
|
3
|
+
* remediation framing, loop-data maintenance, the close-loop bookkeeper persona
|
|
4
|
+
* + drift check, and the incremental resume-delta message. Extracted from
|
|
5
|
+
* team-prompt-base.ts.
|
|
6
|
+
*/
|
|
7
|
+
import type { FocusIssueInfo } from '../types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Build the review-defect remediation directive.
|
|
10
|
+
*
|
|
11
|
+
* Emitted when the team is being respawned to address issues filed by a
|
|
12
|
+
* review pass (see review-defect-detector.ts). The directive orients the
|
|
13
|
+
* team to "fix defects, not expand scope" -- the open issues on this
|
|
14
|
+
* focus are review-filed defects, not net-new product work.
|
|
15
|
+
*
|
|
16
|
+
* Returns an empty array when no review-filed defects are pending. The
|
|
17
|
+
* caller decides when to include the section based on detector state.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildRemediationDirectiveSection(reviewFiledOpenCount: number): string[];
|
|
20
|
+
/**
|
|
21
|
+
* The marker we look for in the assembled stage-directive context to know a
|
|
22
|
+
* review report is being rendered into the prompt. The focus.last_review_report
|
|
23
|
+
* resolver in assembly-resolvers.ts emits this exact heading.
|
|
24
|
+
*/
|
|
25
|
+
export declare const LAST_REVIEW_REPORT_HEADING = "## Last Review Report";
|
|
26
|
+
/**
|
|
27
|
+
* Build the remediation framing line for a review-driven dev session.
|
|
28
|
+
*
|
|
29
|
+
* Detection signal: the assembled stage-directive context contains a
|
|
30
|
+
* non-empty `## Last Review Report` section. When present, emit a single
|
|
31
|
+
* framing line that orients the agent toward "you previously shipped this --
|
|
32
|
+
* address the gaps, do not redo correct work". When absent, emit nothing.
|
|
33
|
+
*
|
|
34
|
+
* Reads ONLY from the assembled context string. No DB calls -- the
|
|
35
|
+
* focus.last_review_report resolver is the source of truth for whether a
|
|
36
|
+
* report exists; this section is a renderer of that signal.
|
|
37
|
+
*
|
|
38
|
+
* The caller's responsibility is to render this section BEFORE the
|
|
39
|
+
* assembled context, so the framing line appears above the report content
|
|
40
|
+
* in the final prompt.
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildRemediationFramingSection(assembledContext: string): string[];
|
|
43
|
+
/**
|
|
44
|
+
* Build the loop maintenance directive section.
|
|
45
|
+
* Instructs the agent to proactively maintain loop data as it works,
|
|
46
|
+
* making its thinking visible to humans for review and correction.
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildLoopMaintenanceSection(): string[];
|
|
49
|
+
/**
|
|
50
|
+
* Build the close_loop bookkeeper persona.
|
|
51
|
+
*
|
|
52
|
+
* The close_loop stage runs a different kind of agent: a "bookkeeper" whose
|
|
53
|
+
* single mandate is to drive every anchored injection to a terminal state
|
|
54
|
+
* (verified or escalated) and emit the residual tree-drift / incomplete-
|
|
55
|
+
* planning signals. The persona is intentionally narrow and asymmetric --
|
|
56
|
+
* the only outcomes for an anchored injection are:
|
|
57
|
+
*
|
|
58
|
+
* - verified -> evidence in the worktree supports the FRT overlay flip;
|
|
59
|
+
* call telora_reality_tree_injection_verify(...).
|
|
60
|
+
* - escalated -> evidence is absent or ambiguous; file an
|
|
61
|
+
* `injection_unverified` escalation. There is NO third
|
|
62
|
+
* option. The bookkeeper does not write code, does not
|
|
63
|
+
* propose new injections, and does not silently lower
|
|
64
|
+
* the bar by leaving an injection in `proposed` or
|
|
65
|
+
* `in_progress` indefinitely.
|
|
66
|
+
*
|
|
67
|
+
* Asymmetric bias: the system moves reality toward intent (verifying
|
|
68
|
+
* injections, retiring closed UDEs) but NEVER lowers intent toward the
|
|
69
|
+
* shipped reality (a delivery that did not actually flip its target UDE
|
|
70
|
+
* must escalate, not have its FRT overlay edited to match what shipped).
|
|
71
|
+
*
|
|
72
|
+
* The literal tokens "verified", "escalated", "no third option", "evidence",
|
|
73
|
+
* and "asymmetric" all appear verbatim so the persona is grep-verifiable
|
|
74
|
+
* by the close_loop directive tests and reviewers.
|
|
75
|
+
*
|
|
76
|
+
* Dispatched per stage `close_loop` -- the `loop.persona` resolver picks
|
|
77
|
+
* this variant when invoked with `variant=close_loop`, and the close_loop
|
|
78
|
+
* stage assembly recipe in the dispatcher uses `loop.persona(variant=close_loop)`.
|
|
79
|
+
*/
|
|
80
|
+
export declare function buildCloseLoopBookkeeperPersona(): string;
|
|
81
|
+
/**
|
|
82
|
+
* Build the close_loop drift-check section.
|
|
83
|
+
*
|
|
84
|
+
* The close_loop stage agent (the focus "bookkeeper") propagates verified
|
|
85
|
+
* injection effects back into the CRT and checks the residual tree for drift
|
|
86
|
+
* against the focus statement. There is no stored apex node in the tree --
|
|
87
|
+
* `focus.description` is the implicit apex of the reality tree; UDEs
|
|
88
|
+
* articulate the gap between current reality and that statement.
|
|
89
|
+
*
|
|
90
|
+
* This section renders the focus statement verbatim and instructs the
|
|
91
|
+
* agent to compare residual UDEs against it. It MUST contain both the
|
|
92
|
+
* focus.description text and the literal token `tree_drift` so the
|
|
93
|
+
* directive-executor can confirm the close_loop prompt was assembled
|
|
94
|
+
* correctly (and so reviewers can grep for it).
|
|
95
|
+
*
|
|
96
|
+
* If `focusDescription` is null/empty, the section emits a notice that
|
|
97
|
+
* no apex statement is available and the drift check cannot be performed
|
|
98
|
+
* -- the agent should escalate.
|
|
99
|
+
*
|
|
100
|
+
* See:
|
|
101
|
+
* - Design principle "Tree-Focus Apex" in memory/design-principles.md
|
|
102
|
+
* - Wiki page "reality-trees-crt-frt-planning-layer", section
|
|
103
|
+
* "Tree-Focus Apex Convention"
|
|
104
|
+
*/
|
|
105
|
+
export declare function buildCloseLoopDriftCheckSection(focusDescription: string | null | undefined): string[];
|
|
106
|
+
/** Inputs for the incremental resume-delta message. */
|
|
107
|
+
export interface ResumeDeltaContext {
|
|
108
|
+
/** Lineage being resumed (e.g. 'coding', 'review'). */
|
|
109
|
+
lineage: string;
|
|
110
|
+
/** Focus name for the framing line. */
|
|
111
|
+
focusName: string;
|
|
112
|
+
/** Assembled git.diff_against_base content (may be empty). */
|
|
113
|
+
gitDiff: string;
|
|
114
|
+
/**
|
|
115
|
+
* Open review-filed issues from the prior cycle. For the review lineage these
|
|
116
|
+
* are findings to re-verify; for coding they are defects to address.
|
|
117
|
+
*/
|
|
118
|
+
priorFindings: FocusIssueInfo[];
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Build the incremental delta message sent when a lineage's session is RESUMED
|
|
122
|
+
* (INJ-D). A resumed Claude session already holds its role framework, tools,
|
|
123
|
+
* status rules, and accumulated context -- re-sending the full prompt wastes
|
|
124
|
+
* tokens and re-anchors. The delta carries only what changed since the last
|
|
125
|
+
* cycle (the diff) plus the prior findings, deliberately omitting the
|
|
126
|
+
* role-framework sections.
|
|
127
|
+
*
|
|
128
|
+
* Anti-anchoring: for the review lineage the prior findings are framed as "to
|
|
129
|
+
* VERIFY, not trust" -- the diff and acceptance criteria remain ground truth
|
|
130
|
+
* each cycle, so a resumed reviewer re-examines rather than rubber-stamping.
|
|
131
|
+
*/
|
|
132
|
+
export declare function buildResumeDeltaMessage(ctx: ResumeDeltaContext): string;
|
|
133
|
+
//# sourceMappingURL=persona-sections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persona-sections.d.ts","sourceRoot":"","sources":["../../src/prompt-sections/persona-sections.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;GAUG;AACH,wBAAgB,gCAAgC,CAC9C,oBAAoB,EAAE,MAAM,GAC3B,MAAM,EAAE,CAqBV;AAED;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,0BAA0B,CAAC;AAElE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,8BAA8B,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,EAAE,CAQjF;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,EAAE,CA8BtD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,+BAA+B,IAAI,MAAM,CAuDxD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC1C,MAAM,EAAE,CAqCV;AAMD,uDAAuD;AACvD,MAAM,WAAW,kBAAkB;IACjC,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,aAAa,EAAE,cAAc,EAAE,CAAC;CACjC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,CA+CvE"}
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persona and framing section builders: review-defect remediation directive,
|
|
3
|
+
* remediation framing, loop-data maintenance, the close-loop bookkeeper persona
|
|
4
|
+
* + drift check, and the incremental resume-delta message. Extracted from
|
|
5
|
+
* team-prompt-base.ts.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Build the review-defect remediation directive.
|
|
9
|
+
*
|
|
10
|
+
* Emitted when the team is being respawned to address issues filed by a
|
|
11
|
+
* review pass (see review-defect-detector.ts). The directive orients the
|
|
12
|
+
* team to "fix defects, not expand scope" -- the open issues on this
|
|
13
|
+
* focus are review-filed defects, not net-new product work.
|
|
14
|
+
*
|
|
15
|
+
* Returns an empty array when no review-filed defects are pending. The
|
|
16
|
+
* caller decides when to include the section based on detector state.
|
|
17
|
+
*/
|
|
18
|
+
export function buildRemediationDirectiveSection(reviewFiledOpenCount) {
|
|
19
|
+
if (reviewFiledOpenCount <= 0)
|
|
20
|
+
return [];
|
|
21
|
+
return [
|
|
22
|
+
'### Review-Defect Remediation',
|
|
23
|
+
'',
|
|
24
|
+
`These deliveries contain ${reviewFiledOpenCount} open issue(s) filed by the`,
|
|
25
|
+
'review team after auditing your prior work. Address them as defects to',
|
|
26
|
+
'fix, not new scope to expand. Specifically:',
|
|
27
|
+
'',
|
|
28
|
+
'- Do NOT create additional deliveries unless directly required to fix a',
|
|
29
|
+
' flagged defect.',
|
|
30
|
+
'- Do NOT widen scope. The review identified specific gaps -- close them.',
|
|
31
|
+
'- Issues filed during this review pass are tagged with `created_by_role_id`;',
|
|
32
|
+
' treat them as the work plan for this remediation cycle.',
|
|
33
|
+
'- When all review-filed issues are Done, the daemon will automatically',
|
|
34
|
+
' return the focus to verify so the next review pass can run.',
|
|
35
|
+
'',
|
|
36
|
+
'You are in a remediation cycle. The bound is small (default 3 cycles)',
|
|
37
|
+
'before escalation -- finish the defects efficiently and accurately.',
|
|
38
|
+
'',
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The marker we look for in the assembled stage-directive context to know a
|
|
43
|
+
* review report is being rendered into the prompt. The focus.last_review_report
|
|
44
|
+
* resolver in assembly-resolvers.ts emits this exact heading.
|
|
45
|
+
*/
|
|
46
|
+
export const LAST_REVIEW_REPORT_HEADING = '## Last Review Report';
|
|
47
|
+
/**
|
|
48
|
+
* Build the remediation framing line for a review-driven dev session.
|
|
49
|
+
*
|
|
50
|
+
* Detection signal: the assembled stage-directive context contains a
|
|
51
|
+
* non-empty `## Last Review Report` section. When present, emit a single
|
|
52
|
+
* framing line that orients the agent toward "you previously shipped this --
|
|
53
|
+
* address the gaps, do not redo correct work". When absent, emit nothing.
|
|
54
|
+
*
|
|
55
|
+
* Reads ONLY from the assembled context string. No DB calls -- the
|
|
56
|
+
* focus.last_review_report resolver is the source of truth for whether a
|
|
57
|
+
* report exists; this section is a renderer of that signal.
|
|
58
|
+
*
|
|
59
|
+
* The caller's responsibility is to render this section BEFORE the
|
|
60
|
+
* assembled context, so the framing line appears above the report content
|
|
61
|
+
* in the final prompt.
|
|
62
|
+
*/
|
|
63
|
+
export function buildRemediationFramingSection(assembledContext) {
|
|
64
|
+
if (!assembledContext.includes(LAST_REVIEW_REPORT_HEADING))
|
|
65
|
+
return [];
|
|
66
|
+
return [
|
|
67
|
+
'## Remediation Mode',
|
|
68
|
+
'',
|
|
69
|
+
"You previously delivered this focus. Review identified the following gaps. Address them; don't redo already-correct work.",
|
|
70
|
+
'',
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Build the loop maintenance directive section.
|
|
75
|
+
* Instructs the agent to proactively maintain loop data as it works,
|
|
76
|
+
* making its thinking visible to humans for review and correction.
|
|
77
|
+
*/
|
|
78
|
+
export function buildLoopMaintenanceSection() {
|
|
79
|
+
return [
|
|
80
|
+
'### Loop Data Maintenance',
|
|
81
|
+
'',
|
|
82
|
+
'As you work, proactively maintain loop data to make your thinking visible.',
|
|
83
|
+
'Loop data is how humans review and correct your understanding. Treat it',
|
|
84
|
+
'as a mirror of your current mental model, not a report to write at the end.',
|
|
85
|
+
'',
|
|
86
|
+
'**When to update loop documents** (`telora_loop_document`):',
|
|
87
|
+
'- When your understanding of the focus or delivery shifts during work',
|
|
88
|
+
'- When you discover architectural constraints or tradeoffs not yet captured',
|
|
89
|
+
'- When a human correction reveals something about intent you did not have',
|
|
90
|
+
'- Re-rank documents when priorities shift (higher rank = more important)',
|
|
91
|
+
'',
|
|
92
|
+
'**When to generate questions** (`telora_loop_question`):',
|
|
93
|
+
'- When you encounter uncertainty or ambiguity in requirements',
|
|
94
|
+
'- When you see tradeoffs that may need human judgment',
|
|
95
|
+
'- When something seems inconsistent between layers (focus vs delivery)',
|
|
96
|
+
'- Use type "generated" and rank by importance (lower sort_order = higher priority)',
|
|
97
|
+
'',
|
|
98
|
+
'**When to answer questions** (`telora_loop_answer`):',
|
|
99
|
+
'- Answer fixed questions when you have a position based on your work',
|
|
100
|
+
'- Update answers when your position changes due to new information',
|
|
101
|
+
'- Answer your own generated questions when you reach conclusions',
|
|
102
|
+
'',
|
|
103
|
+
'**Cadence**: Update loop data at natural work boundaries -- after completing',
|
|
104
|
+
'an issue, when switching between deliveries, or when a significant insight',
|
|
105
|
+
'emerges. Do not batch all updates to the end of the session.',
|
|
106
|
+
'',
|
|
107
|
+
];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Build the close_loop bookkeeper persona.
|
|
111
|
+
*
|
|
112
|
+
* The close_loop stage runs a different kind of agent: a "bookkeeper" whose
|
|
113
|
+
* single mandate is to drive every anchored injection to a terminal state
|
|
114
|
+
* (verified or escalated) and emit the residual tree-drift / incomplete-
|
|
115
|
+
* planning signals. The persona is intentionally narrow and asymmetric --
|
|
116
|
+
* the only outcomes for an anchored injection are:
|
|
117
|
+
*
|
|
118
|
+
* - verified -> evidence in the worktree supports the FRT overlay flip;
|
|
119
|
+
* call telora_reality_tree_injection_verify(...).
|
|
120
|
+
* - escalated -> evidence is absent or ambiguous; file an
|
|
121
|
+
* `injection_unverified` escalation. There is NO third
|
|
122
|
+
* option. The bookkeeper does not write code, does not
|
|
123
|
+
* propose new injections, and does not silently lower
|
|
124
|
+
* the bar by leaving an injection in `proposed` or
|
|
125
|
+
* `in_progress` indefinitely.
|
|
126
|
+
*
|
|
127
|
+
* Asymmetric bias: the system moves reality toward intent (verifying
|
|
128
|
+
* injections, retiring closed UDEs) but NEVER lowers intent toward the
|
|
129
|
+
* shipped reality (a delivery that did not actually flip its target UDE
|
|
130
|
+
* must escalate, not have its FRT overlay edited to match what shipped).
|
|
131
|
+
*
|
|
132
|
+
* The literal tokens "verified", "escalated", "no third option", "evidence",
|
|
133
|
+
* and "asymmetric" all appear verbatim so the persona is grep-verifiable
|
|
134
|
+
* by the close_loop directive tests and reviewers.
|
|
135
|
+
*
|
|
136
|
+
* Dispatched per stage `close_loop` -- the `loop.persona` resolver picks
|
|
137
|
+
* this variant when invoked with `variant=close_loop`, and the close_loop
|
|
138
|
+
* stage assembly recipe in the dispatcher uses `loop.persona(variant=close_loop)`.
|
|
139
|
+
*/
|
|
140
|
+
export function buildCloseLoopBookkeeperPersona() {
|
|
141
|
+
return [
|
|
142
|
+
'## Persona: Close-Loop Bookkeeper',
|
|
143
|
+
'',
|
|
144
|
+
'You are the focus bookkeeper. The focus has reached the `close_loop` stage,',
|
|
145
|
+
'which means all deliveries are settled and review has converged. Your job',
|
|
146
|
+
'is NOT to write code, NOT to widen scope, NOT to propose new injections.',
|
|
147
|
+
'Your job is to drive every anchored injection on this focus to a terminal',
|
|
148
|
+
'state.',
|
|
149
|
+
'',
|
|
150
|
+
'**Per-injection sweep (asymmetric outcomes):**',
|
|
151
|
+
'',
|
|
152
|
+
'For each injection anchored to a delivery in this focus, there are exactly',
|
|
153
|
+
'two outcomes -- no third option:',
|
|
154
|
+
'',
|
|
155
|
+
'1. **verified** -- the worktree evidence supports the FRT overlay flip.',
|
|
156
|
+
' The target UDE is genuinely retired; downstream effects flipped as',
|
|
157
|
+
' the injection promised. Call',
|
|
158
|
+
' `telora_reality_tree_injection_verify(injectionId, evidence)` so the',
|
|
159
|
+
' injection node is marked verified, its targets edges are deleted, and',
|
|
160
|
+
' the FRT overlays on targeted UDEs promote to CRT reality.',
|
|
161
|
+
'',
|
|
162
|
+
'2. **escalated** -- evidence is absent, ambiguous, or contradicts the',
|
|
163
|
+
' expected reality change. File an `injection_unverified` escalation',
|
|
164
|
+
' with the specific gap: which UDE did not flip, which evidence was',
|
|
165
|
+
' sought and not found, which delivery shipped without realizing the',
|
|
166
|
+
' injection. The escalation surfaces to a human; the focus stays at',
|
|
167
|
+
' `close_loop` until every anchored injection is verified or escalated.',
|
|
168
|
+
'',
|
|
169
|
+
'**Evidence rules.** Evidence MUST be worktree-checkable: files exist,',
|
|
170
|
+
'tests pass, code matches a pattern, migrations applied, lint clean.',
|
|
171
|
+
'Evidence is NEVER "the team said they did it" or "an agent narration',
|
|
172
|
+
'claimed it shipped". If evidence is not in the worktree, it does not',
|
|
173
|
+
'exist for the purposes of this sweep -- escalate.',
|
|
174
|
+
'',
|
|
175
|
+
'**Asymmetric correction.** The control loop moves reality toward intent,',
|
|
176
|
+
'never the reverse. If a delivery shipped code that does not actually',
|
|
177
|
+
'flip its target UDE, you ESCALATE (the intent was missed); you do NOT',
|
|
178
|
+
'silently rewrite the FRT overlay statement to match what shipped. The',
|
|
179
|
+
'asymmetric bias is the whole reason the bookkeeper exists.',
|
|
180
|
+
'',
|
|
181
|
+
'**Other checks the dispatcher delegates to you:**',
|
|
182
|
+
'',
|
|
183
|
+
'- `incomplete_planning` -- any deliveries that shipped without anchoring',
|
|
184
|
+
' an injection, or any "injection-shaped" residual work the focus did',
|
|
185
|
+
' not declare. File one `incomplete_planning` escalation per gap.',
|
|
186
|
+
'- `tree_drift` -- residual UDEs in the focus tree that no longer relate',
|
|
187
|
+
' to the focus statement (the implicit apex). See the drift-check',
|
|
188
|
+
' section below for the procedure.',
|
|
189
|
+
'',
|
|
190
|
+
'You do not advance the focus to `done` yourself. The daemon advances',
|
|
191
|
+
'`close_loop -> done` automatically once every anchored injection is',
|
|
192
|
+
'terminal (verified or escalated) and the residual checks are clean.',
|
|
193
|
+
'',
|
|
194
|
+
].join('\n');
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Build the close_loop drift-check section.
|
|
198
|
+
*
|
|
199
|
+
* The close_loop stage agent (the focus "bookkeeper") propagates verified
|
|
200
|
+
* injection effects back into the CRT and checks the residual tree for drift
|
|
201
|
+
* against the focus statement. There is no stored apex node in the tree --
|
|
202
|
+
* `focus.description` is the implicit apex of the reality tree; UDEs
|
|
203
|
+
* articulate the gap between current reality and that statement.
|
|
204
|
+
*
|
|
205
|
+
* This section renders the focus statement verbatim and instructs the
|
|
206
|
+
* agent to compare residual UDEs against it. It MUST contain both the
|
|
207
|
+
* focus.description text and the literal token `tree_drift` so the
|
|
208
|
+
* directive-executor can confirm the close_loop prompt was assembled
|
|
209
|
+
* correctly (and so reviewers can grep for it).
|
|
210
|
+
*
|
|
211
|
+
* If `focusDescription` is null/empty, the section emits a notice that
|
|
212
|
+
* no apex statement is available and the drift check cannot be performed
|
|
213
|
+
* -- the agent should escalate.
|
|
214
|
+
*
|
|
215
|
+
* See:
|
|
216
|
+
* - Design principle "Tree-Focus Apex" in memory/design-principles.md
|
|
217
|
+
* - Wiki page "reality-trees-crt-frt-planning-layer", section
|
|
218
|
+
* "Tree-Focus Apex Convention"
|
|
219
|
+
*/
|
|
220
|
+
export function buildCloseLoopDriftCheckSection(focusDescription) {
|
|
221
|
+
const lines = [];
|
|
222
|
+
lines.push('### Tree-Focus Apex Drift Check (tree_drift)');
|
|
223
|
+
lines.push('');
|
|
224
|
+
lines.push('Telora reality trees do NOT have a stored apex/root node.');
|
|
225
|
+
lines.push('The focus statement -- `focus.description` -- IS the implicit');
|
|
226
|
+
lines.push('apex. UDEs articulate the gap between current reality and that');
|
|
227
|
+
lines.push('statement. Classical Goldratt single-apex CRT structure is not');
|
|
228
|
+
lines.push('used here; the focus is the alignment target.');
|
|
229
|
+
lines.push('');
|
|
230
|
+
lines.push('**Focus statement (apex):**');
|
|
231
|
+
lines.push('');
|
|
232
|
+
if (focusDescription && focusDescription.trim()) {
|
|
233
|
+
lines.push('> ' + focusDescription.trim().split('\n').join('\n> '));
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
lines.push('> _(no focus.description set -- escalate; drift check cannot run)_');
|
|
237
|
+
}
|
|
238
|
+
lines.push('');
|
|
239
|
+
lines.push('**tree_drift check:**');
|
|
240
|
+
lines.push('');
|
|
241
|
+
lines.push('1. Enumerate residual UDEs in the CRT (nodeType=undesired_effect,');
|
|
242
|
+
lines.push(' status=active) for this focus.');
|
|
243
|
+
lines.push('2. For each UDE, ask: does it describe a gap that the focus');
|
|
244
|
+
lines.push(' statement above commits to closing?');
|
|
245
|
+
lines.push('3. UDEs that no longer relate to the focus statement are DRIFT.');
|
|
246
|
+
lines.push(' Mark them inactive or escalate for human triage -- do not');
|
|
247
|
+
lines.push(' leave drift in an "active" focus tree.');
|
|
248
|
+
lines.push('4. UDEs that DO relate but remain unaddressed after all anchored');
|
|
249
|
+
lines.push(' injections are verified are the unresolved gap -- file them');
|
|
250
|
+
lines.push(' as escalations so the next focus / human review picks them up.');
|
|
251
|
+
lines.push('');
|
|
252
|
+
lines.push('Reminder: there is no apex node to verify or close. Closing the');
|
|
253
|
+
lines.push('loop means: every anchored injection is terminal, residual UDEs');
|
|
254
|
+
lines.push('have been classified (resolved / drift / escalated), and the');
|
|
255
|
+
lines.push('focus statement is the only thing the tree is judged against.');
|
|
256
|
+
lines.push('');
|
|
257
|
+
return lines;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Build the incremental delta message sent when a lineage's session is RESUMED
|
|
261
|
+
* (INJ-D). A resumed Claude session already holds its role framework, tools,
|
|
262
|
+
* status rules, and accumulated context -- re-sending the full prompt wastes
|
|
263
|
+
* tokens and re-anchors. The delta carries only what changed since the last
|
|
264
|
+
* cycle (the diff) plus the prior findings, deliberately omitting the
|
|
265
|
+
* role-framework sections.
|
|
266
|
+
*
|
|
267
|
+
* Anti-anchoring: for the review lineage the prior findings are framed as "to
|
|
268
|
+
* VERIFY, not trust" -- the diff and acceptance criteria remain ground truth
|
|
269
|
+
* each cycle, so a resumed reviewer re-examines rather than rubber-stamping.
|
|
270
|
+
*/
|
|
271
|
+
export function buildResumeDeltaMessage(ctx) {
|
|
272
|
+
const isReview = ctx.lineage === 'review';
|
|
273
|
+
const lines = [];
|
|
274
|
+
lines.push(`## Resuming Your ${isReview ? 'Review' : 'Work'} Session (Incremental Update)`);
|
|
275
|
+
lines.push('');
|
|
276
|
+
lines.push(`You are resuming your prior \`${ctx.lineage}\` session on focus "${ctx.focusName}".`);
|
|
277
|
+
lines.push('Your role, tools, status-update rules, and the context you accumulated in');
|
|
278
|
+
lines.push('earlier cycles are intact -- this message is ONLY what changed since your last');
|
|
279
|
+
lines.push('cycle. Do not restart from scratch and do not re-read the full role framework.');
|
|
280
|
+
lines.push('The diff below and the acceptance criteria (re-read via MCP if needed) are the');
|
|
281
|
+
lines.push('ground truth for this cycle.');
|
|
282
|
+
lines.push('');
|
|
283
|
+
if (ctx.priorFindings.length > 0) {
|
|
284
|
+
if (isReview) {
|
|
285
|
+
lines.push('### Prior findings to VERIFY (do not trust)');
|
|
286
|
+
lines.push('');
|
|
287
|
+
lines.push('Last cycle you filed the issues below. Do NOT assume they were fixed.');
|
|
288
|
+
lines.push('For each, check the diff and the current code to confirm it was actually');
|
|
289
|
+
lines.push('addressed. If it was genuinely resolved, leave it; if not, keep or refile');
|
|
290
|
+
lines.push('the issue with the specific remaining gap. Your memory is not evidence --');
|
|
291
|
+
lines.push('the diff is.');
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
lines.push('### Open items from review to address');
|
|
295
|
+
lines.push('');
|
|
296
|
+
lines.push('Review filed the issues below against your prior work. Address each as a');
|
|
297
|
+
lines.push('defect to fix and confirm the fix in the diff. Do not widen scope.');
|
|
298
|
+
}
|
|
299
|
+
lines.push('');
|
|
300
|
+
for (const f of ctx.priorFindings) {
|
|
301
|
+
lines.push(`- ${f.key}: ${f.title} (${f.status})`);
|
|
302
|
+
}
|
|
303
|
+
lines.push('');
|
|
304
|
+
}
|
|
305
|
+
lines.push('### What changed since your last cycle (diff against base)');
|
|
306
|
+
lines.push('');
|
|
307
|
+
if (ctx.gitDiff.trim()) {
|
|
308
|
+
lines.push(ctx.gitDiff.trim());
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
lines.push('_The diff resolver returned no content. Run `git diff` against the');
|
|
312
|
+
lines.push('integration base yourself to see the current state of the worktree._');
|
|
313
|
+
}
|
|
314
|
+
lines.push('');
|
|
315
|
+
return lines.join('\n');
|
|
316
|
+
}
|
|
317
|
+
//# sourceMappingURL=persona-sections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persona-sections.js","sourceRoot":"","sources":["../../src/prompt-sections/persona-sections.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gCAAgC,CAC9C,oBAA4B;IAE5B,IAAI,oBAAoB,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACzC,OAAO;QACL,+BAA+B;QAC/B,EAAE;QACF,4BAA4B,oBAAoB,6BAA6B;QAC7E,wEAAwE;QACxE,6CAA6C;QAC7C,EAAE;QACF,yEAAyE;QACzE,mBAAmB;QACnB,0EAA0E;QAC1E,8EAA8E;QAC9E,2DAA2D;QAC3D,wEAAwE;QACxE,+DAA+D;QAC/D,EAAE;QACF,uEAAuE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ACvF,KAAK,CAAC,IAAI,CAAC,oEAAoE,CAAC,CAAC;QACnF,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,aAAa,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QACrD,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;IACzE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACjC,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,oEAAoE,CAAC,CAAC;QACjF,KAAK,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;IACrF,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role-framework section builders: role context, domain boundaries, team-lead
|
|
3
|
+
* role description, and the read-only audit notice. Extracted from
|
|
4
|
+
* team-prompt-base.ts.
|
|
5
|
+
*/
|
|
6
|
+
import type { AgentRole } from '../types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Build the role context section from the agent role's system prompt template.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildRoleSection(role: AgentRole): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Build the domain boundaries section from allowed file patterns.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildDomainBoundariesSection(role: AgentRole): string[];
|
|
15
|
+
/**
|
|
16
|
+
* Build the team lead role description section.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildTeamLeadRoleSection(engineId?: string): string[];
|
|
19
|
+
/**
|
|
20
|
+
* Build the read-only audit mode notice section.
|
|
21
|
+
* Returns empty array if not in read-only mode.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildReadOnlyAuditSection(readOnly?: boolean): string[];
|
|
24
|
+
//# sourceMappingURL=role-sections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-sections.d.ts","sourceRoot":"","sources":["../../src/prompt-sections/role-sections.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,CAO1D;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,CAWtE;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBpE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAkBtE"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role-framework section builders: role context, domain boundaries, team-lead
|
|
3
|
+
* role description, and the read-only audit notice. Extracted from
|
|
4
|
+
* team-prompt-base.ts.
|
|
5
|
+
*/
|
|
6
|
+
import { orchestrationVocabulary } from './shared.js';
|
|
7
|
+
/**
|
|
8
|
+
* Build the role context section from the agent role's system prompt template.
|
|
9
|
+
*/
|
|
10
|
+
export function buildRoleSection(role) {
|
|
11
|
+
const lines = [];
|
|
12
|
+
if (role.system_prompt_template) {
|
|
13
|
+
lines.push(role.system_prompt_template);
|
|
14
|
+
lines.push('');
|
|
15
|
+
}
|
|
16
|
+
return lines;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Build the domain boundaries section from allowed file patterns.
|
|
20
|
+
*/
|
|
21
|
+
export function buildDomainBoundariesSection(role) {
|
|
22
|
+
const lines = [];
|
|
23
|
+
if (role.allowed_file_patterns.length > 0) {
|
|
24
|
+
lines.push('## Domain Boundaries');
|
|
25
|
+
lines.push('You are authorized to work on files matching these patterns:');
|
|
26
|
+
for (const pattern of role.allowed_file_patterns) {
|
|
27
|
+
lines.push(`- ${pattern}`);
|
|
28
|
+
}
|
|
29
|
+
lines.push('');
|
|
30
|
+
}
|
|
31
|
+
return lines;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Build the team lead role description section.
|
|
35
|
+
*/
|
|
36
|
+
export function buildTeamLeadRoleSection(engineId) {
|
|
37
|
+
const vocab = orchestrationVocabulary(engineId);
|
|
38
|
+
return [
|
|
39
|
+
'## Your Role: Focus Team Lead',
|
|
40
|
+
'',
|
|
41
|
+
'You are the team lead for this focus. You coordinate all deliveries',
|
|
42
|
+
'and their issues, spawning workers for parallel execution where possible.',
|
|
43
|
+
'',
|
|
44
|
+
'**Core responsibilities:**',
|
|
45
|
+
'1. Read all deliveries and issues for the focus',
|
|
46
|
+
'2. Build a task execution plan respecting delivery priority and file overlap',
|
|
47
|
+
vocab.spawnStep,
|
|
48
|
+
'4. Track issue completion and advance delivery stages',
|
|
49
|
+
'5. Poll for new deliveries added during execution',
|
|
50
|
+
'6. Handle errors, escalate blockers, and report progress',
|
|
51
|
+
'',
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Build the read-only audit mode notice section.
|
|
56
|
+
* Returns empty array if not in read-only mode.
|
|
57
|
+
*/
|
|
58
|
+
export function buildReadOnlyAuditSection(readOnly) {
|
|
59
|
+
if (!readOnly)
|
|
60
|
+
return [];
|
|
61
|
+
return [
|
|
62
|
+
'## READ-ONLY AUDIT MODE',
|
|
63
|
+
'',
|
|
64
|
+
'This is a read-only audit session. The filesystem allows reading but commits',
|
|
65
|
+
'are blocked by a pre-commit hook. Your job is DISCOVERY ONLY:',
|
|
66
|
+
'',
|
|
67
|
+
'- Identify and document problems by creating issues via MCP tools',
|
|
68
|
+
'- Create exactly ONE remediation delivery per audit delivery via',
|
|
69
|
+
' telora_product_delivery_create (execution_status: "planning")',
|
|
70
|
+
'- Use Context Groups to organize findings within remediation deliveries',
|
|
71
|
+
'- Do NOT modify, fix, or commit any code changes',
|
|
72
|
+
'- Do NOT attempt to bypass the pre-commit hook',
|
|
73
|
+
'',
|
|
74
|
+
'If you try to commit, the hook will reject it with a reminder of these rules.',
|
|
75
|
+
'',
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=role-sections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-sections.js","sourceRoot":"","sources":["../../src/prompt-sections/role-sections.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAe;IAC9C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACxC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAAC,IAAe;IAC1D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,IAAI,CAAC,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;QAC3E,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;YACjD,KAAK,CAAC,IAAI,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;QAC7B,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,QAAiB;IACxD,MAAM,KAAK,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAChD,OAAO;QACL,+BAA+B;QAC/B,EAAE;QACF,qEAAqE;QACrE,2EAA2E;QAC3E,EAAE;QACF,4BAA4B;QAC5B,iDAAiD;QACjD,8EAA8E;QAC9E,KAAK,CAAC,SAAS;QACf,uDAAuD;QACvD,mDAAmD;QACnD,0DAA0D;QAC1D,EAAE;KACH,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,QAAkB;IAC1D,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IACzB,OAAO;QACL,yBAAyB;QACzB,EAAE;QACF,8EAA8E;QAC9E,+DAA+D;QAC/D,EAAE;QACF,mEAAmE;QACnE,kEAAkE;QAClE,iEAAiE;QACjE,yEAAyE;QACzE,kDAAkD;QAClD,gDAAgD;QAChD,EAAE;QACF,+EAA+E;QAC/E,EAAE;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types and private helpers for the focus team prompt section builders.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from team-prompt-base.ts. Holds the prompt-context interfaces and
|
|
5
|
+
* the engine-specific orchestration vocabulary helper used by 2+ section
|
|
6
|
+
* modules, so the section modules and the team-prompt-base aggregator import
|
|
7
|
+
* from one place (avoids circular imports).
|
|
8
|
+
*/
|
|
9
|
+
import type { FocusDeliveryInfo, FocusIssueInfo, FocusExecutionConfig, PipelineConfig } from '../types.js';
|
|
10
|
+
import type { ProductContextDoc } from '../queries/focuses.js';
|
|
11
|
+
export interface DeploymentProfileSnapshotContext {
|
|
12
|
+
name: string;
|
|
13
|
+
inceptionPrompt: string | null;
|
|
14
|
+
guidelines: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface FocusTeamPromptContext {
|
|
17
|
+
focusId: string;
|
|
18
|
+
focusName: string;
|
|
19
|
+
organizationId: string;
|
|
20
|
+
productId: string;
|
|
21
|
+
deliveries: FocusDeliveryInfo[];
|
|
22
|
+
issues: FocusIssueInfo[];
|
|
23
|
+
executionConfig: FocusExecutionConfig;
|
|
24
|
+
pipelineConfig: PipelineConfig | null;
|
|
25
|
+
productContextDocs?: ProductContextDoc[];
|
|
26
|
+
deploymentProfileSnapshot?: DeploymentProfileSnapshotContext | null;
|
|
27
|
+
readOnly?: boolean;
|
|
28
|
+
loopContext?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Number of open review-filed issues across all deliveries on this
|
|
31
|
+
* focus. When > 0, the team prompt includes a remediation directive
|
|
32
|
+
* orienting the team to "fix flagged defects, do not expand scope".
|
|
33
|
+
*/
|
|
34
|
+
reviewFiledOpenCount?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Focus.description -- the focus statement that serves as the implicit
|
|
37
|
+
* apex of the reality tree. Surfaced to the close_loop stage agent as
|
|
38
|
+
* the alignment target for the tree-drift check. See the design
|
|
39
|
+
* principle "Tree-Focus Apex" and the wiki page
|
|
40
|
+
* "reality-trees-crt-frt-planning-layer".
|
|
41
|
+
*/
|
|
42
|
+
focusDescription?: string | null;
|
|
43
|
+
/**
|
|
44
|
+
* Resolved engine backend id ('claude' | 'codex' | ...). Selects the
|
|
45
|
+
* engine-specific orchestration vocabulary in the lead prompt (how the lead
|
|
46
|
+
* spawns workers). Defaults to 'claude' when absent.
|
|
47
|
+
*/
|
|
48
|
+
engineId?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The lead spawns workers differently per engine. Portable task content (what
|
|
52
|
+
* to build, status protocol, MCP rules) is identical; only the orchestration
|
|
53
|
+
* verbs differ. Codex also needs an explicit caveat about clean subagent
|
|
54
|
+
* spawns (the spike hit a router error when a full-history fork carried
|
|
55
|
+
* agent_type/model/reasoning_effort).
|
|
56
|
+
*/
|
|
57
|
+
export interface OrchestrationVocabulary {
|
|
58
|
+
/** One-line description of how to spawn parallel work (role section step 3). */
|
|
59
|
+
spawnStep: string;
|
|
60
|
+
/** Opening of the Phase 2 worker-management section. */
|
|
61
|
+
workerMechanism: string;
|
|
62
|
+
/** Optional extra caveat lines appended to worker-management (Codex). */
|
|
63
|
+
caveat: string[];
|
|
64
|
+
}
|
|
65
|
+
export declare function orchestrationVocabulary(engineId: string | undefined): OrchestrationVocabulary;
|
|
66
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/prompt-sections/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,cAAc,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,WAAW,gCAAgC;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,eAAe,EAAE,oBAAoB,CAAC;IACtC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