@zcy2nn/agent-forge 1.0.5 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,5 +9,6 @@ export { processImageAttachments } from './image-hook';
9
9
  export { createJsonErrorRecoveryHook } from './json-error-recovery';
10
10
  export { createPhaseReminderHook } from './phase-reminder';
11
11
  export { createPostFileToolNudgeHook } from './post-file-tool-nudge';
12
+ export { createSessionBootstrapHook } from './session-bootstrap';
12
13
  export { createTaskSessionManagerHook } from './task-session-manager';
13
14
  export { createTodoContinuationHook } from './todo-continuation';
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Session bootstrap hook — injects lightweight assessment framework
3
+ * into the first user message of each session.
4
+ *
5
+ * This gives the orchestrator a "work manual front page" so it assesses
6
+ * task complexity before jumping into implementation.
7
+ * Only injected for the orchestrator agent, only once per session.
8
+ */
9
+ interface MessageInfo {
10
+ role: string;
11
+ agent?: string;
12
+ sessionID?: string;
13
+ }
14
+ interface MessagePart {
15
+ type: string;
16
+ text?: string;
17
+ [key: string]: unknown;
18
+ }
19
+ interface MessageWithParts {
20
+ info: MessageInfo;
21
+ parts: MessagePart[];
22
+ }
23
+ /**
24
+ * Creates the experimental.chat.messages.transform hook for session bootstrap.
25
+ * Injects the assessment framework into the first user message, orchestrator only.
26
+ */
27
+ export declare function createSessionBootstrapHook(): {
28
+ 'experimental.chat.messages.transform': (_input: Record<string, never>, output: {
29
+ messages: MessageWithParts[];
30
+ }) => Promise<void>;
31
+ };
32
+ export {};
package/dist/index.js CHANGED
@@ -23425,6 +23425,80 @@ function createPostFileToolNudgeHook(options = {}) {
23425
23425
  }
23426
23426
  };
23427
23427
  }
23428
+ // src/hooks/session-bootstrap/index.ts
23429
+ var BOOTSTRAP_MARKER = "<session_bootstrap>";
23430
+ var BOOTSTRAP_CONTENT = `${BOOTSTRAP_MARKER}
23431
+ ## Instruction Priority
23432
+ 1. User's explicit instructions (CLAUDE.md, AGENTS.md, direct requests) — highest
23433
+ 2. Superpowers skills — override default system behavior where they conflict
23434
+ 3. Default system prompt — lowest
23435
+
23436
+ ## Subagents
23437
+ Subagents dispatched to execute a specific task skip this flow.
23438
+
23439
+ ## Task Complexity Assessment
23440
+ Assess task complexity before responding:
23441
+ **Simple (direct answer):** Single step, knowledge question, small edit, config change, debug single error
23442
+ **Medium or Complex (proposal flow):** Multi-file changes, design decisions, new features, cross-module, architecture changes
23443
+
23444
+ ## Proposal Flow
23445
+ Present three tiers:
23446
+ Suggested approach:
23447
+ ── Lightweight ── [Phase]
23448
+ ── Recommended ── [Phase] → [Phase] → [Phase] → [Phase]
23449
+ ── Full ── [Phase (strategy)] → [Phase] → [Phase (strategy)] → [Phase + Review]
23450
+ Pick one, or tell me custom steps.
23451
+
23452
+ ## Phase & Skill Mapping
23453
+ [Design] = brainstorming
23454
+ [Plan] = writing-plans
23455
+ [Implement] = test-driven-development / subagent-driven-development / dispatching-parallel-agents
23456
+ [Verify] = verification-before-completion
23457
+ [Review] = requesting-code-review
23458
+ Encounter bug → systematic-debugging (available at any phase)
23459
+
23460
+ ## Proposal Guidance
23461
+ - Don't over-simplify: if the task involves multi-file changes or design decisions, don't suggest "implement directly"
23462
+ - Don't over-complicate: simple questions don't need the proposal flow
23463
+ - Lightweight must include [Verify]: even a single-phase approach must run verification commands. Lightweight means fewer phases, not skipping discipline.
23464
+ - Be specific: describe what will be done clearly, avoid vague terms
23465
+
23466
+ ## Skill Types
23467
+ **Rigid** (TDD, debugging): Follow the spirit at all tiers. Simple tasks may use abbreviated forms (test-after, quick fix with verification), but the discipline of verify-before-claim always applies.
23468
+ **Flexible** (brainstorming, writing-plans): Adapt principles to context. Simple tasks may skip these entirely.
23469
+
23470
+ ## Skill Access
23471
+ Use the skill tool to list and load skills on demand.
23472
+ ${BOOTSTRAP_MARKER}`;
23473
+ function createSessionBootstrapHook() {
23474
+ return {
23475
+ "experimental.chat.messages.transform": async (_input, output) => {
23476
+ const { messages } = output;
23477
+ if (messages.length === 0) {
23478
+ return;
23479
+ }
23480
+ const firstUserMessage = messages.find((m) => m.info.role === "user");
23481
+ if (!firstUserMessage) {
23482
+ return;
23483
+ }
23484
+ const agent = firstUserMessage.info.agent;
23485
+ if (agent && agent !== "orchestrator") {
23486
+ return;
23487
+ }
23488
+ const textPartIndex = firstUserMessage.parts.findIndex((p) => p.type === "text" && typeof p.text === "string");
23489
+ if (textPartIndex === -1) {
23490
+ return;
23491
+ }
23492
+ const originalText = firstUserMessage.parts[textPartIndex].text ?? "";
23493
+ if (originalText.includes(BOOTSTRAP_MARKER)) {
23494
+ return;
23495
+ }
23496
+ firstUserMessage.parts[textPartIndex].text = `${BOOTSTRAP_CONTENT}
23497
+
23498
+ ${originalText}`;
23499
+ }
23500
+ };
23501
+ }
23428
23502
  // src/hooks/task-session-manager/index.ts
23429
23503
  import path9 from "node:path";
23430
23504
  var AGENT_NAME_SET = new Set([
@@ -32455,6 +32529,7 @@ var OhMyOpenCodeLite = async (ctx) => {
32455
32529
  let multiplexerSessionManager;
32456
32530
  let autoUpdateChecker;
32457
32531
  let phaseReminderHook;
32532
+ let sessionBootstrapHook;
32458
32533
  let filterAvailableSkillsHook;
32459
32534
  let sessionAgentMap;
32460
32535
  let postFileToolNudgeHook;
@@ -32540,6 +32615,7 @@ var OhMyOpenCodeLite = async (ctx) => {
32540
32615
  autoUpdate: config.autoUpdate ?? true
32541
32616
  });
32542
32617
  phaseReminderHook = createPhaseReminderHook();
32618
+ sessionBootstrapHook = createSessionBootstrapHook();
32543
32619
  filterAvailableSkillsHook = createFilterAvailableSkillsHook(ctx, config);
32544
32620
  sessionAgentMap = new Map;
32545
32621
  postFileToolNudgeHook = createPostFileToolNudgeHook({
@@ -32922,6 +32998,7 @@ ${output.system[0]}` : "");
32922
32998
  },
32923
32999
  "experimental.chat.messages.transform": async (input, output) => {
32924
33000
  const typedOutput = output;
33001
+ await sessionBootstrapHook["experimental.chat.messages.transform"](input, typedOutput);
32925
33002
  for (const message of typedOutput.messages) {
32926
33003
  if (message.info.role !== "user") {
32927
33004
  continue;
package/dist/tui.js CHANGED
@@ -236,6 +236,20 @@ var plugin = {
236
236
  api.slots.register({
237
237
  order: 900,
238
238
  slots: {
239
+ home_prompt_right(_ctx, _props) {
240
+ return box({
241
+ flexDirection: "row",
242
+ alignItems: "center",
243
+ gap: 1
244
+ }, [
245
+ box({
246
+ paddingLeft: 1,
247
+ paddingRight: 1,
248
+ backgroundColor: api.theme.current.accent
249
+ }, [text({ fg: api.theme.current.background }, ["AGF"])]),
250
+ text({ fg: api.theme.current.textMuted }, [`v${version}`])
251
+ ]);
252
+ },
239
253
  sidebar_content(_ctx, _props) {
240
254
  return renderSidebar(snapshot, version, api.theme.current);
241
255
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zcy2nn/agent-forge",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "description": "Lightweight agent orchestration plugin for OpenCode - a slimmed-down fork of oh-my-opencode",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,12 +10,20 @@ Help turn ideas into fully formed designs and specs through natural collaborativ
10
10
  Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design and get user approval.
11
11
 
12
12
  <HARD-GATE>
13
- Do NOT invoke any implementation skill, write any code, scaffold any project, or take any implementation action until you have presented a design and the user has approved it. This applies to EVERY project regardless of perceived simplicity.
13
+ For Medium/Complex tasks: Do NOT invoke any implementation skill, write any code, scaffold any project, or take any implementation action until you have presented a design and the user has approved it.
14
+
15
+ For Simple tasks: You may proceed directly if the task is a knowledge question, small config change, or single-file edit with no design decisions. If uncertain whether a design is needed, err on the side of presenting a Lightweight design (2-3 sentences) and getting oral confirmation.
14
16
  </HARD-GATE>
15
17
 
16
- ## Anti-Pattern: "This Is Too Simple To Need A Design"
18
+ ## Complexity Adaptation
19
+
20
+ This skill adapts to the complexity tier determined by session-bootstrap:
21
+
22
+ - **Simple tasks** (direct answer tier): Skip this skill entirely unless the task involves design decisions. If a Simple task does need design, use Lightweight mode.
23
+ - **Medium tasks**: Use Lightweight or Standard mode.
24
+ - **Complex tasks**: Use Standard or Deep mode. The HARD-GATE above applies in full.
17
25
 
18
- Every project goes through this process. A todo list, a single-function utility, a config change all of them. "Simple" projects are where unexamined assumptions cause the most wasted work. The design can be short (a few sentences for truly simple projects), but you MUST present it and get approval.
26
+ Don't skip design when it matters — "simple" tasks with unexamined assumptions cause the most wasted work. But don't force ceremony when it genuinely doesn't add value.
19
27
 
20
28
  ## Checklist
21
29
 
@@ -150,6 +158,7 @@ Wait for the user's response. If they request changes, make them and re-run the
150
158
  - Skip context exploration, skip one-by-one questions
151
159
  - Give 2-3 options directly for user to pick
152
160
  - No spec document — oral confirmation is enough
161
+ - Applies when session-bootstrap classifies the task as Simple and design is still warranted
153
162
 
154
163
  **Standard usage:**
155
164
  - Full flow: explore context → one-by-one questions → compare approaches → present design → write spec
@@ -16,10 +16,13 @@ Random fixes waste time and create new bugs. Quick patches mask underlying issue
16
16
  ## The Iron Law
17
17
 
18
18
  ```
19
- NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
19
+ For Medium/Complex bugs: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
20
+ For Simple bugs: Quick fix is acceptable if the cause is obvious, but verify the fix works
20
21
  ```
21
22
 
22
- If you haven't completed Phase 1, you cannot propose fixes.
23
+ If you haven't completed Phase 1 for a Medium/Complex bug, you cannot propose fixes.
24
+
25
+ For Simple bugs (single error, obvious symptom, config typo, known pattern): you may fix directly, but must verify the fix resolves the issue. If the quick fix doesn't work, escalate to full investigation immediately.
23
26
 
24
27
  ## When to Use
25
28
 
@@ -39,9 +42,14 @@ Use for ANY technical issue:
39
42
  - You don't fully understand the issue
40
43
 
41
44
  **Don't skip when:**
42
- - Issue seems simple (simple bugs have root causes too)
43
45
  - You're in a hurry (rushing guarantees rework)
44
46
  - Manager wants it fixed NOW (systematic is faster than thrashing)
47
+ - Previous fix didn't work (symptom fixing masks root cause)
48
+
49
+ **When abbreviated investigation is acceptable:**
50
+ - session-bootstrap classifies the task as Simple
51
+ - The cause is obvious from the error message (e.g., config typo, missing import)
52
+ - If the quick fix doesn't work, immediately escalate to full investigation
45
53
 
46
54
  ## The Four Phases
47
55
 
@@ -290,8 +298,10 @@ These techniques are part of systematic debugging and available in this director
290
298
  ## Complexity Assessment
291
299
 
292
300
  **Lightweight usage:**
293
- - Reproduce → read error → fix directly
301
+ - Reproduce → read error → fix directly (only when cause is obvious)
294
302
  - Skip hypothesis verification and root cause analysis
303
+ - Applies when session-bootstrap classifies the task as Simple
304
+ - If quick fix doesn't work, escalate to Standard immediately
295
305
 
296
306
  **Standard usage:**
297
307
  - Full flow: reproduce → gather evidence → hypothesize → verify → fix → regression test
@@ -15,34 +15,43 @@ Write the test first. Watch it fail. Write minimal code to pass.
15
15
 
16
16
  ## When to Use
17
17
 
18
- **Always:**
18
+ **Always (for Medium/Complex tasks):**
19
19
  - New features
20
20
  - Bug fixes
21
21
  - Refactoring
22
22
  - Behavior changes
23
23
 
24
+ **Simple tasks (test-after acceptable):**
25
+ - Config changes
26
+ - Typo fixes
27
+ - Single-line corrections
28
+ - Obvious corrections with no logic change
29
+
24
30
  **Exceptions (ask your human partner):**
25
31
  - Throwaway prototypes
26
32
  - Generated code
27
33
  - Configuration files
34
+ - Simple edits classified by session-bootstrap (config changes, typos, single-line fixes)
28
35
 
29
36
  Thinking "skip TDD just this once"? Stop. That's rationalization.
30
37
 
31
38
  ## The Iron Law
32
39
 
33
40
  ```
34
- NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
41
+ For Medium/Complex tasks: NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
42
+ For Simple tasks: Test-after is acceptable, but verification is still required
35
43
  ```
36
44
 
37
- Write code before the test? Delete it. Start over.
45
+ **Medium/Complex tasks:** Write code before the test? Delete it. Start over.
38
46
 
39
- **No exceptions:**
40
47
  - Don't keep it as "reference"
41
48
  - Don't "adapt" it while writing tests
42
49
  - Don't look at it
43
50
  - Delete means delete
44
51
 
45
- Implement fresh from tests. Period.
52
+ **Simple tasks** (as classified by session-bootstrap): If the change is a config change, typo fix, single-line correction, or similar trivial edit — implement first, then write a test or run verification. If the change affects behavior or logic, TDD still applies.
53
+
54
+ Implement fresh from tests. Period (for Medium/Complex).
46
55
 
47
56
  ## Red-Green-Refactor
48
57
 
@@ -21,6 +21,10 @@ NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
21
21
 
22
22
  If you haven't run the verification command in this message, you cannot claim it passes.
23
23
 
24
+ **This applies at ALL complexity tiers.** What varies is the depth of verification:
25
+ - **Simple tasks:** Run the relevant verification command (tests, linter, build) and confirm it passes
26
+ - **Medium/Complex tasks:** Run full verification suite, check coverage, verify edge cases, review against requirements
27
+
24
28
  ## The Gate Function
25
29
 
26
30
  ```
@@ -134,14 +138,16 @@ From 24 failure memories:
134
138
 
135
139
  **Lightweight usage:**
136
140
  - Run core tests, confirm pass
141
+ - Applies when session-bootstrap classifies the task as Simple
137
142
 
138
143
  **Standard usage:**
139
144
  - Run all tests + check coverage + verify edge cases
140
145
 
141
- ## The Bottom Line
146
+ **Deep usage:**
147
+ - Standard + requirements checklist + line-by-line verification + cross-reference with design spec
142
148
 
143
- **No shortcuts for verification.**
149
+ ## The Bottom Line
144
150
 
145
- Run the command. Read the output. THEN claim the result.
151
+ **No shortcuts for verification.** The principle is non-negotiable; the depth adapts to complexity.
146
152
 
147
- This is non-negotiable.
153
+ Run the command. Read the output. THEN claim the result. Whether you run one test or the full suite depends on the task's complexity tier, but you must ALWAYS run something before claiming completion.
@@ -1,46 +0,0 @@
1
- /** Result of a migration attempt. */
2
- export interface MigrationResult {
3
- /** Whether a legacy config was detected. */
4
- detected: boolean;
5
- /** Whether the migration was performed. */
6
- migrated: boolean;
7
- /** Path to the new config file, if migrated. */
8
- newPath?: string;
9
- /** Path to the legacy config file that was found. */
10
- legacyPath?: string;
11
- /** Error message if migration failed. */
12
- error?: string;
13
- }
14
- /**
15
- * Get all possible legacy config file paths (json and jsonc).
16
- */
17
- export declare function getLegacyConfigPaths(): string[];
18
- /**
19
- * Detect whether a legacy `oh-my-opencode-slim.json` config exists.
20
- * Returns the path if found, or undefined.
21
- */
22
- export declare function detectLegacyConfig(): string | undefined;
23
- /**
24
- * Check if a config object contains any legacy agent names
25
- * in its presets or agents sections.
26
- */
27
- export declare function hasLegacyAgentNames(config: Record<string, unknown>): boolean;
28
- /**
29
- * Migrate agent names in a config object.
30
- *
31
- * - Renames primary mapping keys (explorer→researcher, oracle→reviewer,
32
- * designer→implementer).
33
- * - For secondary mappings (librarian→researcher, fixer→implementer),
34
- * only applies if the primary mapping target doesn't already exist.
35
- * - Removes observer entries entirely.
36
- * - Preserves all non-agent config keys unchanged.
37
- */
38
- export declare function migrateAgentNames(config: Record<string, unknown>): Record<string, unknown>;
39
- /**
40
- * Perform the full migration:
41
- * 1. Read legacy config
42
- * 2. Migrate agent names
43
- * 3. Write to `agent-forge.json`
44
- * 4. Rename legacy file to `.bak`
45
- */
46
- export declare function performMigration(legacyPath: string): MigrationResult;