Skip to content

Add Cursor rules and agent settings for CLI agents#3

Merged
HumanBean17 merged 2 commits into
masterfrom
cursor/agent-rules-and-settings
May 4, 2026
Merged

Add Cursor rules and agent settings for CLI agents#3
HumanBean17 merged 2 commits into
masterfrom
cursor/agent-rules-and-settings

Conversation

@HumanBean17

Copy link
Copy Markdown
Owner

Summary

Adds Cursor settings to help Cursor CLI agents (and other agentic
tools) navigate this repo correctly without rediscovering the same
invariants on every run.

The repo previously had a single .cursor/rules/breaking-changes.mdc.
This PR keeps it and layers six topic-scoped rule files plus a
top-level AGENTS.md and .cursorignore.

What's added

.cursor/rules/

  • project-overview.mdc (alwaysApply) — high-level map: what
    the bundle is, the file table, the env vars, the module /
    microservice resolution order, and which docs to read before
    non-trivial edits.
  • python-style.mdc (globs **/*.py) — Python 3.11+
    conventions used here: from __future__ import annotations, PEP 604
    unions, dataclasses vs Pydantic, stderr-only diagnostics (stdout is
    the MCP transport), the no-cocoindex-import rule outside the flow
    module, and ruff/pytest tooling.
  • tests-and-fixtures.mdc (globs tests/**) — distilled
    version of tests/README.md's "DO NOT OVERFIT" guidance: invariants
    over exact counts, no fixture-special-casing in production code,
    contract-vs-integration split, gating heavy tests behind
    LANCEDB_MCP_RUN_HEAVY=1.
  • graph-and-ast.mdc (globs ast_java.py,
    build_ast_graph.py, graph_enrich.py, kuzu_queries.py,
    java_ontology.py, related tests)
    — node/edge model, role and
    capability inference order, brownfield consistency rule (one
    collect_annotation_meta_chain walk for both Kuzu and Lance),
    call-graph semantics (anonymous classes, lambdas, this.f1.f2.m()
    chains, receiver scope), and project-root semantics across all three
    index call sites.
  • search-and-ranking.mdc (globs search_lancedb.py,
    java_index_flow_lancedb.py, related tests)
    JavaLanceChunk
    schema invariants, the role-weight table, the symbol-bonus formula
    (overlap / action-verb / type-name), the "weights skipped when
    role= locked" rule, filter modes, and the
    LANCEDB_MCP_DEBUG_CONTEXT debugging flag.
  • mcp-server.mdc (globs server.py, test_mcp_tools.py)
    stdio invariants, the contract that tool descriptions are LLM
    prompts (so updates must propagate to README + _INSTRUCTIONS),
    defaults agents rely on (e.g. trace_flow.follow_calls=true,
    find_callers/find_callees.exclude_external=true), and the steps
    for adding a new tool.
  • agent-workflow.mdc (alwaysApply) — investigate → propose
    (when non-trivial) → implement → validate (ruff + pytest) →
    commit/PR loop, matching the existing branch-naming convention
    (plan/<name>, now also cursor/<topic>) and commit-message style.

Repo root

  • AGENTS.md — flat summary of the hard rules and investigation
    order for tools that don't read .cursor/rules/.
  • .cursorignore — keeps Cursor's context out of regenerable /
    binary noise: lancedb_data/, *.kuzu, __pycache__/, .venv/,
    htmlcov/, etc. Mirrors .gitignore plus a few build artifacts
    inside tests/**/target/ and tests/**/build/.

Why these specific rules

Each rule encodes a fact that an agent would otherwise have to
reconstruct from README.md + CODEBASE_REQUIREMENTS.md (~50 KB of
prose) on every run:

  • The Kuzu-vs-Lance Layer-A consistency rule (single
    collect_annotation_meta_chain walk).
  • The fact that role weights and symbol bonus are skipped when the
    caller locks role=.
  • That capabilities are intentionally type-level only.
  • That print() to stdout breaks the MCP transport.
  • That schema changes require a full reindex + ontology_version
    bump.
  • That tests must assert on invariants, not exact counts from the
    bank-chat fixture.

Out of scope

  • No code changes — only rules, docs, and ignore config.
  • No reindex required.
  • No new env vars or schema columns.

@HumanBean17 HumanBean17 merged commit b3ba255 into master May 4, 2026
@HumanBean17 HumanBean17 deleted the cursor/agent-rules-and-settings branch May 4, 2026 18:19
HumanBean17 added a commit that referenced this pull request May 6, 2026
…ty (#32)

Implements propose merged in #28. Sequences after PR-F1 (#31, merged) and
PR-G1 (#30, merged). Hard rename — no deprecation alias, MCP bundle has
no users yet and breaking changes are explicitly allowed.

Single PR, ~115 LOC, ontology bump 8→9. Single source-of-truth flips at
ast_java.py:91 (role) and ast_java.py:114 (HTTP_CLIENT capability);
VALID_ROLES / VALID_CAPABILITIES are auto-derived so no java_ontology.py
edit needed.

9 new tests in tests/test_client_role_rename.py target ~290 passed,
4 skipped (281 baseline + 9).

Plan delta from propose: test #4 asserts warn-and-drop behaviour
(stderr warning + override silently dropped) matching actual
graph_enrich.py:443-447, 481-486, NOT raised ValueError as the propose's
example suggested.

Out of scope: async role/capability changes (MESSAGE_PRODUCER already
covers Kafka/Rabbit/JMS), auto-promoting RestTemplate/WebClient to
HTTP_CLIENT (brownfield-only opt-in), backwards-compat alias,
RegisterRestClient (followup #3).
HumanBean17 added a commit that referenced this pull request Jun 15, 2026
#327)

* wire graph-phase index progress (count-first pass1 + pass steps)

build_ast_graph emits JCIRAG_PROGRESS kind=graph under --verbose
(count-first exact total in pass 1; pass 2-6 step lines). The sync
and async subprocess drains route progress events to an on_progress
callback via ProgressRelay (parse-first, single-writer). init/increment/
reprocess render a determinate graph-phase bar in default TTY mode
(running only after the builder spawns); --quiet silent; --verbose raw.
Renderer.apply() is a no-op after stop() (drain-thread safety).

Co-Authored-By: Claude <[email protected]>

* harden PR-2: survive renderer exceptions, exact incremental total, relay factory

- ProgressRelay guards renderer.apply() so a render-chain exception
  can't silently kill the drain thread (try/except + stderr note)
- incremental pass-1 total excludes removed files (done no longer
  undercounts then clamps)
- make_relay() factory centralizes the sync+async drain wiring
- drop unreachable console fallback in ProgressRelay._route_line

erase unused-renderer (review Minor #3) and failing-builder tests
(Minor #6) deferred.

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
HumanBean17 added a commit that referenced this pull request Jun 15, 2026
…/3/4) (#330)

* add propose + plan for index output rework (gating spike passed)

Propose (propose/active/INDEX-OUTPUT-REWORK-PROPOSE.md), plan
(plans/active/PLAN-INDEX-OUTPUT-REWORK.md), and per-PR agent prompts
(plans/active/AGENT-PROMPTS-INDEX-OUTPUT-REWORK.md) for unifying the
index-build output across init/increment/install/reprocess/update and
adding a real progress bar (rich + JCIRAG_PROGRESS protocol).

Gating spike passed 2026-06-14: a print(file=sys.stderr) inside a
CocoIndex flow function reaches the parent's captured stderr (130/130
lines relayed; pre-walk divergence 0 on the fixture). PR-1 unblocked.

Planning only; no production code changed.

Co-Authored-By: Claude <[email protected]>

* add rich + progress protocol/renderer skeleton

rich>=14,<15 (cocoindex[lancedb] requires rich>=14). New
java_codebase_rag/progress.py: ProgressEvent, parse_progress_line,
IndexProgressRenderer (rich Live + non-TTY fallback), ProgressRelay
(parse-first, single-writer). 13 light unit tests. No production
caller yet; PR-2+ wire it in.

Co-Authored-By: Claude <[email protected]>

* correct rich version pin to >=14,<15

cocoindex[lancedb]>=1.0.0a43 transitively requires rich>=14, so the
originally-suggested rich>=13.7,<14 cap is unsatisfiable (pip install -e .
fails). Corrected in propose Open Q5 + risk row, plan Resolved decisions +
PR-1 step + DoD, and the PR-1 agent prompt. Verified compatible on rich
14.3.4.

Co-Authored-By: Claude <[email protected]>

* address PR-1 review: port _suppress_next, two-way clamp, monotonic done, carry-forward totals

- ProgressRelay now mirrors _LineFilter's noise-continuation suppression
  (_suppress_next) + new test_progress_relay_suppresses_noise_continuation
- remove dead _is_partial param from _route_line
- clamp completed→total on status=done both directions (over-count safe)
- monotonic completed (max with current) so a stray smaller done can't rewind
- non-TTY done concise line carries forward last-seen total/elapsed_s

Minor #6 (apply/stop atomicity) deferred to PR-2 (drain-thread wiring).

Co-Authored-By: Claude <[email protected]>

* note PR-2 follow-up: IndexProgressRenderer apply/stop atomicity

PR-1 code-quality review Minor #6: apply() issues several locked rich
calls not atomic vs. a concurrent stop() from the main thread. Only
matters once PR-2 wires the drain thread. Added as cross-PR risk #10
with the PR-2 mitigation (gate apply on _started, or hold the Live
lock across the sequence).

Co-Authored-By: Claude <[email protected]>

* wire graph-phase index progress (count-first pass1 + pass steps)

build_ast_graph emits JCIRAG_PROGRESS kind=graph under --verbose
(count-first exact total in pass 1; pass 2-6 step lines). The sync
and async subprocess drains route progress events to an on_progress
callback via ProgressRelay (parse-first, single-writer). init/increment/
reprocess render a determinate graph-phase bar in default TTY mode
(running only after the builder spawns); --quiet silent; --verbose raw.
Renderer.apply() is a no-op after stop() (drain-thread safety).

Co-Authored-By: Claude <[email protected]>

* harden PR-2: survive renderer exceptions, exact incremental total, relay factory

- ProgressRelay guards renderer.apply() so a render-chain exception
  can't silently kill the drain thread (try/except + stderr note)
- incremental pass-1 total excludes removed files (done no longer
  undercounts then clamps)
- make_relay() factory centralizes the sync+async drain wiring
- drop unreachable console fallback in ProgressRelay._route_line

erase unused-renderer (review Minor #3) and failing-builder tests
(Minor #6) deferred.

Co-Authored-By: Claude <[email protected]>

* wire vectors-phase index progress; retire Spinner/emit_vectors; optimize phase

process_*_file emit JCIRAG_PROGRESS kind=vectors (approximate total from
app_main pre-walk + throttled per-file ticks); the parent emits the
terminal vectors event on cocoindex exit (drives clamp-on-completion).
optimize_lance_tables emits kind=optimize in-process (covers both call
sites). server.run_refresh_pipeline wires the async drain + renderer.
Retire Spinner + emit_vectors_start/_finish. Operator commands render
Vectors -> Optimize -> Graph.

Co-Authored-By: Claude <[email protected]>

* fix PR-3: count application YAML in pre-walk; tighten divergence test

_approximate_vectors_total's YAML predicate ("/application" in fn)
was always False for a bare filename, so the pre-walk under-counted
application YAML and the divergence went negative (gap=-4). Use
fn.startswith("application"). Move the vectors tick emission under
the lock to match its comment. Drop a dead type-ignore. Tighten the
divergence test to assert gap==0 on the fixture.

Co-Authored-By: Claude <[email protected]>

* align install/update index progress; wire --quiet/--verbose

install/update render the unified Vectors->Optimize->Graph progress on
stderr during their indexing sub-step (no longer stdout chatter / silent
quiet=True); wizard conversational stdout is preserved. _cmd_update
forwards --quiet/--verbose (both ignored today); _cmd_install forwards
--verbose. CLI docs + README updated.

Co-Authored-By: Claude <[email protected]>

* fix PR-4: best-effort graph catch-up in update; truthful failure footer

run_update's graph catch-up is best-effort again (graph failure -> exit 0
+ Warning, not exit 1) — matches the original intent and the output/UX-
only scope. Both installer brackets catch BaseException to set the failed
footer marker before re-raising. Footer uses perf_counter like the
operator footer.

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant