peaks-loop 4.0.49 → 4.0.50
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/CHANGELOG.md +24 -0
- package/README-en.md +1 -1
- package/README.md +1 -1
- package/dist/cli/commands/audit-commands.js +1 -0
- package/dist/cli/commands/baseline-commands.js +163 -25
- package/dist/cli/commands/core/skill-command.js +53 -4
- package/dist/cli/commands/core/standards-command.d.ts +24 -0
- package/dist/cli/commands/core/standards-command.js +74 -0
- package/dist/cli/commands/hooks-commands.js +55 -38
- package/dist/cli/commands/share-commands.js +37 -11
- package/dist/cli/commands/web-commands.js +8 -1
- package/dist/cli/commands/workflow-lifecycle-commands.d.ts +6 -0
- package/dist/cli/commands/workflow-lifecycle-commands.js +64 -3
- package/dist/services/adapter/adapter.d.ts +30 -0
- package/dist/services/adapter/auto-adapter.d.ts +13 -0
- package/dist/services/adapter/claude-adapter.js +12 -0
- package/dist/services/adapter/codex-adapter.d.ts +12 -0
- package/dist/services/adapter/codex-adapter.js +12 -0
- package/dist/services/adapter/copilot-adapter.d.ts +12 -0
- package/dist/services/adapter/copilot-adapter.js +12 -0
- package/dist/services/audit/backing-detector.d.ts +25 -7
- package/dist/services/audit/backing-detector.js +33 -17
- package/dist/services/audit/enforcer-liveness.d.ts +12 -0
- package/dist/services/audit/enforcer-liveness.js +100 -0
- package/dist/services/audit/enforcers/lint-catalog-governance.d.ts +23 -11
- package/dist/services/audit/enforcers/lint-catalog-governance.js +10 -14
- package/dist/services/audit/enforcers/lint-rd-handoff-coverage.d.ts +5 -15
- package/dist/services/audit/enforcers/lint-rd-handoff-coverage.js +94 -25
- package/dist/services/audit/enforcers/lint-style.d.ts +9 -1
- package/dist/services/audit/enforcers/lint-style.js +38 -2
- package/dist/services/audit/prose-ratio-calculator.d.ts +28 -17
- package/dist/services/audit/prose-ratio-calculator.js +25 -18
- package/dist/services/audit/red-line-catalog-p2-a.js +1 -1
- package/dist/services/audit/red-lines-service.js +51 -7
- package/dist/services/capability-audit-service/independent-checker.d.ts +15 -0
- package/dist/services/capability-audit-service/independent-checker.js +140 -0
- package/dist/services/capability-audit-service/index.d.ts +3 -1
- package/dist/services/capability-audit-service/index.js +1 -0
- package/dist/services/capability-audit-service/runner.d.ts +17 -13
- package/dist/services/capability-audit-service/runner.js +76 -15
- package/dist/services/capability-audit-service/types.d.ts +48 -0
- package/dist/services/capability-guard-runner/contracts/J01.js +21 -22
- package/dist/services/capability-guard-runner/contracts/J02.d.ts +1 -1
- package/dist/services/capability-guard-runner/contracts/J02.js +114 -28
- package/dist/services/capability-guard-runner/contracts/J03.d.ts +13 -0
- package/dist/services/capability-guard-runner/contracts/J03.js +72 -21
- package/dist/services/capability-guard-runner/contracts/J04.d.ts +6 -0
- package/dist/services/capability-guard-runner/contracts/J04.js +65 -32
- package/dist/services/capability-guard-runner/contracts/J05.js +118 -16
- package/dist/services/capability-guard-runner/contracts/J06.d.ts +14 -0
- package/dist/services/capability-guard-runner/contracts/J06.js +57 -39
- package/dist/services/capability-guard-runner/contracts/J07.d.ts +9 -0
- package/dist/services/capability-guard-runner/contracts/J07.js +76 -47
- package/dist/services/capability-guard-runner/contracts/J08.d.ts +11 -0
- package/dist/services/capability-guard-runner/contracts/J08.js +66 -39
- package/dist/services/capability-guard-runner/contracts/J09.d.ts +13 -0
- package/dist/services/capability-guard-runner/contracts/J09.js +95 -39
- package/dist/services/capability-guard-runner/contracts/J10.d.ts +12 -0
- package/dist/services/capability-guard-runner/contracts/J10.js +69 -35
- package/dist/services/capability-guard-runner/contracts/J11.d.ts +8 -0
- package/dist/services/capability-guard-runner/contracts/J11.js +73 -33
- package/dist/services/capability-guard-runner/contracts/J12.d.ts +12 -0
- package/dist/services/capability-guard-runner/contracts/J12.js +66 -30
- package/dist/services/capability-guard-runner/contracts/J13.d.ts +11 -0
- package/dist/services/capability-guard-runner/contracts/J13.js +62 -40
- package/dist/services/capability-guard-runner/contracts/J14.d.ts +11 -0
- package/dist/services/capability-guard-runner/contracts/J14.js +60 -31
- package/dist/services/capability-guard-runner/contracts/J15.d.ts +11 -0
- package/dist/services/capability-guard-runner/contracts/J15.js +70 -35
- package/dist/services/capability-guard-runner/contracts/_shared.d.ts +24 -0
- package/dist/services/capability-guard-runner/contracts/_shared.js +67 -0
- package/dist/services/capability-guard-runner/registry.d.ts +5 -0
- package/dist/services/capability-guard-runner/registry.js +140 -0
- package/dist/services/capability-guard-runner/runner.d.ts +26 -0
- package/dist/services/capability-guard-runner/runner.js +63 -6
- package/dist/services/code/auto-compact-modes.d.ts +13 -2
- package/dist/services/code/auto-compact-modes.js +20 -4
- package/dist/services/code/post-compact-detector.js +20 -11
- package/dist/services/code/step-08-gate.js +21 -6
- package/dist/services/config/config-safety.js +11 -9
- package/dist/services/final-review/pre-post-diff.js +10 -2
- package/dist/services/observability/observability-service.d.ts +1 -1
- package/dist/services/scan/api-diff-types.js +20 -2
- package/dist/services/security/safe-settings-path.js +19 -1
- package/dist/services/skill/skill-search-service.d.ts +3 -3
- package/dist/services/standards/loop-engineering-lint.d.ts +1 -1
- package/dist/services/standards/loop-engineering-lint.js +6 -0
- package/dist/services/web/daemon-registry.js +27 -2
- package/dist/services/workspace/claude-settings-template.d.ts +53 -37
- package/dist/services/workspace/claude-settings-template.js +105 -83
- package/dist/services/workspace/generated-artifacts-stamp.d.ts +119 -0
- package/dist/services/workspace/generated-artifacts-stamp.js +167 -0
- package/dist/services/workspace/workspace-claude-settings-materializer.d.ts +8 -0
- package/dist/services/workspace/workspace-claude-settings-materializer.js +38 -3
- package/dist/services/workspace/workspace-service.js +11 -1
- package/dist/shared/fs-utils.d.ts +26 -0
- package/dist/shared/fs-utils.js +35 -0
- package/package.json +9 -7
- package/scripts/copy-templates.mjs +0 -12
- package/scripts/install-skills.mjs +154 -53
- package/skills/bee/peaks-qa/SKILL.md +0 -1
- package/skills/bee/peaks-rd/SKILL.md +0 -1
- package/skills/peaks-code/SKILL.md +12 -10
- package/skills/peaks-code/references/periodic-checkpoint.md +2 -2
- package/skills/peaks-code/references/runbook.md +3 -0
- package/skills/peaks-code/references/session-overload-signal-index.md +4 -2
- package/skills/peaks-code/references/startup-sequence.md +2 -2
- package/skills/peaks-code/references/step-0-8-gate.md +1 -1
- package/skills/peaks-code/references/sub-agent-dispatch.md +19 -19
- package/dist/cli/commands/context-builder-commands.d.ts +0 -11
- package/dist/cli/commands/context-builder-commands.js +0 -85
- package/dist/services/hooks/write-gate.js +0 -111
- package/skills/bee/peaks-prd/references/command-migration.md +0 -3
- package/skills/bee/peaks-qa/references/command-migration.md +0 -3
- package/skills/bee/peaks-rd/references/command-migration.md +0 -3
- package/skills/bee/peaks-sc/references/command-migration.md +0 -3
- package/skills/bee/peaks-txt/references/command-migration.md +0 -3
- package/skills/bee/peaks-ui/references/command-migration.md +0 -3
- package/skills/peaks-code/references/command-migration.md +0 -3
|
@@ -256,10 +256,6 @@ function validateConfigPath(root, peaksRoot, configPath, label) {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
function validateProjectConfigPaths(projectRoot, peaksRoot, configPath) {
|
|
260
|
-
validateConfigPath(projectRoot, peaksRoot, configPath, 'Project');
|
|
261
|
-
}
|
|
262
|
-
|
|
263
259
|
function validateUserConfigPaths(userRoot, peaksRoot, configPath) {
|
|
264
260
|
validateConfigPath(userRoot, peaksRoot, configPath, 'User');
|
|
265
261
|
}
|
|
@@ -345,10 +341,6 @@ function writeFileAtomically(configPath, content, errorMessage, validateBeforeWr
|
|
|
345
341
|
}
|
|
346
342
|
}
|
|
347
343
|
|
|
348
|
-
function writeProjectConfig(projectRoot, peaksRoot, configPath, content) {
|
|
349
|
-
writeFileAtomically(configPath, content, 'Project config path changed during write', () => validateProjectConfigPaths(projectRoot, peaksRoot, configPath));
|
|
350
|
-
}
|
|
351
|
-
|
|
352
344
|
function writeUserConfig(userRoot, peaksRoot, configPath, content) {
|
|
353
345
|
writeFileAtomically(configPath, content, 'User config path changed during write', () => validateUserConfigPaths(userRoot, peaksRoot, configPath));
|
|
354
346
|
}
|
|
@@ -374,6 +366,16 @@ function resolveProjectRoot(options) {
|
|
|
374
366
|
* + emits a stderr warning. The dispatch is conservative: the env-var
|
|
375
367
|
* overrides `PEAKS_CLAUDE_SKILLS_DIR` / `PEAKS_CLAUDE_OUTPUT_STYLES_DIR`
|
|
376
368
|
* continue to work, and the legacy default is preserved.
|
|
369
|
+
*
|
|
370
|
+
* 2026-09-15 (D12 fix): `hermes` and `openclaw` have install profiles in
|
|
371
|
+
* `IDE_SKILL_INSTALL_PROFILES` but were absent from this table. A profile
|
|
372
|
+
* that no detector can ever return is reachable only through the
|
|
373
|
+
* every-platform fan-out — i.e. it is installed for users who do NOT have
|
|
374
|
+
* the tool and skipped for nobody. Both are listed here now, so detection
|
|
375
|
+
* and installation answer the same question with the same table.
|
|
376
|
+
*
|
|
377
|
+
* This table is ALSO the presence oracle for `isPlatformPresent` below: a
|
|
378
|
+
* directory here in the project root means the user has that tool.
|
|
377
379
|
*/
|
|
378
380
|
export const IDE_DETECTION_DIRS = [
|
|
379
381
|
{ id: 'claude-code', dir: '.claude' },
|
|
@@ -384,23 +386,33 @@ export const IDE_DETECTION_DIRS = [
|
|
|
384
386
|
{ id: 'qoder', dir: '.qoder' },
|
|
385
387
|
{ id: 'tongyi-lingma', dir: '.tongyi-lingma' },
|
|
386
388
|
{ id: 'zcode', dir: '.zcode' },
|
|
389
|
+
{ id: 'hermes', dir: '.hermes' },
|
|
390
|
+
{ id: 'openclaw', dir: '.openclaw' },
|
|
387
391
|
];
|
|
388
392
|
|
|
389
393
|
/**
|
|
390
394
|
* Per-IDE skill install paths. Per peaks-loop tenet
|
|
391
395
|
* "minimal-user-operation" (2026-06-11), the user should
|
|
392
396
|
* never have to run a per-platform install command — the
|
|
393
|
-
* `npm i -g peaks-loop` postinstall iterates
|
|
394
|
-
* and symlinks the peaks-* skill family
|
|
395
|
-
*
|
|
397
|
+
* `npm i -g peaks-loop` postinstall iterates the platforms
|
|
398
|
+
* the user HAS and symlinks the peaks-* skill family into each
|
|
399
|
+
* (see `isPlatformPresent`; D9/2026-09-15 made "has" load-bearing).
|
|
396
400
|
*
|
|
397
401
|
* 1.x had only `claude-code` (the other 5 entries were
|
|
398
402
|
* `null`); real Trae users reported the Trae skill
|
|
399
403
|
* directory was never populated. 2.0 fixes this by giving
|
|
400
|
-
*
|
|
404
|
+
* every platform a canonical install path.
|
|
401
405
|
*/
|
|
402
406
|
export const IDE_SKILL_INSTALL_PROFILES = {
|
|
403
407
|
'claude-code': {
|
|
408
|
+
// `alwaysPresent` — see `isPlatformPresent`. Declared HERE, in the
|
|
409
|
+
// vendor's own row, rather than as an `ideId === 'claude-code'` branch in
|
|
410
|
+
// the consumer: the guard at
|
|
411
|
+
// `tests/unit/runtime/vendor-neutral-identity-guard.test.ts` pins identity
|
|
412
|
+
// DECISIONS to the vendor declarations, and a comparison in the consumer
|
|
413
|
+
// is exactly the re-injection shape it exists to catch. A future vendor
|
|
414
|
+
// opts into the same policy by setting this field.
|
|
415
|
+
alwaysPresent: true,
|
|
404
416
|
skillsDir: join(homedir(), '.claude', 'skills'),
|
|
405
417
|
outputStylesDir: join(homedir(), '.claude', 'output-styles'),
|
|
406
418
|
agentsDir: join(homedir(), '.claude', 'agents'),
|
|
@@ -489,6 +501,46 @@ function resolveIdeSkillInstallProfile(ideId) {
|
|
|
489
501
|
return IDE_SKILL_INSTALL_PROFILES[ideId] ?? null;
|
|
490
502
|
}
|
|
491
503
|
|
|
504
|
+
/**
|
|
505
|
+
* Is this platform actually installed FOR? (D9 fix, 2026-09-15.)
|
|
506
|
+
*
|
|
507
|
+
* Before this gate, the postinstall ran `mkdirSync(targetRoot, {recursive:
|
|
508
|
+
* true})` for ALL 10 profiles unconditionally, so `npm i -g peaks-loop` created
|
|
509
|
+
* `~/.hermes`, `~/.openclaw`, `~/.qoder`, `~/.tongyi-lingma` and `~/.zcode` in
|
|
510
|
+
* the home of a user who has never installed those tools. The peaks-loop tenet
|
|
511
|
+
* is "the user never has to run a per-platform install command" — it is NOT
|
|
512
|
+
* "peaks-loop guesses which tools you have". Creating a directory for a tool
|
|
513
|
+
* the user does not own is the tenet misread, and it is visible on disk.
|
|
514
|
+
*
|
|
515
|
+
* Present means EITHER:
|
|
516
|
+
* - the tool's marker directory exists in the project root (the same
|
|
517
|
+
* directory `detectInstalledIdeId` consults above), OR
|
|
518
|
+
* - the tool's own home directory (`~/.<tool>`, derived from its profile)
|
|
519
|
+
* already exists on this machine.
|
|
520
|
+
*
|
|
521
|
+
* `claude-code` is unconditionally present: it is peaks-loop's primary runtime
|
|
522
|
+
* and the documented legacy install target, so a machine with no `~/.claude`
|
|
523
|
+
* yet still gets the trees the user is installing peaks-loop for. That fact is
|
|
524
|
+
* declared as `alwaysPresent: true` IN THE VENDOR'S OWN PROFILE ROW — not as an
|
|
525
|
+
* `ideId === 'claude-code'` branch here. This file sits outside the adapter
|
|
526
|
+
* layer, so an identity comparison in it is the re-injection shape
|
|
527
|
+
* `tests/unit/runtime/vendor-neutral-identity-guard.test.ts` pins; reading the
|
|
528
|
+
* vendor's declaration keeps the policy in one place and vendor-neutral.
|
|
529
|
+
*
|
|
530
|
+
* A named target bypasses this gate entirely — `options.targetRoot`,
|
|
531
|
+
* `options.ideId`, and the `PEAKS_<TOOL>_SKILLS_DIR` env vars are callers who
|
|
532
|
+
* have already said which platform they mean; guessing a second time there
|
|
533
|
+
* would break the 1.x back-compat contract that slice 2026-06-12 restored.
|
|
534
|
+
*/
|
|
535
|
+
function isPlatformPresent(ideId, profile, projectRoot) {
|
|
536
|
+
if (profile.alwaysPresent === true) return true;
|
|
537
|
+
const detection = IDE_DETECTION_DIRS.find((entry) => entry.id === ideId);
|
|
538
|
+
if (detection !== undefined && projectRoot !== null && existsSync(join(projectRoot, detection.dir))) {
|
|
539
|
+
return true;
|
|
540
|
+
}
|
|
541
|
+
return existsSync(dirname(profile.skillsDir));
|
|
542
|
+
}
|
|
543
|
+
|
|
492
544
|
function warnUnverifiedIde(ideId, projectRoot) {
|
|
493
545
|
process.stderr.write(
|
|
494
546
|
`peaks install-skills: IDE '${ideId}' has no skillInstall profile declared; ` +
|
|
@@ -540,29 +592,26 @@ export function installUserConfig(options = {}) {
|
|
|
540
592
|
return writeMergedConfig(configPath, 'User', createConfigDefaults(options.packageRoot), (content) => writeUserConfig(userRoot, peaksRoot, configPath, content));
|
|
541
593
|
}
|
|
542
594
|
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
return writeMergedConfig(configPath, 'Project', createConfigDefaults(options.packageRoot), (content) => writeProjectConfig(projectRoot, peaksRoot, configPath, content));
|
|
565
|
-
}
|
|
595
|
+
/*
|
|
596
|
+
* D11 (2026-09-15): `installProjectConfig` — plus its two private helpers
|
|
597
|
+
* `writeProjectConfig` and `validateProjectConfigPaths` — was DELETED here.
|
|
598
|
+
*
|
|
599
|
+
* It was dead: definition + `export`, and zero call sites in the whole repo
|
|
600
|
+
* (verified by a repo-wide grep for the identifier, excluding node_modules
|
|
601
|
+
* and dist). The `PEAKS_SKIP_PROJECT_CONFIG_INSTALL` env var existed only to
|
|
602
|
+
* disable it.
|
|
603
|
+
*
|
|
604
|
+
* Deleted rather than wired, because wiring it would be the bigger defect:
|
|
605
|
+
* `npm i -g peaks-loop` executed from inside a user's repo would write
|
|
606
|
+
* `<project>/.peaks/config.json` as a side effect of a GLOBAL install. The
|
|
607
|
+
* project-level config is owned by `peaks workspace init` and the config
|
|
608
|
+
* service at runtime; a postinstall reaching into the current working
|
|
609
|
+
* directory to create project state is the opposite of the "minimal user
|
|
610
|
+
* operation" tenet — an operation the user never asked for.
|
|
611
|
+
*
|
|
612
|
+
* The user-config sibling (`installUserConfig`, below) is live and is what
|
|
613
|
+
* the postinstall actually calls.
|
|
614
|
+
*/
|
|
566
615
|
|
|
567
616
|
export function installBundledSkills(options = {}) {
|
|
568
617
|
const packageRoot = resolvePackageRoot(options);
|
|
@@ -684,6 +733,40 @@ export function installBundledSkills(options = {}) {
|
|
|
684
733
|
return { installed, skipped };
|
|
685
734
|
}
|
|
686
735
|
|
|
736
|
+
/**
|
|
737
|
+
* DISPATCH STRATEGY — the three paths in this file, and why they differ
|
|
738
|
+
* (D10, written down 2026-09-15).
|
|
739
|
+
*
|
|
740
|
+
* This script installs three kinds of asset, and each one resolves its target
|
|
741
|
+
* by a different rule. That was undocumented and untested; it is now
|
|
742
|
+
* documented here and each rule is stated with its reason.
|
|
743
|
+
*
|
|
744
|
+
* 1. SKILLS (`installBundledSkillsForAllPlatforms`)
|
|
745
|
+
* Fan out to every platform the user HAS (`isPlatformPresent`).
|
|
746
|
+
* Reason: a skill directory is per-tool; the same skill is legitimately
|
|
747
|
+
* wanted in several tools at once, and peaks cannot know which tool the
|
|
748
|
+
* user will open next. Fan-out is the tenet; presence is the licence.
|
|
749
|
+
*
|
|
750
|
+
* 2. AGENTS (`installBundledAgentsForAllPlatforms`)
|
|
751
|
+
* Fan out to present platforms, INTERSECTED with the profiles that
|
|
752
|
+
* declare `agentsDir`. Reason: sub-agent loaders are not a universal
|
|
753
|
+
* concept — only 6 of 10 profiles have one. The intersection is the fan
|
|
754
|
+
* of (1) with a capability filter, not a third rule.
|
|
755
|
+
*
|
|
756
|
+
* 3. OUTPUT STYLES (`installBundledOutputStyles`, this function)
|
|
757
|
+
* ONE target: the IDE detected in the project root, else the legacy
|
|
758
|
+
* `~/.claude/output-styles`. Reason: an output style is not a
|
|
759
|
+
* per-tool asset — it is registered as THE active style for the
|
|
760
|
+
* session by writing a single `outputStyle` key into
|
|
761
|
+
* `~/.claude/settings.json` (`installBundledOutputStyleDefault`). A
|
|
762
|
+
* second copy in `~/.trae/output-styles` would be a file nothing reads
|
|
763
|
+
* and a setting no one consults; fanning it out would be storing the
|
|
764
|
+
* same answer in ten places and reading it from one.
|
|
765
|
+
*
|
|
766
|
+
* So: (1) and (2) share one predicate and differ only by capability; (3) is
|
|
767
|
+
* deliberately single-target, and this comment is the reason the brief asked
|
|
768
|
+
* for. If a future platform needs a different rule, state it here.
|
|
769
|
+
*/
|
|
687
770
|
export function installBundledOutputStyles(options = {}) {
|
|
688
771
|
const packageRoot = resolvePackageRoot(options);
|
|
689
772
|
const outputStylesRoot = join(packageRoot, 'output-styles');
|
|
@@ -1034,12 +1117,18 @@ export function installBundledAgents(options = {}) {
|
|
|
1034
1117
|
}
|
|
1035
1118
|
|
|
1036
1119
|
/**
|
|
1037
|
-
* Per-platform fan-out — iterate
|
|
1038
|
-
* `installBundledAgents` for each
|
|
1039
|
-
* field.
|
|
1040
|
-
*
|
|
1041
|
-
*
|
|
1042
|
-
*
|
|
1120
|
+
* Per-platform fan-out — iterate the platforms the user HAS and call
|
|
1121
|
+
* `installBundledAgents` for each one that also declares an `agentsDir`
|
|
1122
|
+
* profile field. 6 of the 10 profiles declare `agentsDir` today
|
|
1123
|
+
* (claude-code, trae, trae-cn, codex, cursor, zcode); the other 4 have no
|
|
1124
|
+
* sub-agent loader to write into and are skipped by construction. A future
|
|
1125
|
+
* platform opts in by adding `agentsDir` to its
|
|
1126
|
+
* `IDE_SKILL_INSTALL_PROFILES` entry.
|
|
1127
|
+
*
|
|
1128
|
+
* D9/D10 fix (2026-09-15): the platform set is filtered by
|
|
1129
|
+
* `isPlatformPresent` (same predicate as the skills fan-out), so this no
|
|
1130
|
+
* longer creates `~/.trae/agents`, `~/.codex/agents`, … for tools the user
|
|
1131
|
+
* does not have.
|
|
1043
1132
|
*
|
|
1044
1133
|
* Per peaks-loop tenet "minimal-user-operation" (2026-06-11): the user
|
|
1045
1134
|
* should never have to run a per-platform install command. Symlink /
|
|
@@ -1047,8 +1136,10 @@ export function installBundledAgents(options = {}) {
|
|
|
1047
1136
|
* failure doesn't block the others.
|
|
1048
1137
|
*/
|
|
1049
1138
|
export function installBundledAgentsForAllPlatforms(options = {}) {
|
|
1139
|
+
const projectRoot = resolveProjectRoot(options);
|
|
1050
1140
|
const platforms = Object.entries(IDE_SKILL_INSTALL_PROFILES)
|
|
1051
|
-
.filter(([, profile]) => typeof profile.agentsDir === 'string')
|
|
1141
|
+
.filter(([, profile]) => typeof profile.agentsDir === 'string')
|
|
1142
|
+
.filter(([ideId, profile]) => isPlatformPresent(ideId, profile, projectRoot));
|
|
1052
1143
|
const perPlatform = [];
|
|
1053
1144
|
for (const [ideId, profile] of platforms) {
|
|
1054
1145
|
try {
|
|
@@ -1091,29 +1182,37 @@ export function installBundledAgentsForAllPlatforms(options = {}) {
|
|
|
1091
1182
|
}
|
|
1092
1183
|
|
|
1093
1184
|
/**
|
|
1094
|
-
* Per-platform fan-out — iterate
|
|
1185
|
+
* Per-platform fan-out — iterate the platforms the user actually HAS and call
|
|
1095
1186
|
* `installBundledSkills` for each. Per peaks-loop tenet
|
|
1096
1187
|
* "minimal-user-operation" (2026-06-11): the user should
|
|
1097
1188
|
* never have to run a per-platform install command. The
|
|
1098
1189
|
* 1.x postinstall only handled the auto-detected single
|
|
1099
1190
|
* IDE; 2.0 fixes this so the peaks-* skill family is
|
|
1100
|
-
* symlinked to every platform the user
|
|
1191
|
+
* symlinked to every platform the user is on.
|
|
1192
|
+
*
|
|
1193
|
+
* D9/D10 fix (2026-09-15): the set is filtered by `isPlatformPresent`, not
|
|
1194
|
+
* "all 10 profiles". See that helper for why, and see the DISPATCH STRATEGY
|
|
1195
|
+
* note above `installBundledOutputStyles` for how this fan-out relates to the
|
|
1196
|
+
* other two dispatch paths in this file.
|
|
1101
1197
|
*
|
|
1102
1198
|
* Returns an array of { ideId, skillsDir, installed, skipped }
|
|
1103
1199
|
* per platform. Symlink failures are soft (logged to stderr,
|
|
1104
1200
|
* never throw) so one platform's failure doesn't block the
|
|
1105
|
-
*
|
|
1201
|
+
* others.
|
|
1106
1202
|
*/
|
|
1107
1203
|
export function installBundledSkillsForAllPlatforms(options = {}) {
|
|
1108
|
-
const
|
|
1204
|
+
const projectRoot = resolveProjectRoot(options);
|
|
1205
|
+
const platforms = Object.keys(IDE_SKILL_INSTALL_PROFILES).filter((ideId) =>
|
|
1206
|
+
isPlatformPresent(ideId, IDE_SKILL_INSTALL_PROFILES[ideId], projectRoot)
|
|
1207
|
+
);
|
|
1109
1208
|
const perPlatform = [];
|
|
1110
1209
|
// Back-compat precedence (regression fix 2026-06-12,
|
|
1111
1210
|
// slice 2026-06-12-postinstall-1x-detector-tdd):
|
|
1112
|
-
// when iterating the
|
|
1211
|
+
// when iterating the present platforms, the claude-code install
|
|
1113
1212
|
// must still honor the PEAKS_CLAUDE_SKILLS_DIR env var
|
|
1114
|
-
// (the legacy back-compat surface from 1.x). The other
|
|
1213
|
+
// (the legacy back-compat surface from 1.x). The other
|
|
1115
1214
|
// platforms use their per-IDE profile paths unconditionally.
|
|
1116
|
-
// Without this fix the
|
|
1215
|
+
// Without this fix the fan-out regresses the
|
|
1117
1216
|
// `peaks install-skills` env-var override contract that
|
|
1118
1217
|
// user CI / 1.x → 2.0 migration scripts depend on.
|
|
1119
1218
|
const claudeEnv = process.env.PEAKS_CLAUDE_SKILLS_DIR;
|
|
@@ -1298,10 +1397,12 @@ export async function autoUpgrade1xProjectIfPresent(options = {}) {
|
|
|
1298
1397
|
if (process.argv[1] !== undefined && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
|
|
1299
1398
|
try {
|
|
1300
1399
|
// 2.0 fix for the 1.x Trae bug (per real user feedback
|
|
1301
|
-
// 2026-06-11): iterate
|
|
1302
|
-
// auto-detected
|
|
1303
|
-
// tenet, the user should never have to run a
|
|
1304
|
-
// per-platform install command
|
|
1400
|
+
// 2026-06-11): iterate every platform the user HAS, not just the
|
|
1401
|
+
// one auto-detected in the project root. Per the
|
|
1402
|
+
// "minimal-user-operation" tenet, the user should never have to run a
|
|
1403
|
+
// per-platform install command — S6 (2026-09-15) narrowed "every" from
|
|
1404
|
+
// "all 10 profiles" to `isPlatformPresent`, because creating a home
|
|
1405
|
+
// directory for a tool the user does not own is that tenet misread.
|
|
1305
1406
|
const perPlatform = installBundledSkillsForAllPlatforms();
|
|
1306
1407
|
let totalInstalled = 0;
|
|
1307
1408
|
for (const p of perPlatform) {
|
|
@@ -258,7 +258,6 @@ Index of every `references/` file in this skill. Read on demand.
|
|
|
258
258
|
| `references/artifact-per-request.md` | QA 3-file per-request artifact contract. |
|
|
259
259
|
| `references/browser-validation-contracts.md` | Browser contracts (1) + (2) + AskUserQuestion. |
|
|
260
260
|
| `references/codegraph-regression-focus.md` | Codegraph regression-surface evidence. |
|
|
261
|
-
| `references/command-migration.md` | Legacy command migration map. |
|
|
262
261
|
| `references/external-capability-guidance.md` | Playwright / Chrome DevTools / Agent Browser. |
|
|
263
262
|
| `references/openspec-validation-gate.md` | OpenSpec validation + archive gate. |
|
|
264
263
|
| `references/qa-compact-handoff.md` | QA compact handoff capsule. |
|
|
@@ -315,7 +315,6 @@ Index of every `references/` file in this skill. Read on demand.
|
|
|
315
315
|
| `references/artifact-per-request.md` | RD per-request artifact + per-slice vs per-session scope. |
|
|
316
316
|
| `references/browser-self-test-contracts.md` | Browser self-test contracts (1) + (2). |
|
|
317
317
|
| `references/codegraph-project-analysis.md` | Codegraph local analysis (untrusted evidence). |
|
|
318
|
-
| `references/command-migration.md` | Legacy command migration map. |
|
|
319
318
|
| `references/compact-handoff.md` | RD compact handoff capsule. |
|
|
320
319
|
| `references/external-references.md` | External 3rd-party inventory. |
|
|
321
320
|
| `references/frontend-project-generation.md` | React + Vite + shadcn/ui default. |
|
|
@@ -44,8 +44,9 @@ denied again after a long pause. That is the gate resetting, not you regressing.
|
|
|
44
44
|
|
|
45
45
|
`peaks-code` is a **code-domain long-task loop engineering orchestrator; not a general-purpose orchestrator.**
|
|
46
46
|
|
|
47
|
-
This is RL-8
|
|
48
|
-
|
|
47
|
+
This is RL-8, stated in `.peaks/standards/loop-engineering-guidelines.md` (the 2026-07-07
|
|
48
|
+
crystallization design spec that first wrote it, §0.4 and §10, was retired from the tree in
|
|
49
|
+
commit `e6e35842`).
|
|
49
50
|
The boundary is closed under this slice:
|
|
50
51
|
|
|
51
52
|
- **In scope:** end-to-end code-domain workflows — repository scanning, RD planning, code implementation via RD, QA verification, UI changes inside a code repo, source-control handoff, and code-repo context packaging. Coordinated role skills: `peaks-prd`, `peaks-rd`, `peaks-qa`, `peaks-ui`, `peaks-sc`, `peaks-txt`.
|
|
@@ -123,7 +124,7 @@ STOP. Run:
|
|
|
123
124
|
peaks sub-agent dispatch rd --prompt '<your task>' --graph-node <nid> --workflow-id <wid> --request-id <rid> --project . --batch-id <uuid> --json
|
|
124
125
|
```
|
|
125
126
|
|
|
126
|
-
`--graph-node <nid>`
|
|
127
|
+
`--graph-node <nid>` and `--workflow-id <wid>` are OPTIONAL. Slice 4.0.8 RD §4 D4c made `--graph-node` required; it was relaxed again in `provisionDispatchNode` (`src/services/workflow/provision-dispatch-node.ts`) because the requirement was enforced but never validated — nothing downstream read the node, the record writer's graph transition is best-effort, and the documented "prepare a node first" ritual had no viable first step (`peaks workflow node prepare` never persisted the node). Passing neither flag now provisions the node and the graph on demand, so a dispatch works in a project with no graph infrastructure. When you DO pass a node, the binding is real: `provisionDispatchNode` writes it into `graphs/<wid>.json`. The RD sub-agent owns the actual `Edit`/`Write`/`MultiEdit` tool calls against source code. The orchestrator only emits the dispatch request.
|
|
127
128
|
|
|
128
129
|
**Anti-pattern:** directly calling `Edit`/`Write`/`MultiEdit` on `src/**` from the orchestrator session because "the change is tiny" / "it's just one line" / "the dispatch overhead is too high" / "the LLM feels confident". None of these override the Code-Gate; the probe + the hook both fail-closed.
|
|
129
130
|
|
|
@@ -138,7 +139,7 @@ peaks sub-agent dispatch rd --prompt '<your task>' --graph-node <nid> --workflow
|
|
|
138
139
|
**Integration surfaces:** `peaks code run --24h` / `peaks dashboard long-run --since 24h` / `peaks session 24h-mode state|transition|attempts|reset`.
|
|
139
140
|
|
|
140
141
|
**Red lines (peaks-code side):**
|
|
141
|
-
- No auto-compact prose ban: never write "ask the user to compact" / "prompt the user to run `/compact`" / "the user should run `peaks code auto-compact` manually" / "the user is responsible for context management" / legacy 50/75/90 percent tiers. **0.85 / 0.95
|
|
142
|
+
- No auto-compact prose ban: never write "ask the user to compact" / "prompt the user to run `/compact`" / "the user should run `peaks code auto-compact` manually" / "the user is responsible for context management" / legacy 50/75/90 percent tiers. **Tier contract (standard mode): `auto-fire` ≥ 0.80 / `pre-compact` ≥ 0.85 / `red-line` ≥ 0.95. Compact on the FIRST of these to arrive — 0.80, not 0.85.**
|
|
142
143
|
- SquabbyZ sole-author rule: no `Co-Authored-By: Claude/Anthropic` trailer.
|
|
143
144
|
- 24h mode is a flag on `peaks-code`; MUST NOT introduce a sibling `peaks-24h` skill or competing top-level verb.
|
|
144
145
|
|
|
@@ -185,7 +186,7 @@ Before the first planning action, run `peaks fresh-context preflight --prompt "<
|
|
|
185
186
|
1. **PreToolUse hook — `peaks code gate-step-08`.** Installed by `peaks workspace init` on the `Bash` matcher; checks `job-shape.json` presence + fail-closed backup regex. If `job-shape.json` AND `progress.json` exist, surfaces `Next: slice #N of M (<currentSlice>)` so the LLM cannot wake up cold.
|
|
186
187
|
2. **Size-fear ban — `peaks code emit-handoff`.** Refuses to emit a final handoff while `remaining > 0` under Job mode. Pass `--force-under-job` only with explicit user approval.
|
|
187
188
|
3. **On-disk slice progress — `peaks job progress`.** `peaks job checkpoint --state done` writes `progress.json`. `peaks job progress --job-id <jid> [--allow-missing]` is the canonical reader.
|
|
188
|
-
4. **Forced auto-compact — `peaks code context-now
|
|
189
|
+
4. **Forced auto-compact — two probes, two thresholds.** `peaks skill presence` (the every-turn probe) reports `action: 'auto-fire'` at ≥ 0.80 and `action: 'pre-compact'` at ≥ 0.85; `peaks code context-now` reports `action: 'auto-compact-now'` at ≥ 0.85 — it has no 0.80 tier. **The earlier of the two governs: at ≥ 0.80 the run is already MANDATORY auto-compact in every mode (single-rid included)** — Code MUST call `peaks code auto-compact` without confirmation, and MUST NOT wait for 0.85. `--enforce-job-mode` (v3.1.2) only labels the run `jobMode=true`; the ≥ 0.85 downgrade that used to apply to single-rid sessions was removed 2026-09-12.
|
|
189
190
|
|
|
190
191
|
**Step 0.7 resume rule (read-FIRST):** on resume, `peaks code gate-step-08` reads `progress.json` first and surfaces `Next: slice #N of M (<currentSlice>)` so the orchestrator picks up at the right slice without re-reading the artifact tree.
|
|
191
192
|
|
|
@@ -197,24 +198,25 @@ Before the first planning action, run `peaks fresh-context preflight --prompt "<
|
|
|
197
198
|
|
|
198
199
|
> **Zero-pause contract.** When context usage crosses the pre-compact threshold, peaks-loop **automatically fires `peaks code auto-compact` — the LLM does NOT prompt the user to run `/compact` manually**. Stale prose that says "ask the user to compact" silently stalls the workflow. The v2.13.0 contract makes auto-compact a system responsibility, not a user action.
|
|
199
200
|
|
|
200
|
-
**Thresholds (
|
|
201
|
+
**Thresholds (standard mode, replacing legacy 50/75/90; `partial` / 24h mode moves every line down to 0.65 / 0.70 / 0.85):**
|
|
201
202
|
|
|
202
203
|
| ratio zone | zone name | action |
|
|
203
204
|
|---|---|---|
|
|
204
|
-
| `< 0.
|
|
205
|
-
| `0.
|
|
205
|
+
| `< 0.80` | normal | skip — LLM keeps working |
|
|
206
|
+
| `0.80 ≤ ratio < 0.85` | **auto-fire zone** | `peaks skill presence` returns `action: 'auto-fire'` here: peaks-loop preempts on its own, without asking the LLM to decide. The LLM MUST run `peaks code auto-compact` and MUST NOT wait for 0.85. **This is the tier that fires first, so this row — not the 0.85 row — is the real trigger line.** `peaks code context-now` has no 0.80 tier and still reports `soft-warn` here, so its `action` alone under-reports this band. |
|
|
207
|
+
| `0.85 ≤ ratio < 0.95` | **pre-compact zone** | `peaks code auto-compact` fires **automatically** (deferred only when in-flight sub-agent batch is running; fires the moment the batch lands). The LLM does not prompt the user. In practice peaks-loop already fired at the 0.80 tier above, so this band is today the "already fired" zone; `peaks code context-now` reports `action: 'auto-compact-now'` from 0.85 up. |
|
|
206
208
|
| `ratio ≥ 0.95` | **red-line (Karpathy §4)** | `peaks code auto-compact` invoked immediately; `peaks code context-now` returns `action: 'red-line'`. **Since 4.0.47 the red line REQUESTS the compaction and says it is waiting — it does NOT block sub-agent dispatch, and it does not refuse to advance.** Keep working and re-probe with `peaks code context-now`; the harness performs the compaction, and nothing peaks-loop can do lowers the ratio on its own, so blocking here was a deadlock rather than a gate. If the ratio keeps climbing and no compaction lands, report that and hand control back — do not stall. `--bypass-red-line` is a no-op. |
|
|
207
209
|
|
|
208
210
|
**Probe primitive (single source of truth):** `peaks code context-now --json`. Do NOT use `peaks context check --prompt-size` (deprecated, will silently under-report ratio). Returns `{ ratio, action: 'ok' | 'soft-warn' | 'auto-compact-now' | 'red-line' }` — Code reads `action` and dispatches `peaks code auto-compact` on `auto-compact-now` or `red-line` without user confirmation.
|
|
209
211
|
|
|
210
212
|
**Enforcement layers (defense in depth):**
|
|
211
213
|
1. `src/services/code/auto-compact-orchestrator.ts` — `evaluateAutoCompactDecision` default-returns `shouldCompact: true` for both `pre-compact` and `red-line`. Only deferral is `inFlightBatch.hasInFlightBatch` (D6.e); no LLM/human approval branch.
|
|
212
|
-
2. `peaks code context-now` — ≥ 0.85 is MANDATORY (`auto-compact-now`) in every mode; `--enforce-job-mode` no longer gates that (2026-09-12). Only an in-flight sub-agent batch defers it.
|
|
214
|
+
2. `peaks skill presence` — ≥ 0.80 is MANDATORY (`auto-fire`) in every mode; this probe runs every turn, so it is the one that cannot be forgotten. `peaks code context-now` — ≥ 0.85 is MANDATORY (`auto-compact-now`) in every mode; `--enforce-job-mode` no longer gates that (2026-09-12). Only an in-flight sub-agent batch defers it.
|
|
213
215
|
3. `peaks code gate-step-08` (PreToolUse hook) — surfaces `auto-compact-now` on every Bash call when ratio is in the zone, so the LLM cannot wake up cold and forget.
|
|
214
216
|
4. Karpathy §4 exception: `peaks code auto-compact` is fired *by the orchestrator*, not by the user. If you find yourself about to write "ask the user to compact" / "prompt the user to run `/compact`", STOP — that is the regression.
|
|
215
217
|
|
|
216
218
|
**Anti-pattern (DO NOT introduce):** any of these strings in skills/* or comments signals the zero-pause contract has been broken:
|
|
217
|
-
- "ask the user to compact" / "prompt the user to run `/compact`" / "the user should run `peaks code auto-compact` manually" / "the user is responsible for context management" / legacy mid/seventy-five/ninety percent tiers (current is 0.85 / 0.95).
|
|
219
|
+
- "ask the user to compact" / "prompt the user to run `/compact`" / "the user should run `peaks code auto-compact` manually" / "the user is responsible for context management" / legacy mid/seventy-five/ninety percent tiers (current is 0.80 auto-fire / 0.85 pre-compact / 0.95 red-line).
|
|
218
220
|
|
|
219
221
|
If the prose audit (`peaks audit red-lines`) flags any of the above, the slice is **blocked** until the prose is rewritten.
|
|
220
222
|
|
|
@@ -72,10 +72,10 @@ This step is strictly IDE-agnostic. The LLM calls the peaks CLI; no IDE-specific
|
|
|
72
72
|
|
|
73
73
|
## Companion surface — auto-compact (zero-pause)
|
|
74
74
|
|
|
75
|
-
When the runner crosses the v2.13.0 auto-compact thresholds (0.85 pre-compact / 0.95 red-line), `peaks session checkpoint` is NOT enough on its own — the LLM must also fire `peaks code auto-compact` (or wait for the in-band PreToolUse hook at ratio ≥ 0.95 to compact the runner itself). See:
|
|
75
|
+
When the runner crosses the v2.13.0 auto-compact thresholds (0.80 auto-fire / 0.85 pre-compact / 0.95 red-line), `peaks session checkpoint` is NOT enough on its own — the LLM must also fire `peaks code auto-compact` (or wait for the in-band PreToolUse hook at ratio ≥ 0.95 to compact the runner itself). See:
|
|
76
76
|
|
|
77
77
|
- `peaks code auto-compact` — orchestrator that writes the convergence plan + dispatches the compact pathway
|
|
78
78
|
- `peaks code auto-compact` — the PreToolUse hook entrypoint fired by `.claude/settings.local.json` (slice 2026-07-02-auto-compact-zero-pause)
|
|
79
79
|
- `.peaks/memory/2026-06-27-auto-compact-design.md` — zero-human-intervention design rationale
|
|
80
80
|
|
|
81
|
-
The two surfaces compose: `peaks session checkpoint` persists the context state, `peaks code auto-compact` collapses the runner's window. The LLM fires both
|
|
81
|
+
The two surfaces compose: `peaks session checkpoint` persists the context state, `peaks code auto-compact` collapses the runner's window. The LLM fires both from the 0.80 auto-fire line up (that is the tier `peaks skill presence` reports first); the 0.85–0.95 band is the "already fired" zone, and the hook fires alone at ≥ 0.95.
|
|
@@ -299,6 +299,9 @@ peaks code emit-handoff --project <repo> --job-id <jid> --json
|
|
|
299
299
|
|
|
300
300
|
# v3.1.2 forced auto-compact: when --enforce-job-mode is set OR
|
|
301
301
|
# job-shape.json says isJob=true, ≥0.85 is MANDATORY auto-compact.
|
|
302
|
+
# The trigger line is actually 0.80, not 0.85: `peaks skill presence`
|
|
303
|
+
# reports action='auto-fire' from ≥0.80 and that tier is already mandatory
|
|
304
|
+
# in every mode, so context-now's 0.85 is the *second* line to arrive.
|
|
302
305
|
# Code MUST call this without confirmation under Job mode.
|
|
303
306
|
peaks code context-now --project <repo> --enforce-job-mode --json
|
|
304
307
|
peaks code auto-compact --project <repo> --json
|
|
@@ -15,8 +15,8 @@ the lookup table the LLM must consult in lieu of intuition.
|
|
|
15
15
|
|
|
16
16
|
| # | Signal source | Threshold | File / CLI | LLM action |
|
|
17
17
|
|---|---|---|---|---|
|
|
18
|
-
| 1 | prompt size (main session) | 50% / 75% / 80% / 90% | `src/services/context/threshold.ts`; probe via `peaks code context-now` | soft-warn at 50%; consider compact at 75%; MUST NOT auto-compact mid-batch (D6.e);
|
|
19
|
-
| 2 | auto-compact zone | 0.85 pre-compact / 0.95 red-line | `src/services/code/auto-compact-orchestrator.ts`; `--enforce-job-mode` flag | Auto-fires `peaks code auto-compact`; LLM MUST NOT prompt user to compact (zero-pause contract v2.13.0) |
|
|
18
|
+
| 1 | prompt size (main session) | 50% / 75% / 80% / 90% | `src/services/context/threshold.ts`; probe via `peaks code context-now` | soft-warn at 50%; consider compact at 75%; MUST NOT auto-compact mid-batch (D6.e); ≥ 0.80 (`auto-fire`) ⇒ MANDATORY `peaks code auto-compact` |
|
|
19
|
+
| 2 | auto-compact zone | 0.80 auto-fire / 0.85 pre-compact / 0.95 red-line | `src/services/code/auto-compact-orchestrator.ts`; `--enforce-job-mode` flag | Auto-fires `peaks code auto-compact`; the 0.80 `auto-fire` tier is the one that fires first (`peaks skill presence` reports it); LLM MUST NOT prompt user to compact (zero-pause contract v2.13.0) |
|
|
20
20
|
| 3 | sub-agent dispatch prompt size | 50% / 75% / 80% | `src/services/context/context-guard.ts`; `peaks sub-agent-dispatch-guard` PreToolUse hook | soft-warn at 50%; CONTEXT_NEAR_LIMIT at 75%; hard-reject at 80% (CLI + hook double-guard) |
|
|
21
21
|
| 4 | statusline compact bar | visual | `src/services/compact-statusline/compact-statusline-service.ts` | ambient UI; surfaces queued/preparing/compacting/verifying/completed/failed/stalled |
|
|
22
22
|
| 5 | in-flight batch deferral | D6.e | `src/services/code/auto-compact-modes.ts` | defer compact until batch lands (NOT "new session") |
|
|
@@ -44,6 +44,8 @@ LLM senses context pressure
|
|
|
44
44
|
│ ├─ 0.75 ≤ ratio < 0.85 → compact-zone candidate
|
|
45
45
|
│ │ ├─ Job mode → MUST auto-compact now
|
|
46
46
|
│ │ └─ non-Job → wait for next idle turn, then compact
|
|
47
|
+
│ ├─ 0.80 ≤ ratio < 0.85 → auto-fire zone; `peaks skill presence` reports
|
|
48
|
+
│ │ `action: 'auto-fire'` → auto-compact MUST fire (do NOT wait for 0.85)
|
|
47
49
|
│ ├─ 0.85 ≤ ratio < 0.95 → pre-compact zone; auto-compact MUST fire
|
|
48
50
|
│ └─ ratio ≥ 0.95 → red-line; compact REQUESTED, dispatch NOT blocked (Karpathy §4)
|
|
49
51
|
│ keep working, re-probe, do not stall
|
|
@@ -31,7 +31,7 @@ After autonomous work (RD, QA, security, perf), invoke peaks-final-review for 4-
|
|
|
31
31
|
|
|
32
32
|
### Peaks-Loop Step N+2: Main-session context monitor (D6 + slice 2026-07-02)
|
|
33
33
|
|
|
34
|
-
After every 4th tool call, probe via `peaks code context-now --project <repo> --json`. Thresholds: 50% / **0.85 pre-compact / 0.95 red-line** (v2.13.0). **
|
|
34
|
+
After every 4th tool call, probe via `peaks code context-now --project <repo> --json`. Thresholds: 50% / **0.80 auto-fire / 0.85 pre-compact / 0.95 red-line** (v2.13.0). **At ≥ 0.80 (`auto-fire`, the tier `peaks skill presence` reports every turn) auto-compact is MANDATORY in every mode** (`peaks code auto-compact`). Pass `--enforce-job-mode` for single-rid. **≥ 0.95** red line: next Bash/Task fires `peaks code auto-compact`. **Karpathy §4 exception**: compact red line keeps runner alive — zero-intervention wins; LLM MUST NOT ask user to run `/compact`. Honor `--in-flight-batch` (D6.e).
|
|
35
35
|
|
|
36
36
|
### Peaks-Loop Step 0: Anchor the workflow (MANDATORY FIRST ACTIONS — no bail-out)
|
|
37
37
|
|
|
@@ -65,7 +65,7 @@ The CLI is a **recorder + gate** for job-shape (the LLM judges). LLM calls `peak
|
|
|
65
65
|
|
|
66
66
|
**v3.1.2 mechanical gates** (recorder-only was bypassed twice):
|
|
67
67
|
|
|
68
|
-
PreToolUse hook on `peaks code gate-step-08`; size-fear ban on `peaks code emit-handoff`; forced auto-compact
|
|
68
|
+
PreToolUse hook on `peaks code gate-step-08`; size-fear ban on `peaks code emit-handoff`; forced auto-compact from ≥ 0.80 (`auto-fire`, every mode); on-disk slice progress via `peaks job checkpoint` (canonical reader `peaks job progress --job-id <jid>`). Full mechanics (judgement criteria, hook table, backup-regex rationale, hook wiring) at `references/step-0-8-gate.md`.
|
|
69
69
|
|
|
70
70
|
### Peaks-Loop Step 0.81 — per-slice 收尾
|
|
71
71
|
|
|
@@ -45,7 +45,7 @@ Refuses to emit a final handoff while `remaining > 0` under Job mode. Pass `--fo
|
|
|
45
45
|
|
|
46
46
|
### 3. Forced auto-compact — `--enforce-job-mode`
|
|
47
47
|
|
|
48
|
-
`peaks code context-now --enforce-job-mode` (auto-enabled when `job-shape.json` says `isJob=true`) returns `action: 'auto-compact-now'` at ≥ 0.85; Code MUST call `peaks code auto-compact` without confirmation.
|
|
48
|
+
`peaks code context-now --enforce-job-mode` (auto-enabled when `job-shape.json` says `isJob=true`) returns `action: 'auto-compact-now'` at ≥ 0.85; Code MUST call `peaks code auto-compact` without confirmation. Note the earlier line: `peaks skill presence` reports `auto-fire` from ≥ 0.80, and that tier is already mandatory — the 0.80 line, not 0.85, is the one that fires first.
|
|
49
49
|
|
|
50
50
|
### 4. On-disk slice progress — `progress.json`
|
|
51
51
|
|
|
@@ -39,22 +39,22 @@ stays IDE-agnostic.
|
|
|
39
39
|
**Command**:
|
|
40
40
|
|
|
41
41
|
```
|
|
42
|
-
peaks sub-agent dispatch <role> --prompt <text> --graph-node <nid> [--workflow-id <wid>] [--request-id <rid>] [--session-id <sid>] [--project <repo>] [--batch-id <uuid>] --json
|
|
42
|
+
peaks sub-agent dispatch <role> --prompt <text> [--graph-node <nid>] [--workflow-id <wid>] [--request-id <rid>] [--session-id <sid>] [--project <repo>] [--batch-id <uuid>] --json
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
> **`--graph-node` is
|
|
46
|
-
>
|
|
47
|
-
>
|
|
45
|
+
> **`--graph-node` is OPTIONAL (relaxed from the 4.0.8 RD §4 D4c requirement).**
|
|
46
|
+
> Slice 4.0.8 made it a `.requiredOption`; `provisionDispatchNode`
|
|
47
|
+
> (`src/services/workflow/provision-dispatch-node.ts`) relaxed it because the
|
|
48
|
+
> requirement was enforced but never validated and the recovery it prescribed
|
|
49
|
+
> was unwalkable: `peaks workflow node prepare` never calls `writeGraph`, so
|
|
50
|
+
> the node it reports is never persisted, and no CLI verb created the graph it
|
|
51
|
+
> reads. Its only observable effect was to block dispatch in every project
|
|
52
|
+
> without graph infrastructure.
|
|
48
53
|
>
|
|
49
|
-
>
|
|
50
|
-
>
|
|
51
|
-
>
|
|
52
|
-
>
|
|
53
|
-
>
|
|
54
|
-
> then dispatch with `--graph-node <nid> --workflow-id <wid>`. Omitting
|
|
55
|
-
> `--graph-node` rejects with `PEAKS_GRAPH_NODE_REQUIRED`; a node that is
|
|
56
|
-
> not prepared (or has the wrong kind) rejects with
|
|
57
|
-
> `PEAKS_GRAPH_NODE_NOT_PREPARED` / `PEAKS_GRAPH_NODE_KIND_INVALID`.
|
|
54
|
+
> Omitting both flags now provisions a `dispatch-<role>-<stamp>` node and the
|
|
55
|
+
> graph on demand, so **plain `peaks sub-agent dispatch rd --prompt '<task>' --request-id <rid> --project . --json` succeeds**. Passing
|
|
56
|
+
> `--graph-node <nid> --workflow-id <wid>` binds to a node you control and
|
|
57
|
+
> persists it into `graphs/<wid>.json`.
|
|
58
58
|
|
|
59
59
|
**Envelope** (AC-8) — **2.1.0** (slice 2026-06-23-audit-4th #E1):
|
|
60
60
|
|
|
@@ -356,13 +356,13 @@ grown unboundedly without this fix).
|
|
|
356
356
|
When writing a SKILL.md that fans out sub-agents:
|
|
357
357
|
|
|
358
358
|
1. Use `peaks sub-agent dispatch <role>` (never `Task(...)`).
|
|
359
|
-
2.
|
|
360
|
-
|
|
361
|
-
|
|
359
|
+
2. Graph binding is OPTIONAL — omit `--graph-node` and the CLI provisions a
|
|
360
|
+
node on demand. Pass `--graph-node <nid> --workflow-id <wid>` only when you
|
|
361
|
+
need the dispatch bound to a node you control (and note the node is
|
|
362
|
+
persisted by `provisionDispatchNode`, not by `peaks workflow node prepare`).
|
|
362
363
|
3. Issue all dispatches in a single message; the LLM will fire all
|
|
363
364
|
returned toolCalls in parallel.
|
|
364
|
-
4. Pass `--
|
|
365
|
-
`--request-id` and `--session-id` (or omit and let the CLI resolve the
|
|
365
|
+
4. Pass `--request-id` and `--session-id` (or omit and let the CLI resolve the
|
|
366
366
|
active session).
|
|
367
367
|
5. The sub-agent prompt **must** include the heartbeat instruction
|
|
368
368
|
(30 s cadence; override via `heartbeatIntervalSec` if needed).
|
|
@@ -445,7 +445,7 @@ peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate swarm-
|
|
|
445
445
|
|
|
446
446
|
## Detached Mode (Phase A, slice 2026-08-10)
|
|
447
447
|
|
|
448
|
-
`peaks sub-agent dispatch <role> --prompt <text> --graph-node <nid> --workflow-id <wid> --request-id <rid> --mode detached --vendor claude|codex|copilot [--no-throttle --max-concurrent <N>] --json` spawns a real OS process independent of the orchestrator IDE session. `--graph-node`
|
|
448
|
+
`peaks sub-agent dispatch <role> --prompt <text> --graph-node <nid> --workflow-id <wid> --request-id <rid> --mode detached --vendor claude|codex|copilot [--no-throttle --max-concurrent <N>] --json` spawns a real OS process independent of the orchestrator IDE session. `--graph-node` is optional here too — the relaxation is on the shared option table, not on the in-process path only.
|
|
449
449
|
|
|
450
450
|
- **Cross-platform spawn**: Windows uses `DETACHED_PROCESS` + `CREATE_NEW_PROCESS_GROUP`; POSIX uses `setsid` + `nohup`. Implementation: `packages/peaks-loop-internal-runtime/src/process-supervisor.ts`.
|
|
451
451
|
- **Minimum-context prompt**: `PromptBuilder` emits a 5–8KB slice `{rid, role, vendor, files, refs}` plus the verbatim `<peaks-auto-compact>` marker. The forbidden marker `@@@ORCHESTRATOR_SESSION_HISTORY_BOUNDARY@@@` MUST NOT appear in any prompt (unit-tested; regression fails vitest).
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `peaks context <sub>` — CLI surface for the ContextBuilder.
|
|
3
|
-
* Per spec §4.1 — these commands are the only sanctioned entry point;
|
|
4
|
-
* peaks-rd / peaks-qa / peaks-mut invoke them programmatically.
|
|
5
|
-
*/
|
|
6
|
-
import { Command } from 'commander';
|
|
7
|
-
import type { DocFetcher } from '../../services/context/doc-retriever.js';
|
|
8
|
-
export interface ContextCommandsOptions {
|
|
9
|
-
readonly fetcher: DocFetcher;
|
|
10
|
-
}
|
|
11
|
-
export declare function createContextCommands(options: ContextCommandsOptions): Command;
|