02-gremlin-cheatsheet

02-gremlin-cheatsheet is a cursor rule for Cursor from kpritam/gremlin-mcp. It costs 1,051 tokens per session, scanned A, original, MIT.

A quick reference for Gremlin-Groovy graph queries. It explains less obvious query steps such as conditions, loops, grouping, and fallback values.

In plain words
What is it for?
Use it while writing or reviewing Gremlin queries that navigate graph data, apply conditions, repeat traversals, collect results, or group values.
Why use it?
It helps you remember how these query steps work without searching through full documentation.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it while writing or reviewing Gremlin queries that navigate graph data, apply conditions, repeat traversals, collect results, or group values.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/kpritam/gremlin-mcp/02-gremlin-cheatsheet
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.

Clone the repo
git clone --depth 1 https://github.com/kpritam/gremlin-mcp

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for 02-gremlin-cheatsheet

README.md
[![agentmods](https://agentmods.dev/badge/rules/kpritam/gremlin-mcp/02-gremlin-cheatsheet.svg)](https://agentmods.dev/rules/kpritam/gremlin-mcp/02-gremlin-cheatsheet)
Your own site
<a href="https://agentmods.dev/rules/kpritam/gremlin-mcp/02-gremlin-cheatsheet"><img src="https://agentmods.dev/badge/rules/kpritam/gremlin-mcp/02-gremlin-cheatsheet.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,051 This file is loaded in full into every session.
When invoked 1,051 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.01051 $0.01051
Opus 5 $0.00526 $0.00526
Sonnet 5 $0.00210 $0.00210
Haiku 4.5 $0.00105 $0.00105

Measured 8d ago against content hash 61568e51b254, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

02-gremlin-cheatsheet 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 8d 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.

.cursor/rules/02-gremlin-cheatsheet.mdc · 194 lines

How it starts

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

Gremlin Groovy Cheatsheet

Rules

  • All node and edge labels are case-sensitive
  • Our Gremlin environment is based on Gremlin-Groovy. For current timestamps, use new Date()

Non-Obvious DSL Steps

coalesce()

Returns the first non-null value from a list of traversals.

g.V().coalesce(values('name'), constant('Unknown'))

choose()

Conditional branching based on a predicate.

g.V().choose(has('age', gt(30)), out('knows'), in('knows'))

repeat()

Loops a traversal a specified number of times or until a condition is met.

g.V().repeat(out()).times(2)

until()

Used with repeat() to specify the loop condition.

g.V().repeat(out()).until(has('name', 'marko'))

emit()

Used with repeat() to control when to emit results.

g.V().repeat(out()).emit().times(2)

barrier()

Controls the flow of traversers through the traversal.

g.V().barrier().out()

sack()

Manages a side-effect value during the traversal.

g.withSack(0).V().repeat(out().sack(sum, 'weight')).times(2)

aggregate()

Collects values into a list as a side-effect.

g.V().aggregate('x').by('name')

group()

Groups values based on a key.

g.V().group().by(label).by(count())

project()

Projects properties into a map.

g.V().project('name', 'age').by('name').by('age')

Built-In Functions

id()

Returns the ID of an element.

g.V().id()

label()

Returns the label of an element.

g.V().label()

values()

Returns the values of specified properties.

g.V().values('name')

valueMap()

Returns a map of property keys and values.

g.V().valueMap()

has()

Filters elements based on properties.

g.V().has('name', 'marko')

hasLabel()

Filters elements based on labels.

g.V().hasLabel('person')

out()

Traverses outgoing edges.

g.V().out()

Read the full file on GitHub · 194 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. 8d ago First seen · 194 lines · 1,051 tokens per session scan A 61568e51b254

Subscribe to this mod's changes

02-gremlin-cheatsheet is a cursor rule published in the GitHub repository kpritam/gremlin-mcp (9 stars, last pushed 11mo ago), licensed MIT. It adds 1,051 tokens to every session, about $0.0053 per session on Opus 5. 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-31.