Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .algo-profile/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Algorithm Profile - EverOS

## Optimization

- [Content-Addressed Manifest Delta Sync](optimization/content-addressed-manifest-delta-sync.md) - O(N) first run, O(Δ) incremental, used in docs/superpowers/specs/2026-05-16-hermes-supergrok-nixos-auth-plane-design.md
- [Bounded Top-K Heap](optimization/bounded-top-k-heap.md) - O(M log K), used in docs/superpowers/specs/2026-05-16-hermes-supergrok-nixos-auth-plane-design.md

## Structures

- [LRU Retrieval Cache](structures/lru-retrieval-cache.md) - O(1) average lookup, used in docs/superpowers/specs/2026-05-16-hermes-supergrok-nixos-auth-plane-design.md
20 changes: 20 additions & 0 deletions .algo-profile/optimization/bounded-top-k-heap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
algorithm: Bounded Top-K Heap
category: optimization
complexity_time: O(M log K)
complexity_space: O(K)
used_in: docs/superpowers/specs/2026-05-16-hermes-supergrok-nixos-auth-plane-design.md
date: 2026-05-16
---

## Why This Was Chosen

When multiple candidate sources are merged, the system only needs the best K snippets, not a full sort of the entire candidate pool. A bounded min-heap keeps the strongest candidates while avoiding the extra cost of sorting low-value items that will never be shown to Hermes.

## Implementation Notes

Use this only at the merge boundary where candidate sets from collection search, local cache, or memory providers are combined. If the source already returns a stable top-k list, the heap can be skipped; otherwise keep the heap small and enforce K as a hard cap.

## Reference

[Heap / Priority Queue](https://github.com/trekhleb/javascript-algorithms)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
algorithm: Content-Addressed Manifest Delta Sync
category: optimization
complexity_time: O(N) first run, O(Δ) incremental
complexity_space: O(N)
used_in: docs/superpowers/specs/2026-05-16-hermes-supergrok-nixos-auth-plane-design.md
date: 2026-05-16
---

## Why This Was Chosen

The xAI knowledge bundle is repo-shaped data, so a manifest keyed by content hash lets the host distinguish unchanged files from changed ones without re-uploading everything. That keeps the initial build linear while making steady-state refreshes proportional to the actual delta instead of the full corpus.

## Implementation Notes

The manifest should store path, content hash, upload state, and a stable bundle hash so a successful upload can become the new baseline atomically. Removed files should be tombstoned rather than silently forgotten, which keeps reconciliation explicit on the next sync run.

## Reference

[Big-O Reference](https://github.com/trekhleb/javascript-algorithms)
20 changes: 20 additions & 0 deletions .algo-profile/structures/lru-retrieval-cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
algorithm: LRU Retrieval Cache
category: structures
complexity_time: O(1)
complexity_space: O(capacity)
used_in: docs/superpowers/specs/2026-05-16-hermes-supergrok-nixos-auth-plane-design.md
date: 2026-05-16
---

## Why This Was Chosen

Repeated Hermes queries against the same collection bundle should reuse prior retrieval results instead of hitting the collection on every turn. An LRU-style cache gives bounded memory with constant-time average lookup and eviction, which matches the read-heavy, hot-query pattern of the remote NixOS lane.

## Implementation Notes

Cache keys should include collection id, bundle hash, normalized query hash, top_k, and filter serialization so different auth contexts do not collide. A TTL layer should sit on top of the LRU policy so stale entries disappear even if the bundle hash does not change.

## Reference

[Data Structures Reference](https://github.com/trekhleb/javascript-algorithms)
64 changes: 64 additions & 0 deletions .claude/hooks/commit-boundary-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
# commit-boundary-check.sh
#
# PreToolUse hook for EverOS. Reads the Claude Code hook payload from stdin,
# self-filters to git-commit / gh-pr-create invocations, and warns when a
# staged change set crosses multiple top-level directories.
#
# Rationale: PR #31 (Raven v2 closure) accidentally bundled 6 independent lanes
# (raven, hermes use-case, skillhub, upstream-return, ci, chores) into one
# 27-commit PR. EverOS convention from that retrospective: one component,
# one PR. This hook is a soft nudge, not a block — cross-cutting work (lint
# sweeps, dependency bumps, .gitignore policy) still proceeds.

set -eu

# Read the hook payload (we don't strictly need to parse it; we just want to
# self-filter and inspect git state). Discard the JSON.
cat >/dev/null 2>&1 || true

# The actual command Claude Code is about to run is exposed via tool input.
# Hook payload format varies across CC versions; we keep this hook scope-safe
# by running unconditionally and only acting when staged changes exist.

# Find the repo root from cwd so the hook works from worktrees too.
repo_root=$(git rev-parse --show-toplevel 2>/dev/null || true)
if [ -z "$repo_root" ]; then
exit 0
fi

cd "$repo_root"

# What is staged for the next commit?
staged=$(git diff --cached --name-only 2>/dev/null || true)
if [ -z "$staged" ]; then
exit 0
fi

# Extract the first path segment of each staged file. Filter out hidden
# top-level dirs (.github, .gitignore, .claude) and the root README so a
# legitimate root-doc fix doesn't trip the warning by itself.
top_dirs=$(echo "$staged" \
| awk -F/ 'NF>1 {print $1} NF==1 {print "_root_"}' \
| sort -u \
| grep -Ev '^(\.github|\.claude|_root_)$' || true)

count=$(echo "$top_dirs" | grep -c . || true)

if [ "${count:-0}" -ge 2 ]; then
cat >&2 <<EOF
⚠ commit-boundary-check: this staged change set crosses $count top-level directories:
$(echo "$top_dirs" | sed 's/^/ - /')

EverOS convention (post-PR-#31 retrospective): one component, one PR.
If these directories are part of the same logical change (e.g., a feature
that genuinely spans methods/ and use-cases/), proceed.
Otherwise, consider:
git reset HEAD <files-from-other-lanes>
and committing the lanes separately.

This is a warning, not a block. Re-run the commit command to proceed.
EOF
fi

exit 0
16 changes: 16 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": ".claude/hooks/commit-boundary-check.sh"
}
]
}
]
}
}
97 changes: 97 additions & 0 deletions .claude/skills/everos-prompts-sync/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
name: everos-prompts-sync
description: Use when editing EverCore prompts under methods/EverCore/src/memory_layer/prompts/en or .../zh, or before opening a PR that touches that tree. Verifies EN/ZH file-name mirror + export-symbol parity, surfaces missing zh files and divergent __all__ lists, and falls back to the existing src/devops_scripts/i18n/i18n_tool.py for code-comment translation drift.
---

# everos-prompts-sync

Keeps `methods/EverCore/src/memory_layer/prompts/{en,zh}/` in lockstep at the
**file-name + symbol-export** layer. Does **not** judge translation quality —
that's a content review.

This skill encodes a recurring EverCore failure mode: a contributor adds a new
prompt constant to `en/` and forgets to add a matching entry under `zh/`,
which silently breaks imports the moment a tenant uses the ZH locale.

## When to invoke

- A diff under `methods/EverCore/src/memory_layer/prompts/` is in flight.
- A new prompt constant is being added to `en/<file>.py`.
- A PR is about to be opened and the prompt tree has any change at all.

If neither side of `prompts/` changed, skip — this skill has nothing to say.

## Procedure

1. **Confirm scope.** From repo root:

```bash
cd methods/EverCore/src/memory_layer/prompts
```

2. **File-name mirror.** Both directories must have identical file lists
(excluding `__pycache__`):

```bash
diff <(ls en/ | grep -v __pycache__) <(ls zh/ | grep -v __pycache__)
```

Any difference is a bug. The fix is **always** to add the missing file to
the side that lacks it. The new file can be a translation OR an explicit
re-export from the other side (the existing convention — see
`zh/agent_prompts.py` for the re-export pattern).

3. **Export-symbol parity.** For each file pair `en/X.py` and `zh/X.py`,
their public exports must be the same set:

```bash
python -c "
import ast, sys, pathlib
for f in pathlib.Path('en').glob('*.py'):
if f.name == '__init__.py': continue
z = pathlib.Path('zh') / f.name
if not z.exists(): print(f'MISSING zh: {f.name}'); continue
def syms(p):
tree = ast.parse(p.read_text())
return {t.id for n in tree.body if isinstance(n, ast.Assign)
for t in n.targets if isinstance(t, ast.Name) and t.id.isupper()}
en_syms, zh_syms = syms(f), syms(z)
if en_syms != zh_syms:
missing_in_zh = en_syms - zh_syms
missing_in_en = zh_syms - en_syms
if missing_in_zh: print(f'{f.name}: zh missing {missing_in_zh}')
if missing_in_en: print(f'{f.name}: en missing {missing_in_en}')
"
```

