YeonGyu-Kim
3dd414226b
fix(rules): drop legacy sisyphus rule sources
2026-05-19 14:27:48 +09:00
YeonGyu-Kim
4ea29e2c94
refactor(rules): delegate injectors to rules-core
...
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent )
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai >
2026-05-18 21:27:36 +09:00
YeonGyu-Kim
50ae2e110e
perf(rules-injector): cache match decisions
...
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent )
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai >
2026-05-18 13:30:23 +09:00
YeonGyu-Kim
61890f0857
fix(rules-injector): bound parsed rule cache
...
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent )
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai >
2026-05-18 12:58:41 +09:00
YeonGyu-Kim
46b965b9da
fix(rules-injector): bound matcher cache
...
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent )
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai >
2026-05-18 12:58:41 +09:00
YeonGyu-Kim
1ab1b54ce6
perf(rules-injector): cache compiled glob matchers
...
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent )
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai >
2026-05-18 12:58:41 +09:00
YeonGyu-Kim
271878bcea
perf(rules-injector): cache full candidates and memoize ancestor scans
...
The rule scan cache stored a path[] keyed by (projectRoot|startDir|
skipClaudeUserRules), so two issues stacked up on every tracked tool
call:
- Cache hits still ran safeRealpathSync(realpathSync) and re-derived
isGlobal / distance / isSingleFile for every cached path. That is a
per-candidate sync syscall plus repeated string-prefix walks.
- Sibling files in the same project landed under different startDir
keys, so the entire walk-and-recursive-scan chain repeated even
though every ancestor rule directory was identical.
Store the full RuleFileCandidate[] in the per-call cache so a cache hit
returns immediately with no realpath syscall. Add a separate per-
directory scan cache (getDirScan/setDirScan) keyed by absolute rule
directory path, so two sibling files reuse the same readdir + realpath
work for every shared ancestor.
Microbench (200 files / 20 modules / cached session):
- single sweep: 41.8ms -> 2.5ms (16x)
- 3-pass replay: 88.6ms -> 3.2ms (28x)
Pin the new invariants with two new tests:
- 'does not re-resolve symlinked rule path on cache hit' via a
retargeted directory symlink.
- 'reuses ancestor directory scan for sibling files in the same
project' by deleting the source rule file between the two calls.
2026-05-17 02:06:52 +09:00
YeonGyu-Kim
c25f75294e
perf(rules-injector): cache project root for visited ancestors
...
findProjectRoot was keyed by exact startPath, so sibling files in the
same project repeated the entire upward marker walk. The walk does one
existsSync per marker per ancestor directory, which adds up on every
read/write/edit/multiedit tool call.
Track every directory visited during the walk and seed the cache with
the resolved root for each of them. Subsequent lookups for any
descendant short-circuit to the cached ancestor without re-running
marker probes. Cache invalidation still happens on session.deleted /
session.compacted, so production semantics are unchanged.
Pin the new contract via a sibling-startpath test, and make the
existing finder.test.ts beforeEach explicit about cache state so the
more aggressive cache does not leak between tests.
2026-05-17 02:06:52 +09:00
YeonGyu-Kim
f10f796318
fix(workspace): keep omo and legacy rules compatible
2026-05-16 17:41:49 +09:00
YeonGyu-Kim
cb87385086
test(ci): isolate runtime and rules dependencies
2026-05-15 18:36:32 +09:00
YeonGyu-Kim
b3b2da89c9
test(ci): avoid global module mock leaks
2026-05-15 17:54:59 +09:00
YeonGyu-Kim
9f6d0d2281
docs(agents-md): refresh hierarchical knowledge base for v4.1.2
...
- Bump root AGENTS.md header: 2026-05-14 → 2026-05-15, commit 5ffbe0e24 → 53a740636 , release v4.1.1 → v4.1.2
- Update file counts: 2034 (1337+697) → 2041 (1340+701), LOC ~292k → ~294k
- Fix STRUCTURE: openclaw lives at src/openclaw/ (not src/features/); list more accurate feature modules in the parenthetical
- Clarify interactive_bash gate: tmux binary on PATH via isInteractiveBashEnabled() (not 'tmux enabled')
- Fix docs/reference/features.md hook counts: Tool Guard 14→16, Total base 52→54, total with team-mode 59→61
- Bump 'Generated' date on all 43 subdir AGENTS.md files to 2026-05-15
- Preserve promptAsync injection cautions verbatim (per request)
2026-05-15 13:48:11 +09:00
YeonGyu-Kim
1e7a7600a2
docs(agents-md): regenerate hierarchical AGENTS.md knowledge base for v4.1.1
...
Refresh all AGENTS.md files to reflect codebase state at 5ffbe0e24 (was cd31d2a1a , 197 commits behind).
Key drift corrections across 45 modified + 1 new file:
Root AGENTS.md:
- TS file counts: 1967 -> 2034 in src/ (1337 source + 697 test)
- LOC: 278k -> 292k
- Barrel index.ts: 120 -> 122
- Hook tier composition: 52/59 -> 54/61 (base/with team-mode)
- Tool Guard hooks: 14 -> 16 (add fsync-skip-warning, bash-file-read-guard)
- Add boulder feature, agent-ordering schema, .agents/ directory, v4.1.1 release tag
- Add generated/ directory entry
src/AGENTS.md:
- Subsystem inventory: agents 96->102, hooks 570->581, tools 306->314,
features 389->400, shared 258->278, cli 150->158, plugin 55->56
- LOC totals refreshed for every subsystem
- Schema files: 32 -> 30
src/hooks/AGENTS.md:
- Tier 2 (Tool Guard): 14 -> 16 hooks, add fsyncSkipWarning row
- Total: 52 base / 59 team-mode -> 54 base / 61 team-mode
- zauc-mocks count: 7 -> 5
src/features/AGENTS.md:
- background-agent: 47 -> 57 files, mention archive fallback
- opencode-skill-loader: 33 -> 30
- tmux-subagent: 34 -> 32
src/plugin/AGENTS.md:
- Tool Guard composer count: 14 -> 16
- Aggregator total: 43 -> 45
src/cli/AGENTS.md:
- Add new boulder subcommand (BoulderState inspector)
- Command count: 6 -> 7
NEW: src/features/boulder-state/AGENTS.md
- Document the new Boulder work tracking feature
- Schema v2 with BoulderState/BoulderWorkState/TaskSessionState
- Lifecycle, storage, integration points with atlas/ralph-loop hooks
All other AGENTS.md files: Generated date 2026-05-08 -> 2026-05-14.
2026-05-14 12:57:46 +09:00
YeonGyu-Kim
4da48555ee
fix(plugin): normalize event session ids
...
Handle OpenCode session events that carry the session ID under properties.info.id or properties.info.sessionID so background tasks and continuation hooks do not miss idle/error/delete events.
Add regression coverage for nested session.idle events completing background tasks and waking continuation hooks.
2026-05-12 12:32:26 +09:00
YeonGyu-Kim
838b5ae216
docs(agents): refresh hierarchical AGENTS.md with team-mode coverage
...
Update root + 43 directory-level AGENTS.md files to reflect current state:
- Root AGENTS.md rewritten with accurate counts (1967 TS files, 1304 source +
663 test, 278k LOC, 120 barrel index.ts), 7-step init flow, 5-tier hook
composition, and full Team Mode section (12 team_* tools, eligibility,
storage layout, config gate)
- src/AGENTS.md adds team-mode init step, current per-subdir file/LOC table
- src/tools/AGENTS.md documents conditional gates (team-mode +12, task
system +4, hashline +1, interactive_bash +1, look_at +1) with always-on
baseline of 20
- src/hooks/AGENTS.md splits into 5 tiers + 4 conditional team-mode hooks
- src/features/team-mode/AGENTS.md surfaces 12 tools, eligible agents,
spawn-race-safe invariants, and integration points
- src/features/builtin-skills/AGENTS.md tracks 10 skills incl. team-mode
- src/agents/AGENTS.md, src/plugin/AGENTS.md, src/config/AGENTS.md updated
for team-mode awareness, accurate counts, and current schema field list
- All other AGENTS.md files refreshed to 2026-05-08 generation date
2026-05-08 12:08:42 +09:00
Sisyphus
0ca571e74d
Merge branch 'fix/perf-d03' into fix/perf-omo-in-tree
2026-04-18 14:43:55 +09:00
Sisyphus
1fd678f5ad
Merge branch 'fix/perf-d02' into fix/perf-omo-in-tree
2026-04-18 14:43:48 +09:00
Sisyphus
56d2d2543b
Merge branch 'fix/perf-d10' into fix/perf-omo-in-tree
2026-04-18 14:43:37 +09:00
Sisyphus
52512f226a
fix(rules-injector): cache directory scan results per session
2026-04-18 14:13:51 +09:00
YeonGyu-Kim
443891fdfd
test(rules-injector): cover per-session cache isolation and invalidation
...
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent )
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai >
2026-04-18 14:11:39 +09:00
Sisyphus
bcd7b8e348
fix(rules-injector): memoize project-root lookup per process lifecycle
...
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent )
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai >
2026-04-18 14:11:14 +09:00
Sisyphus
76945bf3c8
test(rules-injector): cover project-root-finder memoization
...
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent )
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai >
2026-04-18 14:09:32 +09:00
Sisyphus
c5b7aa8e4b
test(rules-injector): cover per-session scan caching behavior
2026-04-18 14:09:07 +09:00
Sisyphus
578c49f9c2
fix(rules-injector): skip EXCLUDED_DIRS in recursive rule scanner
2026-04-18 14:08:52 +09:00
Sisyphus
d566d69c37
test(rules-injector): add regression coverage for excluded-dir pruning
2026-04-18 14:07:58 +09:00
YeonGyu-Kim
0c5cd3a1c4
chore(agents): update all AGENTS.md generation dates to 2026-04-11
...
🤖 Generated with OhMyOpenCode assistance
2026-04-11 22:33:22 +09:00
YeonGyu-Kim
ca9b5fde40
test(hooks): update claude-code, comment-checker, and rules-injector tests
...
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent )
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai >
2026-04-10 15:53:33 +09:00
YeonGyu-Kim
5a762ba2ca
fix(hooks): improve rules injector implementation
...
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent )
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai >
2026-04-10 15:53:10 +09:00
YeonGyu-Kim
3697809c11
docs(hooks): update hook inventory to match current 52 hooks
...
- Session: 23 -> 24 (add legacyPluginToast)
- Tool Guard: 12 -> 14 (add bashFileReadGuard, readImageResizer,
todoDescriptionOverride, webfetchRedirectGuard)
- Transform: 4 -> 5 (add toolPairValidator)
- Remove deleted dirs: anthropic-image-context, beast-mode-system
- Add new dirs: legacy-plugin-toast, todo-description-override,
tool-pair-validator, webfetch-redirect-guard
2026-04-05 14:12:30 +09:00
YeonGyu-Kim
a4db240d47
test: localize mock.module setup to fresh imports
2026-04-04 19:49:25 +09:00
Tran Quang
a1a2bb4b07
fix(rules-injector): respect claude_code config for user rule loading
...
When claude_code integration is disabled in oh-my-opencode.json, the
rules-injector now skips loading rules from ~/.claude/rules/ to prevent
Claude Code-specific instructions from leaking into non-Claude agents
(e.g., GPT-5.4 Sisyphus), which causes agent hallucination.
Also adds ~/.sisyphus/rules/ and ~/.opencode/rules/ as OpenCode-native
user rule directories that are always searched regardless of config.
Fixes #2920
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-03-29 10:13:55 +07:00
YeonGyu-Kim
23dcd99c9a
docs(agents): refresh generated AGENTS guides
...
🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode )
2026-03-06 17:59:05 +09:00
YeonGyu-Kim
33d39597ae
docs(agents): regenerate AGENTS.md hierarchy with updated metrics and model configs
...
- 1208→1243 TS files (+35), 143k→155k LOC (+12k)
- Update all agent models: Sisyphus, Hephaestus, Oracle, Librarian, Atlas, Metis, Momus
- Add 6 new hook directories (39→45 dirs): beast-mode-system, hashline-edit-diff-enhancer, anthropic-image-context, task-reminder, compaction-todo-preserver, runtime-fallback
- Update category models: visual-engineering/artistry gemini-3-pro→gemini-3.1-pro
- Add 2 config schema files: fallback-models.ts, runtime-fallback.ts
- Timestamp: 2026-03-02 | Commit: 1c2caa09
🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode )
2026-03-02 23:40:38 +09:00
YeonGyu-Kim
73453a7191
docs(agents): update hook counts 44→46, add hashline-edit documentation
...
- Update root AGENTS.md: hook count 44→46, commit fcb90d92 , generated 2026-02-24
- Update src/AGENTS.md: core hooks 35→37, session hooks 21→23
- Update src/hooks/AGENTS.md: 46 hooks total, add modelFallback/noSisyphusGpt/noHephaestusNonGpt/runtimeFallback, jsonErrorRecovery moved to tool-guard (tier 2)
- Create src/tools/hashline-edit/AGENTS.md (93 lines): documents three-op model, LINE#ID format, execution pipeline
- Refresh timestamps: 2026-02-21→2026-02-24 on 28 files
- Update plugin/AGENTS.md hook composition counts
🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode )
2026-02-25 00:02:05 +09:00
YeonGyu-Kim
b1eccf7425
docs: update all 31 AGENTS.md files with current project state
2026-02-21 04:38:18 +09:00
YeonGyu-Kim
a28e989f83
docs: add module-level AGENTS.md for mcp-oauth, atlas, rules-injector, background-task, call-omo-agent, lsp
...
🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode )
2026-02-19 10:46:40 +09:00
YeonGyu-Kim
d786691260
fix: read anthropic 1m flag from live model cache state
2026-02-17 10:51:01 +09:00
YeonGyu-Kim
b444899153
fix: use model cache context flag for runtime context limits
2026-02-17 10:51:01 +09:00
YeonGyu-Kim
4cf3bc431b
refactor(shared): unify MESSAGE_STORAGE/PART_STORAGE constants into single source
...
- Create src/shared/opencode-storage-paths.ts with all 4 constants
- Update 4 previous declaration sites to import from shared file
- Update additional OPENCODE_STORAGE usages for consistency
- Re-export from src/shared/index.ts
- No duplicate constant declarations remain
2026-02-16 16:13:40 +09:00
YeonGyu-Kim
2b4651e119
test(rules-injector): restore bun mocks after suite
2026-02-14 22:06:39 +09:00
YeonGyu-Kim
75f35f1337
perf(rules-injector): add mtime-based parse cache and dirty-write gate
2026-02-13 11:46:45 +09:00
YeonGyu-Kim
2d22a54b55
refactor(rules-injector): split finder.ts into rule discovery modules
...
Extract rule finding logic:
- project-root-finder.ts: project root detection
- rule-file-finder.ts: rule file discovery
- rule-file-scanner.ts: filesystem scanning for rules
- rule-distance.ts: rule-to-file distance calculation
2026-02-08 16:22:33 +09:00
YeonGyu-Kim
29155ec7bc
refactor: wave 1 - extract leaf modules, rename catch-all files, split index.ts hooks
...
- Split 25+ index.ts files into hook.ts + extracted modules
- Rename all catch-all utils.ts/helpers.ts to domain-specific names
- Split src/tools/lsp/ into ~15 focused modules
- Split src/tools/delegate-task/ into ~18 focused modules
- Separate shared types from implementation
- 155 files changed, 60+ new files created
- All typecheck clean, 61 tests pass
2026-02-08 13:57:26 +09:00
YeonGyu-Kim
f146aeff0f
refactor: major codebase cleanup - BDD comments, file splitting, bug fixes ( #1350 )
...
* style(tests): normalize BDD comments from '// #given' to '// given'
- Replace 4,668 Python-style BDD comments across 107 test files
- Patterns changed: // #given -> // given, // #when -> // when, // #then -> // then
- Also handles no-space variants: //#given -> // given
* fix(rules-injector): prefer output.metadata.filePath over output.title
- Extract file path resolution to dedicated output-path.ts module
- Prefer metadata.filePath which contains actual file path
- Fall back to output.title only when metadata unavailable
- Fixes issue where rules weren't injected when tool output title was a label
* feat(slashcommand): add optional user_message parameter
- Add user_message optional parameter for command arguments
- Model can now call: command='publish' user_message='patch'
- Improves error messages with clearer format guidance
- Helps LLMs understand correct parameter usage
* feat(hooks): restore compaction-context-injector hook
- Restore hook deleted in cbbc7bd0 for session compaction context
- Injects 7 mandatory sections: User Requests, Final Goal, Work Completed,
Remaining Tasks, Active Working Context, MUST NOT Do, Agent Verification State
- Re-register in hooks/index.ts and main plugin entry
* refactor(background-agent): split manager.ts into focused modules
- Extract constants.ts for TTL values and internal types (52 lines)
- Extract state.ts for TaskStateManager class (204 lines)
- Extract spawner.ts for task creation logic (244 lines)
- Extract result-handler.ts for completion handling (265 lines)
- Reduce manager.ts from 1377 to 755 lines (45% reduction)
- Maintain backward compatible exports
* refactor(agents): split prometheus-prompt.ts into subdirectory
- Move 1196-line prometheus-prompt.ts to prometheus/ subdirectory
- Organize prompt sections into separate files for maintainability
- Update agents/index.ts exports
* refactor(delegate-task): split tools.ts into focused modules
- Extract categories.ts for category definitions and routing
- Extract executor.ts for task execution logic
- Extract helpers.ts for utility functions
- Extract prompt-builder.ts for prompt construction
- Reduce tools.ts complexity with cleaner separation of concerns
* refactor(builtin-skills): split skills.ts into individual skill files
- Move each skill to dedicated file in skills/ subdirectory
- Create barrel export for backward compatibility
- Improve maintainability with focused skill modules
* chore: update import paths and lockfile
- Update prometheus import path after refactor
- Update bun.lock
* fix(tests): complete BDD comment normalization
- Fix remaining #when/#then patterns missed by initial sed
- Affected: state.test.ts, events.test.ts
---------
Co-authored-by: justsisyphus <justsisyphus@users.noreply.github.com >
2026-02-01 16:47:50 +09:00
justsisyphus
e48be69a62
fix(rules-injector): remove dead batch code, add .sisyphus support
...
- Remove non-functional batch tool handling (OpenCode has no batch tool)
- Keep working direct tool call path (read/write/edit/multiedit)
- Apply same cleanup to directory-agents-injector and directory-readme-injector
- Add .sisyphus/rules directory support
2026-02-01 15:01:09 +09:00
Sisyphus
bebe6607d4
feat(rules-injector): add GitHub Copilot instructions format support ( #403 )
...
* feat(rules-injector): add GitHub Copilot instructions format support
- Add .github/instructions/ directory to rule discovery paths
- Add applyTo as alias for globs field in frontmatter parser
- Support .github/copilot-instructions.md single-file format (always-apply)
- Filter .github/instructions/ to only accept *.instructions.md files
- Add comprehensive tests for parser and finder
Closes #397
* fix(rules-injector): use cross-platform path separator in calculateDistance
path.relative() returns OS-native separators (backslashes on Windows),
but the code was splitting by forward slash only, causing incorrect
distance calculations on Windows.
Use regex /[/\]/ to handle both separator types.
---------
Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com >
2026-01-02 10:27:33 +09:00
YeonGyu-Kim
7b7c14301e
fix(dcp): correct storage path to match OpenCode's actual location
...
DCP was failing to find session messages because it was looking in
~/.config/opencode/sessions instead of ~/.local/share/opencode/storage.
Unified all hooks to use getOpenCodeStorageDir() for cross-platform consistency.
🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode )
2025-12-28 16:13:50 +09:00
Sisyphus
1b427570c8
feat: add dynamic truncation to rules/readme/agents injectors ( #257 )
...
- Apply dynamic truncation to rules-injector, directory-readme-injector, and directory-agents-injector
- Add truncation notice encouraging users to read full content
- Save context window space while maintaining awareness of complete documentation
- Resolves #221 (part 1)
Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com >
2025-12-26 15:38:28 +09:00
YeonGyu-Kim
d909c09f84
Fix all injection hooks not working with batch tool ( #159 )
...
* Fix AGENTS.md injection not working with batch tool (#141 )
🤖 Generated with assistance of OhMyOpenCode (https://github.com/code-yeongyu/oh-my-opencode )
* Extend batch tool support to rules-injector
The rules-injector hook now captures file paths from batch tool calls, enabling it to inject rules into files read via the batch tool. This ensures all injection hooks work correctly for all file access patterns.
🤖 Generated with assistance of OhMyOpenCode (https://github.com/code-yeongyu/oh-my-opencode )
2025-12-22 01:53:15 +09:00
YeonGyu-Kim
fcdfcd3186
feat(hooks): add rules-injector hook for .cursor/rules and .claude/rules support
...
Implements adaptive rule injection similar to Claude Code's rule system:
- Searches .cursor/rules and .claude/rules directories recursively
- Supports YAML frontmatter with globs, paths, alwaysApply, description
- Adaptive project root detection (finds markers even outside ctx.directory)
- Symlink duplicate detection via realpath comparison
- Content hash deduplication (SHA-256) to avoid re-injecting same rules
- picomatch-based glob pattern matching for file-specific rules
🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode )
2025-12-13 00:35:34 +09:00