loci-sync

A synchronization command for a project and the Loci brain index, where the brain index stores reusable project knowledge. It distills conversation notes and updates lightweight project summaries.

In plain words
What is it for?
Use it to save session information locally, sync selected summaries to a connected Loci brain, preview changes with dry-run, or run without remote index updates.
Why use it?
It keeps important decisions and project memory available in the right place instead of leaving them only in a chat session.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/codesstar/loci/loci-sync
Clone the repo
git clone --depth 1 https://github.com/codesstar/loci
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,561 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01561
Opus 5 $0.00000 $0.00781
Sonnet 5 $0.00000 $0.00312
Haiku 4.5 $0.00000 $0.00156

Measured 2d ago against content hash 7528b7fd6677, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

loci-sync scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

templates/commands/loci-sync.md · 125 lines

How it starts

The opening of the file, as written. The whole thing — 125 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Sync information between this project and the Loci brain index. Keep full project memory in the project repo.

This command works in both the brain and connected projects. It combines two operations into one: session distillation (persist what was discussed) and lightweight project indexing (only summaries that should matter outside the repo).

Flags:

  • --local — Only distill and store locally, skip brain index updates
  • --dry-run — Show what would be stored/synced without executing

Steps:

  1. Detect context: Check if current directory is a brain (has .loci/ with me/identity.md) or a connected project (has .loci/memory.md). If neither, do not introduce a command. Say: "这个项目还没有本地记忆。要不要我帮你在这里留个记忆?" If the user says yes, follow the "Connecting a serious project" rule in the main instructions.

  2. Read config:

    • Brain: read .loci/config.yml
    • Connected project: read .loci/memory.md frontmatter to get the brain path
    • If no config found, use defaults (auto mode, balanced distillation, local-first project memory).

If running in a Brain:

  1. Distill (session → files): a. Review the current conversation for new information worth storing b. Apply Distillation settings (verbose/balanced/minimal) to compress c. If --dry-run: list what would be stored, then stop d. Write distilled info to the appropriate brain files:

    • tasks → guarded task writer
    • decisions → decisions/
    • fresh personal reflections → me/insights.md
    • stable values/principles → me/values.md
    • reusable lessons/practices → me/learned.md
    • wellbeing/state changes → me/wellbeing.md
    • actual identity/value/behavior evolution → update the current file and append old/new/reason to me/evolution.md
    • external material → references/
  2. Index update (skip if --local): a. If the stored item is a project-level [insight] or [milestone], update the relevant one-line entry in projects/index.md b. Do not copy full project memory into the brain. Read the project repo when detail is needed. c. Respect Privacy rules — never index blocked categories

  3. Refresh project indexes: a. Read projects/index.md b. For any relevant project mentioned in the current conversation, open that repo's .loci/memory.md c. Do not scan every project automatically unless the user asks

  4. Show summary:

    Sync complete.
    
    Stored: X items (tasks: 2, decisions: 1, insights: 1)
    Indexed: Y project summaries
    Refreshed: Z project dossiers
    
    [List of stored items with destinations]
    [List of refreshed project sources]
    

Read the full file on GitHub · 125 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 125 lines · 0 tokens per session scan A 7528b7fd6677

Subscribe to this mod's changes

loci-sync is a command published in the GitHub repository codesstar/loci (99 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,561 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.