Re-exports count: `zh/agent_prompts.py` doing
`from ...en.agent_prompts import FOO, BAR` exposes `FOO` and `BAR` as
ZH symbols — that satisfies parity even though the strings live on the EN
side only. The AST scan above catches direct top-level assignments;
re-exports need either a `__all__` list or a wider AST walk if you want to
be exhaustive.

4. **Report.** Output one of:
- `PASS: EN/ZH prompt parity OK` (no further action)
- `FAIL: <list of mismatches>` (fix before merge)

5. **Adjacent tooling.** This skill does **not** translate Chinese code
comments to English. That's `src/devops_scripts/i18n/i18n_tool.py`, which
is already wired into `make lint`. Use that for code-comment drift, this
skill for prompt-constant drift.

## What this skill explicitly does NOT do

- Translate prompts from EN to ZH or vice versa. That's a human/LLM content
task, not a parity check.
- Validate template variables (`{messages_json}`, `{new_count}`, etc.) match
between EN and ZH versions. That's a deeper content check worth a separate
skill if it turns out to be a recurring failure mode.
- Block commits. This is informational. Wire it into a hook only after the
false-positive rate is known to be near zero.

## Recurrence threshold

If the parity check has surfaced the same root cause **three times** (e.g.,
"forgot to add zh re-export when adding a new EN prompt constant"), upgrade
this skill into a pre-commit hook under `.claude/hooks/`.
5 changes: 3 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Summary

<!-- What changed, and why? -->
<!-- What changed, why, and what evidence shows it is correct? -->

## Area

Expand All @@ -15,7 +15,7 @@

## Verification

<!-- List commands run, manual checks, screenshots, or reasons verification was not needed. -->
<!-- List exact commands, checks, screenshots, or a clear reason verification was not needed. -->

```text

Expand All @@ -27,6 +27,7 @@
- [ ] I updated docs, examples, or setup notes when behavior changed.
- [ ] I added or updated tests when the change affects behavior.
- [ ] I did not commit secrets, `.env` files, dependency folders, or generated output.
- [ ] I listed the exact evidence, checks, or blocker for this change.
- [ ] Active relative links in Markdown files resolve.

## Notes for Reviewers
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
Path("methods/README.md"),
Path("benchmarks/README.md"),
Path("AGENTS.md"),
Path(".github/PULL_REQUEST_TEMPLATE.md"),
Path(".github/CONTRIBUTING.md"),
Path(".github/CODE_OF_CONDUCT.md"),
Path(".github/SECURITY.md"),
Expand Down
25 changes: 23 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,10 @@ src/memory_layer/memory_extractor/profile_memory_extractor keep llm merge.py
#LLM related
AGENTS.mk
docs/api_docs/profile_extraction_fields.md
.claude/
# Claude Code: session-local artifacts only; skills/hooks/commands stay versioned
.claude/settings.local.json
.claude/worktrees/
.claude/verify/
.cursor/*

#tmp_data
Expand All @@ -226,4 +229,22 @@ use-cases/**/package-lock.json

# Local playwright + goal state traces
.playwright-mcp/
.goal/
.goal/

# Hermes EverOS Raven SkillHub dogfood artifacts (runtime / local traces)
# These are intentionally generated during dogfood smoke tests but should not pollute git
.kilo/
use-cases/hermes-everos-memory/raven/.local-runs/

# Windburn system artifacts (runtime, not temporary)
.kilo/raven-aliases.zsh

# Multica Ultimate Workbench runtime
.automations/
.automations/**/*.json

# Codex session artifacts (already covered but be explicit)
.codex/.codex-global-state.json
.codex/.codex-global-state.json.bak
.sisyphus/
.gstack/
3 changes: 1 addition & 2 deletions benchmarks/EverMemBench/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ htmlcov/
.cursor/
.DS_Store

# Claude Code
# Claude Code session artifacts (CLAUDE.md is versioned, .claude/ is session-local)
.claude/
CLAUDE.md

# Logs
*.log
Expand Down
Loading
Loading