Commit graph

4168 commits

Author SHA1 Message Date
Mikael Hugo
6fee7e60c8 fix: warm discovery backed providers 2026-05-05 17:05:44 +02:00
Mikael Hugo
c6fe3b2b79 fix: restrict visible aggregate providers 2026-05-05 16:50:05 +02:00
Mikael Hugo
aeea733cd6 fix: expose sf-scoped providers 2026-05-05 16:42:36 +02:00
Mikael Hugo
ab6cad4c84 fix: clean provider surfaces and core build 2026-05-05 16:31:53 +02:00
Mikael Hugo
4c98cb8c33 fix: make autonomous mode canonical 2026-05-05 15:42:10 +02:00
Mikael Hugo
55e7dd0e02 fix: clean generated harness residue 2026-05-05 15:04:34 +02:00
Mikael Hugo
2d9c2018af chore: clean repo quality gates 2026-05-05 14:55:11 +02:00
Mikael Hugo
00a118ea71 chore: commit current workspace state 2026-05-05 14:46:18 +02:00
Mikael Hugo
f11c877224 style: format repository with biome 2026-05-05 14:31:16 +02:00
Mikael Hugo
3af4185b20 fix: make sift the codebase indexer 2026-05-05 14:27:03 +02:00
Mikael Hugo
3ba2f8a501 fix: harden startup doctor and tool schemas 2026-05-05 14:03:36 +02:00
Mikael Hugo
00c9a1e0b5 fix: use bare slice directories for record promotion 2026-05-05 13:37:25 +02:00
Mikael Hugo
ee836142ed fix: harden sift codebase indexing 2026-05-05 13:31:35 +02:00
Mikael Hugo
5b9355fa74 feat: add milestone schedule integration 2026-05-05 12:31:13 +02:00
Mikael Hugo
8571ef702d fix(schedule): snooze keeps status pending so items re-fire
- snoozeItem: write status:"pending" + snoozed_at (audit trail) instead
  of status:"snoozed", which was invisible to findDue/findUpcoming
- findDue/findUpcoming: include status==="snoozed" for backward compat
  with any pre-existing snoozed entries in the store
- listItems default filter: show snoozed entries (they are active)
- _findEntry: remove dead exact-match branch (exact ⊆ startsWith)
- ScheduleEntry typedef: add optional snoozed_at field
- Tests: add coverage for snoozed-entry visibility in findDue,
  findUpcoming, and the list command

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 01:38:44 +02:00
Mikael Hugo
d4b3e0f2b0 feat(schedule): add lightweight due-items banner to loader.ts 2026-05-05 01:37:51 +02:00
Mikael Hugo
7e1883844a feat(schedule): auto-dispatch rule in DISPATCH_RULES 2026-05-05 01:34:50 +02:00
Mikael Hugo
94ba38bdd6 feat(schedule): launch banner, headless query field, auto_dispatch type 2026-05-05 01:30:04 +02:00
Mikael Hugo
a3f76d2679 docs: add BACKLOG.md with M009 promote-only adoption review
Tracks a future review item gated on M010 (schedule system) — two
weeks after M009 closes, assess promote-only rule adoption.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 01:22:10 +02:00
Mikael Hugo
c3e9296986 fix(types): restore hand-written d.ts ambient declarations
Previous fix commit (e0d1352c4) only updated .gitignore to allow
src/resources/extensions/**/*.d.ts but did not actually re-commit
the file contents that were deleted in snapshot 405381985. Restoring
from bcf79a713 (the latest version with all exported symbols).

Files restored:
- remote-questions/config.d.ts
- search-the-web/url-utils.d.ts
- sf/agentic-docs-scaffold.d.ts
- sf/code-intelligence.d.ts
- sf/doc-checker.d.ts
- sf/doctor.d.ts
- sf/gitignore.d.ts
- sf/native-git-bridge.d.ts
- sf/paths.d.ts
- sf/preferences-models.d.ts
- sf/preferences.d.ts
- sf/repo-identity.d.ts
- sf/trace-collector.d.ts
- sf/types.d.ts

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 01:19:05 +02:00
Mikael Hugo
77e429a088 feat(schedule): CLI commands add/list/done/cancel/snooze/run + wiring 2026-05-05 01:18:02 +02:00
Mikael Hugo
b92d7bc96b sf snapshot: pre-dispatch, uncommitted changes after 33m inactivity 2026-05-05 01:11:49 +02:00
Mikael Hugo
d3954ff529 sf snapshot: pre-dispatch, uncommitted changes after 30m inactivity 2026-05-05 00:38:05 +02:00
Mikael Hugo
342871e85e docs: clarify guided planning artifacts 2026-05-05 00:07:48 +02:00
Mikael Hugo
959e15ef42 fix: wire bundled extension inventory 2026-05-05 00:04:53 +02:00
Mikael Hugo
47c806d733 fix: version sf extension runtime sources 2026-05-04 23:27:20 +02:00
Mikael Hugo
56aaf5bb45 sf snapshot: pre-dispatch, uncommitted changes after 42m inactivity 2026-05-04 22:41:07 +02:00
Mikael Hugo
4053819854 sf snapshot: pre-dispatch, uncommitted changes after 41m inactivity 2026-05-04 21:59:01 +02:00
Mikael Hugo
b8a5a01de4 refactor(skills): remove acquiring-skills bundled skill
The acquiring-skills skill was a personal developer workflow with
hardcoded paths that did not apply to general sf users.

Rationale for removal rather than generalization:
- SF bundled skills are already generic and installed for all users.
- External skills are consumed via the Anthropic marketplace.
- Per-project custom skills are covered by the creating-skills skill.

Resolves self-feedback sf-mookqlyr-snco79.
2026-05-04 21:17:59 +02:00
Mikael Hugo
66c7d6a47e refactor(skills): generalize acquiring-skills and remove personal references
Replace the developer-specific acquiring-skills skill with a generic
version that any SF user can follow.

Changes:
- Removed all personal references (/home/mhugo/code/, mikki-bunker,
  ace-coder, letta-workspace, dr-repo, singularity-package-intelligence)
- Replaced Method 2 (rsync from local repos) and Method 3 (rsync from
  bunker) with a generic local-project porting workflow
- Replaced Trusted Sources table with only public, universally
  accessible repositories (anthropics/skills, singularity-forge)
- Kept all safety rules (inspect scripts, no curl|bash, untrusted
  sources require approval)
- Kept the Adaptation Checklist for porting foreign skills to sf
- References the Anthropic skills marketplace as the primary source

Resolves self-feedback sf-mookqlyr-snco79.
2026-05-04 21:13:35 +02:00
Mikael Hugo
6037407c99 fix(auto): reconcile stale complete-slice runtime records at bootstrap
Prevents pi runtime flow-audit from emitting false-positive stale-dispatch
warnings for slices that completed successfully on retry.

