moflo 4.13.0 → 4.13.2

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.
@@ -70,10 +70,18 @@ const DIRECTIVE_PATTERNS = [
70
70
  /^(also|too|and also)\s+(for|with|on)\b/i,
71
71
  /^(what about|how about)\s+(the\s+)?(other|rest|same)\b/i,
72
72
  ];
73
+ /**
74
+ * Phrased as observations, and each says out loud that the bracket comes from a
75
+ * turn count rather than measured tokens (#1487). This code path has no
76
+ * transcript to read — it is the legacy `npx flo gate prompt-reminder` CLI, not
77
+ * the hook — so the honest thing it can do is not sound like a measurement.
78
+ * Instruction-shaped text the model cannot verify gets obeyed: the old CRITICAL
79
+ * line had agents abandoning work over a nearly empty window.
80
+ */
73
81
  const BRACKET_MESSAGES = {
74
- MODERATE: 'Context: MODERATE. Re-state goal before architectural decisions. Use agents for >300 LOC.',
75
- DEPLETED: 'Context: DEPLETED. Checkpoint progress. Recommend /compact or fresh session.',
76
- CRITICAL: 'Context: CRITICAL. Stop accepting complex tasks. Commit, store learnings, suggest new session.',
82
+ MODERATE: 'Context: 11-20 turns since session start (turn count, not measured token usage).',
83
+ DEPLETED: 'Context: 21-30 turns since session start (turn count, not measured token usage). Checkpointing progress is worth considering.',
84
+ CRITICAL: 'Context: 30+ turns since session start (turn count, not measured token usage). /compact or a fresh session is worth considering.',
77
85
  };
78
86
  /** Paths exempt from memory-first gate (they ARE the memory system) */
79
87
  const EXEMPT_PATTERNS = [
@@ -329,8 +337,20 @@ export class GateService {
329
337
  result.reminder = 'REMINDER: Use TaskCreate before spawning agents.';
330
338
  }
331
339
  if (this.config.context_tracking) {
340
+ // Edge-triggered (#1487): the old level-triggered form re-emitted the same
341
+ // line every turn once past the threshold, with no reset anywhere, so it
342
+ // read as a standing instruction long after it stopped being true.
343
+ //
344
+ // Derived from the counter rather than remembered in a field, deliberately.
345
+ // This file and bin/gate.cjs write the SAME .claude/workflow-state.json,
346
+ // and gate.cjs owns `contextBand` with a richer vocabulary (`tokens:400000`
347
+ // as well as the brackets). A second writer with an incompatible vocabulary
348
+ // would silently invalidate gate.cjs's edge-trigger on any project wired to
349
+ // both. Comparing this turn's bracket with the previous turn's is exactly
350
+ // the same edge, needs no state, and cannot collide.
332
351
  const bracket = this.getContextBracket(state.interactionCount);
333
- if (bracket !== 'FRESH') {
352
+ const previous = this.getContextBracket(state.interactionCount - 1);
353
+ if (bracket !== 'FRESH' && bracket !== previous) {
334
354
  result.bracket = BRACKET_MESSAGES[bracket];
335
355
  }
336
356
  }
@@ -2,5 +2,5 @@
2
2
  * Auto-generated by build. Do not edit manually.
3
3
  * Source of truth: root package.json → scripts/sync-version.mjs
4
4
  */
5
- export const VERSION = '4.13.0';
5
+ export const VERSION = '4.13.2';
6
6
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moflo",
3
- "version": "4.13.0",
3
+ "version": "4.13.2",
4
4
  "description": "MoFlo — AI agent orchestration for Claude Code. A standalone, opinionated toolkit with semantic memory, learned routing, gates, spells, and the /flo issue-execution skill.",
5
5
  "main": "dist/src/cli/index.js",
6
6
  "type": "module",
@@ -99,7 +99,7 @@
99
99
  "@typescript-eslint/parser": "^8.65.0",
100
100
  "eslint": "^10.8.0",
101
101
  "glob": "^11.1.0",
102
- "moflo": "^4.12.12",
102
+ "moflo": "^4.13.1",
103
103
  "tsx": "^4.21.0",
104
104
  "typescript": "^5.9.3",
105
105
  "vitest": "^4.0.0"