@@ -66,41 +66,69 @@ from different bases labeled rather than silently merging citations.
6666
6767## Team knowledge bases
6868
69- Ragmir keeps one private local index per developer. For a Git-backed team, check out the branch the
70- team declared authoritative, configure its upstream once, then use one command:
69+ Ragmir keeps one private local index per developer. For a Git-backed team, the current branch
70+ upstream is the only declared authority. Configure it once, then use one command:
7171
7272``` bash
7373rgr team sync
7474```
7575
76- The command fetches only that upstream branch, compares Git history, and fast-forwards the checked
77- out branch only when the worktree is clean, the local branch has no unpublished commit, and history
78- has not diverged. It then runs incremental ingestion and reports ` current ` , ` updated ` , or one clear
79- action. It never stashes, resets, rebases, creates a merge commit, deletes the active index, or
80- chooses another branch.
76+ ### The everyday workflow
8177
82- This keeps the normal team loop small:
78+ ``` mermaid
79+ flowchart LR
80+ A["Push a reviewable change"] --> B["Merge to the declared upstream"]
81+ B --> C["rgr team sync"]
82+ C --> D["Safe fast-forward, if possible"]
83+ D --> E["Incremental local ingest"]
84+ E --> F["Ready private index"]
85+ ```
8386
84- 1 . A developer pushes a branch and opens or updates the merge request.
87+ 1 . A developer pushes a branch and opens or updates a pull request (or merge request) .
85882 . The team reviews and merges it into the declared upstream branch.
86- 3 . Other developers run ` rgr team sync ` ; safe updates and local reindexing happen together.
89+ 3 . Other developers run ` rgr team sync ` ; source updates and local reindexing happen together.
90+
91+ Git already shows what changed and where review is needed. Ragmir does not add labels, snapshots,
92+ or another source of truth to this normal path.
93+
94+ | Result | What Ragmir does |
95+ | --- | --- |
96+ | ` current ` | Keeps the checked-out sources and local index because they are already aligned. |
97+ | ` updated ` | Fetches only the declared upstream, fast-forwards safely, then ingests changed sources. |
98+ | Needs action | Leaves Git history and the active index untouched, then explains the first next step. |
99+
100+ The automatic path fetches only that upstream and fast-forwards only when the worktree is clean,
101+ the local branch has no unpublished commits, and history has not diverged. It never stashes, resets,
102+ rebases, creates a merge commit, chooses another branch, or deletes the active index.
103+
104+ ### Choose the sync mode
105+
106+ | Need | Command | Effect |
107+ | --- | --- | --- |
108+ | Normal team update | ` rgr team sync ` | Safely update from upstream and ingest incrementally. |
109+ | Keep Git updates manual | ` rgr team sync --no-pull ` | Fetch and compare, but do not change the checked-out branch. |
110+ | Preview only | ` rgr team sync --check ` | Report Git and index state without changing either one. |
111+ | Work offline | ` rgr team sync --no-fetch ` | Use cached Git state and local sources only. |
112+ | Enforce in automation | ` rgr team sync --strict --json ` | Return a typed report and fail unless freshness and readiness are proven. |
87113
88- Use ` --no-pull ` to fetch and compare while keeping branch updates manual. Use ` --check ` to preview
89- without changing the worktree or index, ` --no-fetch ` for an explicitly offline run, ` --strict ` in
90- CI, and ` --json ` for automation. A dirty, ahead, diverged, detached, or untracked branch is never
91- rewritten. A failed fetch keeps the last valid local index available and reports that upstream
92- freshness is unverified. A failed ingestion keeps the previous validated index instead of deleting
93- it first.
114+ Dirty, ahead, diverged, detached, untracked, or no-upstream branches are never rewritten. A failed
115+ fetch keeps the last valid index and marks upstream freshness as unverified. A failed ingestion also
116+ preserves the previous validated index. Resolve the Git state through the normal pull-request or
117+ merge-request workflow, then run the same command again.
94118
95119The ignored ` .ragmir/config.json ` remains local. If every workstation needs the exact same source
96120contract, version a reviewed template in the repository and apply it during setup. ` rgr team sync `
97121synchronizes tracked sources through Git; it does not commit or distribute private Ragmir state.
98122
99- ### Advanced drift diagnostics
123+ ### When exact drift diagnosis is genuinely needed
124+
125+ Snapshots are an advanced fallback for a non-Git authority, such as Drive, or for a specific
126+ configuration and per-file investigation. They are not a prerequisite for ordinary Git teams.
100127
101- Snapshots remain available for a non-Git authority such as Drive, or when the team needs an exact
102- configuration and per-file comparison. They are not part of the normal Git workflow. On one
103- authorized workstation:
128+ <details >
129+ <summary >Compare two authorized snapshots without sharing source text</summary >
130+
131+ On one authorized workstation:
104132
105133``` bash
106134rgr team snapshot --label local --output .ragmir/team/local.json
@@ -135,6 +163,8 @@ ingestion.
135163Do not synchronize ` .ragmir/storage/ ` between active writers. A team bootstrap can call
136164` initProject ` , ` addSourceEntries ` , and ` syncTeamKnowledge ` ; each workstation still owns its index.
137165
166+ </details >
167+
138168### Agent behavior on team drift
139169
140170An agent using the bundled Ragmir skill should run ` rgr team sync --json ` before relying on a
@@ -144,7 +174,7 @@ the last valid local index may be older than upstream. It must never resolve Git
144174reset, rebase, or overwrite source files. Snapshot comparison remains the advanced fallback for an
145175authorized non-Git source or exact drift investigation.
146176
147- ## MCP tools
177+ ## Use Ragmir through MCP
148178
149179The server exposes ` ragmir_status ` , ` ragmir_route_prompt ` , ` ragmir_search ` , ` ragmir_ask ` ,
150180` ragmir_research ` , ` ragmir_expand ` , ` ragmir_audit ` , ` ragmir_evaluate ` , ` ragmir_usage_report ` , and
@@ -164,6 +194,8 @@ The TypeScript `sources({ offset, limit })` method can request later pages direc
164194manifest file snapshot without materializing the complete source list; its default page remains 50
165195files.
166196
197+ ### Retrieve bounded evidence
198+
167199Use compact retrieval first, then pass a returned citation to ` ragmir_expand ` when the agent needs
168200the exact chunk or a bounded neighbor window. Search, ask, research, expansion, audit, and evaluation
169201accept ` maxBytes ` . Variable-size tool and resource JSON is bounded by ` mcpMaxOutputBytes ` and an
@@ -177,6 +209,9 @@ size, audit detail, and returned evaluation case details, while keeping aggregat
177209` ragmir_ask ` returns cited evidence, not a model generated answer. A cloud agent can receive returned
178210passages, so choose that handoff only when it matches the corpus's confidentiality requirements.
179211
212+ <details >
213+ <summary >Advanced: response contracts, safety annotations, and server lifecycle</summary >
214+
180215Every tool advertises non-destructive behavior to compatible clients. Search, ask, research, and
181216evaluation conservatively advertise open-world behavior because explicitly enabled semantic models
182217may download public weights. The pure prompt router, security audit, and usage report also advertise
@@ -202,6 +237,8 @@ before and after the call. Ragmir does not open an HTTP port; applications that
202237transport own its authentication and
203238authorization boundary.
204239
240+ </details >
241+
205242## Verify
206243
207244``` bash
0 commit comments