Problem: when a complete-slice unit is cancelled (e.g. provider quota error)
and then retried successfully, the prior cancelled journal/runtime state can
still trigger a flow-audit warning on the next session start. The detector
reads the cancelled unit-end event but does not check for later successful
retries or existing artifact files (#sf-moqv5o7h-vaabu6).

Fix: at auto-mode bootstrap, after cleanStaleRuntimeUnits, run a new
reconcileStaleCompleteSliceRecords() pass that:
- Lists all unit runtime records for complete-slice units
- Filters for terminal non-completed states (cancelled, failed, stale,
  runaway-recovered)
- Checks DB slice status === 'complete'
- Checks SUMMARY.md exists with valid completed_at frontmatter
- Clears stale runtime records that pass both checks

Files changed:
- src/resources/extensions/sf/unit-runtime.js: add reconcileStaleCompleteSliceRecords
- src/resources/extensions/sf/auto-start.js: call it after cleanStaleRuntimeUnits
- src/tests/unit-runtime-reconcile.test.ts: unit tests for the new function
2026-05-04 20:45:33 +02:00
Mikael Hugo
ed4a4bc93a chore: commit current worktree state 2026-05-04 19:28:39 +02:00
Mikael Hugo
e0d1352c43 fix(types): add TypeScript declarations for JS modules with gitignore exception
Add comprehensive .d.ts files for all JS modules imported by TypeScript source.
Update .gitignore to allow src/resources/extensions/**/*.d.ts (hand-written
declarations for JS modules) while keeping src/**/*.d.ts ignored for compiled output.

- preferences: 16 exported functions
- preferences-models: 20 exported functions including isProviderModelAllowed
- gitignore: 6 exported functions
- agentic-docs-scaffold: SCAFFOLD_FILES + ensureAgenticDocsScaffold
- doc-checker: DocCheckResult interface with summary stub/missing counts
- code-intelligence: 21 exports including backend constants, optional prefs param
- native-git-bridge: 50+ git operations
- paths: 30+ path resolution functions
- repo-identity: 9 exported functions
- trace-collector: Span/Trace interfaces + 12 functions
- types: SFState interface with activeMilestone/phase/nextAction
- doctor: 5 exported functions including runSFDoctor
- url-utils: 8 exported functions
- config: RemoteConfig interface + 4 functions
2026-05-04 19:08:07 +02:00
Mikael Hugo
bcf79a7136 fix(types): update .d.ts declarations with all exported symbols
Update all TypeScript declaration files to include every exported function,
const, and interface from their corresponding .js modules. Fixes TS2305
errors for missing exports.

- preferences: add all 16 exported functions
- preferences-models: add all 20 exported functions
- gitignore: add all 6 exported functions
- agentic-docs-scaffold: add SCAFFOLD_FILES const
- doc-checker: add formatDocCheckReport
- code-intelligence: add all 21 exports including backend constants
- native-git-bridge: add all 50+ exported git operations
- paths: add all 30+ path resolution functions
- repo-identity: add all 9 exported functions
- trace-collector: add Span/Trace interfaces and all 12 functions
- types: add SFState interface
- doctor: add both exported functions
- url-utils: add all 8 exported functions
- config: add RemoteConfig interface and all functions
2026-05-04 19:02:04 +02:00
Mikael Hugo
33383ed53a fix(types): add TypeScript declarations for JS modules
Add .d.ts files for all JS modules imported by TypeScript source to resolve
TS7016 errors. Files are force-added because src/**/*.d.ts is gitignored.

- preferences, preferences-models, gitignore, agentic-docs-scaffold
- doc-checker, code-intelligence, native-git-bridge, paths, repo-identity
- types, trace-collector, doctor, url-utils, config
2026-05-04 18:57:34 +02:00
Mikael Hugo
ccdd3027ab perf(read): stream lines when offset/limit provided to avoid loading entire file
When offset or limit are specified, use Node.js readline streaming instead of
loading the entire file into memory. This fixes the truncation issue for large
files (>50KB) where the read tool would return truncated content even when
requesting a small slice.

- Add readLinesStreamed() for memory-efficient line reading
- Add countLines() for total line count without full read
- Use streaming path when offset !== undefined || limit !== undefined
- Keep existing full-file read path when no offset/limit specified
- Add tests for streaming behavior with large files

Fixes the long-standing issue where reading large files like src/headless.ts
(~50KB) with offset/limit would still hit truncation limits.
2026-05-04 15:20:16 +02:00
Mikael Hugo
362d766680 sf snapshot: uncommitted changes after 120m inactivity 2026-05-04 14:46:50 +02:00
Mikael Hugo
abe34084a4 sf snapshot: uncommitted changes after 67m inactivity 2026-05-04 12:46:41 +02:00
Mikael Hugo
7c348704ec sf snapshot: uncommitted changes after 111m inactivity 2026-05-04 11:38:58 +02:00
Mikael Hugo
0037f44677 sf snapshot: pre-dispatch, uncommitted changes after 83m inactivity 2026-05-04 09:47:30 +02:00
Mikael Hugo
8c66c11131 fix(sf): prevent phantom work from stale file paths in task plans
Adds three layers of defense against the M008/S03 failure mode where
bug-hunt findings referenced .ts files that had been deleted in a prior
corrupted snapshot commit (f712c339b), but .js versions with fixes survived.

1. Prompt-level safeguards:
   - research-slice.md: researchers must verify file existence before listing
     paths in findings
   - plan-slice.md: planners must confirm files exist before including them
     in task plans
   - execute-task.md: executors must verify files exist before editing;
     escalate as blocker if missing

2. Runtime pre-flight validation:
   - system-context.js: validateTaskPlanFiles() extracts backtick-wrapped
     paths from task plans and checks existence before dispatch
   - Missing files trigger a warning injected into the execute-task prompt
   - Logs warning for observability

This prevents the research→plan→execute pipeline from propagating stale
file paths that cause phantom work, runaway guard intervention, and
flow-audit failures.

Fixes: sf-moqgvdi7-mxc1sr (flow-audit:repeated-milestone-failure)
Related: M008/S03 bug-hunt cluster
2026-05-04 08:24:04 +02:00
Mikael Hugo
bffd6c22fc sf snapshot: pre-dispatch, uncommitted changes after 42m inactivity 2026-05-04 02:34:07 +02:00
Mikael Hugo
061985b226 fix(sf): runaway guard treats token count as secondary signal
Token count now only triggers a warning when accompanied by a primary
signal (high tool calls, long elapsed time, or many changed files).
This prevents false positives on units doing real work with large
context models, where 25+ tool calls can legitimately burn 1M+ tokens.

Also renames 'session tokens' to 'unit tokens' in guard messages to
clarify that the metric is delta-from-unit-start, not cumulative.

Fixes sf-moqewawp-ijwjjt
2026-05-04 01:51:33 +02:00
Mikael Hugo
f712c339b3 sf snapshot: pre-dispatch, uncommitted changes after 1497m inactivity 2026-05-04 01:22:39 +02:00
Mikael Hugo
6384c5b44c test(sf): integration test — graph-boost lifts neighbor through full pipeline
Pure-function tests for applyRelationBoost (55b14c3f7) cover the
math, but the wired-through path (createMemoryRelation → boost picked
up by getRelevantMemoriesRanked → reordered output) had no
end-to-end test.

New test:
1. Creates memories a, b, c with orthogonal embeddings
2. Mocks gateway to return a query vector aligned only with a
3. Wires a→b with related_to (confidence 1.0)
4. Asserts ranking: a (cosine top) > b (boost from a) > c (unrelated)

Locks the contract that the boost actually fires through the full
pipeline, not just the pure helper. 16 → 17 tests in the file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 00:25:07 +02:00
Mikael Hugo
22109cee6a docs(sf): escalation.ts header lists carry-forward + memory persistence
The header listed "artifact I/O, detection, flag flips, resolution" but
not the carry-forward injection (claimOverrideForInjection /
formatOverrideBlock) or the memory persistence calls now embedded in
both writeEscalationArtifact (continueWithDefault path, b9bff3762
sibling) and resolveEscalation (00c13bc5a). These are load-bearing
behaviors a contributor should know up front.

Also folded the "SF's local ADR-011 is 'Swarm Chat'" disambiguation
note into the header (matches the convention the rest of the
disambiguation sweep set).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 00:22:54 +02:00
Mikael Hugo
ec4dab450b docs(sf): clarify memory-sleeper.ts is NOT part of the memory pipeline
memory-sleeper.ts had no file header and the "memory" prefix is
misleading — it's a runtime tool-output watchdog (detects repeated
bash failures, too-large tool results) that emits steers, completely
unrelated to memory-store / memory-relations / memory-embeddings.

