agentleFS
sruja-aisruja-ai/sruja/.cursor/rules/sruja-context-host.mdc

sruja / rules

Cursor rule24 starsChanged 6 months agoApache-2.0View on GitHub

Wire Phase 3/4 context tools (drift injector, session prune, memory search) when using Sruja MCP

The file

We split this sruja-context-host.mdc into the rules it gives an agent

11 rules. About 0 are common, 3 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When the sruja MCP server is enabled (see .cursor/mcp.json), follow this host contract.

    line 8
  2. Very specific:

    After MCP connects, if you receive notifications/drift_state (or SRUJA_MCP_WATCH_DRIFT=1 is set), treat params as authoritative session …

    line 25
  3. Very specific:

    If no notification arrived, call sruja_get_drift_state once at the start of architecture-bounded work.

    line 28
  4. Very specific:

    If aidlc-docs/aidlc-state.md or a workflow inception/aidlc-docs/aidlc-state.md exists, run sruja workflow status -r .

    line 29
  5. Very specific:

    Call sruja_search_memory with a short query (e.g.

    line 33
  6. Very specific:

    Prefer hits with trust: reviewed_truth (decision records) over hypothesis (learnings, events).

    line 34
  7. Very specific:

    Never treat memory hits as permission to edit repo.sruja without the normal proposal/review flow.

    line 35
  8. Distinctive:

    When the conversation has accumulated many architecture element references (roughly 8+ tool turns on the same task, or token pressure):

    line 39
  9. Distinctive:

    After compressing, avoid re-expanding dropped ids unless the user asks.

    line 45
  10. Distinctive:

    Before marking a task complete:

    line 53
  11. Very specific:

    Run sruja verify-task --profile <coding|bugfix|review|arch> -r .

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
sruja-context-host.mdc
---
description: Wire Phase 3/4 context tools (drift injector, session prune, memory search) when using Sruja MCP
alwaysApply: true
---

# Sruja context host (Phase 3 + 4)

When the **sruja** MCP server is enabled (see `.cursor/mcp.json`), follow this host contract. Sruja suggests; you apply.

## Tool Profiles

Sruja MCP server supports tool profiles to control which tools are available:
- `minimal` (~10-12 tools): Core ladder + focus briefing + essential utilities
- `coding` (~15-18 tools, default): Minimal + hybrid query + critique + context pruning
- `arch`: Coding + read-only authoring helpers
- `full`: All tools (backward compatible)

The profile is controlled via:
1. Environment variable: `SRUJA_MCP_TOOL_PROFILE`
2. MCP initializationOptions (set in `.cursor/mcp.json`)
3. Defaults to `coding` profile

## Session start

1. After MCP connects, if you receive **`notifications/drift_state`** (or `SRUJA_MCP_WATCH_DRIFT=1` is set), treat `params` as authoritative session context:
   - `schema_version` must be `drift_state/v1`
   - Surface `truth_status`, `health_score`, and top `violations` before large edits
2. If no notification arrived, call **`sruja_get_drift_state`** once at the start of architecture-bounded work.
3. If `aidlc-docs/aidlc-state.md` or a workflow `inception/aidlc-docs/aidlc-state.md` exists, run **`sruja workflow status -r .`** (with `--id` when multiple workflows) to surface phase gates and `aidlc` stage before large SDLC edits.

## Before precedent / “why did we…” questions

1. Call **`sruja_search_memory`** with a short query (e.g. component name, decision topic).
2. Prefer hits with `trust: reviewed_truth` (decision records) over `hypothesis` (learnings, events).
3. Never treat memory hits as permission to edit `repo.sruja` without the normal proposal/review flow.

## Long sessions (context budget)

When the conversation has accumulated many architecture element references (roughly 8+ tool turns on the same task, or token pressure):

1. Call **`sruja_suggest_context_prune`** with:
   - `active_element_ids`: current focus (from `sruja focus`, `sruja_get_focus_briefing`, or scan-resolved module IDs — prefer graph IDs over bare C4 names when warnings appear)
   - `session_element_ids`: element/module IDs mentioned in the thread
2. **Omit** transcript blocks for ids in `compress_ids`; keep full detail for `keep_ids`.
3. After compressing, avoid re-expanding dropped ids unless the user asks.

## Ladder (unchanged)

`sruja_list_architecture_index` → `sruja_get_topology` → `sruja_get_elements` → `sruja_get_task_context` (`cache_friendly: true` when caching).

## End of session

Before marking a task complete:

1. Run **`sruja verify-task --profile <coding|bugfix|review|arch> -r .`** (or call `sruja_verify_task` via MCP).
2. If verify failed:
   - Fix the issue
   - Re-run verify
   - Record a correction learning: `sruja agent record -r . -c "<context>" -H "<what was tried>" -o failed -g "<guardrail>"`
3. If verify passed:
   - Optionally record an affirmation learning

Prompt template: MCP `prompts/get` → `sruja_mcp_guide`.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.