A contributor reading directory listing top-down would reasonably
assume this file participates in the same pipeline as the other
memory-*.ts modules. Header now states the historical naming and
points readers in the right direction.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 00:21:06 +02:00
Mikael Hugo
e10511ce38 docs(sf): memory-embeddings.ts header reflects actual pipeline
The previous header had two stale references:
- "buildMemoryLLMCall pattern, prefers a dedicated embedding-capable
  model" — describes a hook that actually returns null on every call
  (the Pi SDK has no provider-neutral embedding API yet).
- "queryMemoriesRanked falls back to keyword-only scoring" —
  function doesn't exist; the real consumer is
  getRelevantMemoriesRanked, and the fallback is static (confidence
  × hit_count), not keyword.

Updated to describe the actual three-stage read pipeline (cosine →
relation-boost → optional rerank) and the soft-degrade fallback to
static ranking when the gateway is offline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 00:18:46 +02:00
Mikael Hugo
308958453d docs(sf): memory-relations.ts header reflects actual writers + readers
The file header described an aspirational design ("LINK actions
emitted by the memory extractor, or future /sf memory link CLI") that
never matched code reality. As of this session:

Writers shipped:
 (a) applyMemoryActions auto-links co-extracted memories with
     related_to (b9bff3762)
 (b) /sf memory import loads explicit edges from JSON

Read consumers shipped:
 (1) getRelevantMemoriesRanked graph-boost (55b14c3f7)
 (2) sf_graph MCP tool (pre-existing)

Updated the header so a contributor reading top-down sees the
current data flow, not the original plan.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 00:17:03 +02:00
Mikael Hugo
a37737c4af docs: memory-relations.ts is now ranker-live
Updates 23c5de38b (which flagged the table as storage-only) to reflect
that 55b14c3f7 wired the ranker consumer (graph-boost in
getRelevantMemoriesRanked) and b9bff3762 wired the writer
(co-extraction linkage in applyMemoryActions). The graph-aware
pipeline is now end-to-end live, with named relation types,
auto-linking confidence (0.5), intra-pool boost, and damping (0.4).

Honest description for contributors reading top-down.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 00:13:56 +02:00