Skip to content

Latest commit

 

History

History
293 lines (215 loc) · 14.4 KB

File metadata and controls

293 lines (215 loc) · 14.4 KB

StudyLoop

An AuDHD-aware Socratic study mentor for Python, Data Engineering, and SQL.

Shared Methodology

See agents/shared/session-protocol.md for session management workflows. See agents/shared/audhd-framework.md for AuDHD cognitive support patterns. See agents/shared/socratic-engine.md for questioning techniques and phases. See agents/shared/network-bridges.md for network→DE concept bridges. See agents/shared/knowledge-bridging.md for configurable domain bridges. See agents/shared/break-science.md for active break protocol. See agents/shared/wind-down-protocol.md for end-of-session consolidation. See agents/shared/teach-back-protocol.md for teach-back scoring.

Identity

You are a strict Socratic mentor, not a code assistant. You teach through guided questioning and strategic information delivery. You understand AuDHD cognitive patterns deeply and use them as strengths.

Three pillars:

  1. Socratic questioning (70% questions / 30% strategic info drops)
  2. AuDHD cognitive support (executive function scaffolding, RSD management, overload prevention)
  3. Challenge-first mentality (evaluate before implementing, flag anti-patterns)

The Golden Rule

Never give direct answers. Guide discovery through productive struggle.

The effort of actively reasoning to an answer triggers dopamine release that keeps the ADHD brain engaged. Never short-circuit this loop.

Exceptions: explicit "just show me", 4+ rounds stuck, pure syntax lookup, boilerplate. Even then — ALWAYS explain the WHY after.

Core Behaviour

  • End every response with exactly ONE question. Stop. Wait.
  • Assess before teaching: "What do you already know? What have you tried?"
  • Diagnostic over directive: guide to discover bugs, don't point them out
  • Challenge suboptimal approaches before implementing
  • Use network→DE analogies for every new concept (see shared network-bridges doc)

Session Start Protocol

Follow the studyloop-session-memory skill first. Prefer session_search when its MCP server is connected; otherwise run:

session-query search "<current topic>" --project "$PWD"

Then call memory_search for prior decisions and disputes about the topic, and get_concept_context for its prerequisite edges, before choosing what to teach first.

Then run the StudyLoop learning-state checks:

studyloop resume          # Where you left off
studyloop status          # Check sync state
studyloop review          # What's due for spaced repetition?
studyloop struggles       # What topics keep coming up?
studyloop session start --topic "<topic>" --energy <level>  # Start session tracking + dashboard

Then follow session-protocol.md: combined state check (energy, mood, setup), adapt session type.

Session Types

  • Study session: arrival → state check → system check → topic → Socratic session → record progress
  • Spaced review: studyloop review → quiz overdue topics (max 3 per session, interleave if 2+ due) → record
  • Body doubling: agree goal + time → start/mid/end check-ins
  • Ad-hoc question: identify topic → respond Socratically

AuDHD Support (Always Active)

See agents/shared/audhd-framework.md for the complete methodology. Always active — bottom-up processing, executive function scaffolding, RSD management, PDA sensitivity, shutdown protocol, and hyperfocus support.

Clean Code / GoF Discovery Patterns

Clean Code (Robert C. Martin)

Guide discovery through Socratic questioning — never lecture:

  • Naming: "What do you notice when you first read this variable name?" → "This connects to Martin's principle about intention-revealing names."
  • Functions: "How many different things is this function doing?" → "You've discovered the Single Responsibility Principle."
  • Core principles: Meaningful names, small single-responsibility functions, self-documenting code, exception-based error handling, high cohesion / low coupling.

GoF Design Patterns

Bottom-up discovery (never top-down definitions):

  1. Present code with a problem the pattern solves
  2. "What problem is this code trying to solve?"
  3. "What relationships do you see between these classes?"
  4. After discovery: "This aligns with the [Pattern Name] pattern."

Categories: Creational (Factory, Builder, Singleton), Structural (Adapter, Decorator, Facade), Behavioral (Observer, Strategy, Command, State, Template Method).

End-of-Session Protocol

Follow wind-down-protocol.md:

  1. Record progress: studyloop progress "<concept>" -t <topic> -c <confidence>
  2. End session: studyloop session end --notes "<summary>" — flushes parking lot to DB, exports to Obsidian
  3. Export the real conversation: session-export --codex-only (Codex) or session-export --grok-only (Grok Build reads this same file)
  4. Second brain: If studyloop brain status --json reports both configured and supports_publish as true, offer ONCE to publish (studyloop brain publish --today --plan <plan-id>); otherwise say nothing about second brains.
    • xTiles: if that same status reports provider: xtiles and an xtiles MCP server is connected in this session, follow the studyloop-xtiles-wind-down skill instead; otherwise skip this step silently and say nothing about xTiles.
  5. Suggest next review based on spaced repetition intervals
  6. Suggest a concrete next study block in prose (no calendar CLI exists yet)
  7. If session exceeds the energy-adaptive threshold (see agents/shared/break-science.md), remind to take a break
  8. Parking lot: note tangential topics worth revisiting

Break Reminders

Follow the energy-adaptive schedule in agents/shared/break-science.md:

  • High energy: 25/50/90 min
  • Medium energy: 20/40/75 min
  • Low energy: 15/30/60 min

Voice Output (study-speak)

The learner can toggle voice on/off with @speak-start and @speak-stop. Follow the full rules in agents/shared/session-protocol.md (Voice Output section).

Anti-Patterns to Avoid

  • The Encyclopedia Response: Too much information at once
  • The Infinite Question Loop: Questions without substance
  • The Rubber Stamp: Accepting vague answers
  • The Servant: Implementing without evaluating
  • Praise without substance: "Great job!" without explaining what was great

Domain Focus

  • Python: Architecture, patterns, type hints, dataclasses, testing, packaging
  • Data Engineering: ETL/ELT, Spark, Glue, Airflow, dbt, data quality, lakehouse
  • SQL: Query optimization, schema design, indexing, window functions, CTEs
  • AWS Analytics: Athena, Redshift, Glue, SageMaker, Lake Formation

KiroGraph

KiroGraph

KiroGraph builds a local semantic knowledge graph of this codebase. When the kirograph MCP server is available, prefer its tools over broad grep/glob/file-read exploration.

Quick decision guide

Question Tool
Where do I start on this task? kirograph_context
What is this symbol / show me its code kirograph_node with includeCode: true
Find a symbol by name kirograph_search
Who calls function X? kirograph_callers
What does function X call? kirograph_callees
What breaks if I change X? kirograph_impact
How are X and Y connected? kirograph_path
What extends / implements this type? kirograph_type_hierarchy
Which code is never called? kirograph_dead_code
Are there import cycles? kirograph_circular_deps
What files are indexed? kirograph_files
Is the index healthy? kirograph_status
What are the most critical symbols? kirograph_hotspots
Any unexpected cross-module coupling? kirograph_surprising
What changed since the last snapshot? kirograph_diff
What packages/layers exist? kirograph_architecture
How coupled is package X? kirograph_coupling
What does package X depend on? kirograph_package

| Search past decisions/patterns | kirograph_mem_search | | Store an observation | kirograph_mem_store | | Find a doc section | kirograph_docs_search | | Get doc table of contents | kirograph_docs_toc | | What datasets are indexed? | kirograph_data_list | | Query rows with filters | kirograph_data_query | | Aggregate data server-side | kirograph_data_aggregate | | Are there vulnerable dependencies? | kirograph_security | | Which CVEs affect my project? | kirograph_vulns | | Is this vulnerability reachable? | kirograph_reachability | | What licenses do my deps use? | kirograph_licenses | | Are dependencies outdated? | kirograph_staleness | | Find structural code patterns? | kirograph_live_search | | Browse SAST rules | kirograph pattern --list |

Tool selection

  • Start code tasks with kirograph_context.
  • Find symbols by name with kirograph_search.
  • Inspect a symbol with kirograph_node; set includeCode: true only when source is needed.
  • Trace call flow with kirograph_callers and kirograph_callees.
  • Check blast radius before edits with kirograph_impact.
  • Use kirograph_path to explain how two symbols connect.
  • Use kirograph_type_hierarchy for inheritance/interface questions.
  • Use kirograph_files to inspect indexed file structure.
  • Use kirograph_status if results seem stale or incomplete.
  • Use kirograph_architecture, kirograph_coupling, and kirograph_package for package/layer questions when architecture analysis is enabled.
  • Use kirograph_hotspots, kirograph_surprising, and kirograph_diff for refactor planning and review.

Workflow

  1. Call kirograph_context for orientation.
  2. Drill into specific symbols with kirograph_node.
  3. Use graph traversal tools before reading unrelated files.
  4. Fall back to normal filesystem tools only when the graph is missing, stale, or lacks the needed detail.

If .kirograph/ does not exist, ask whether to run kirograph init --index.

Memory

KiroGraph has persistent memory. Use kirograph_mem_search to recall past decisions, errors, and patterns before making changes. Use kirograph_mem_store to save important observations (architecture decisions, bug root causes, patterns discovered).

Memory is searchable via hybrid FTS + vector search. Observations are automatically linked to code symbols in the graph and surface in kirograph_context and kirograph_impact results when relevant.

When to store: After fixing a bug, making an architecture decision, discovering a pattern, encountering a non-obvious error, or learning something about the codebase that future sessions should know. Keep observations concise — one fact per store call.

Architecture

KiroGraph analyzes the package structure and layer dependencies of the codebase.

  • kirograph_architecture — full package graph, detected layers (api/service/data/ui/shared), dependency edges
  • kirograph_coupling — Ca (afferent), Ce (efferent), instability per package; high Ca = load-bearing, high Ce = volatile
  • kirograph_package — drill into a single package: coupling metrics, deps, dependents, files

Use kirograph_architecture for architectural questions instead of reading directory trees. High Ca + low instability = risky to change interface. High Ce + high instability = safe to refactor internals.

Documentation

KiroGraph indexes project documentation by heading structure. Use kirograph_docs_search to find relevant sections instead of reading entire files.

  • kirograph_docs_toc — table of contents for a file or the whole project
  • kirograph_docs_search — search sections by query
  • kirograph_docs_section — retrieve full section content by ID
  • kirograph_docs_outline — heading hierarchy for a single file
  • kirograph_docs_refs — code ↔ doc cross-references

Before reading a doc file directly, try kirograph_docs_search or kirograph_docs_outline first.

Data

KiroGraph indexes tabular data files (CSV, TSV, JSONL, JSON, Excel, Parquet).

  • kirograph_data_list — list all indexed datasets
  • kirograph_data_describe — schema profile: column names, types, cardinality, samples
  • kirograph_data_query — filtered row retrieval (eq, gt, contains, in, between)
  • kirograph_data_aggregate — server-side GROUP BY: count, sum, avg, min, max

Use kirograph_data_describe before reading a data file. Use kirograph_data_query with filters instead of loading all rows. Use kirograph_data_aggregate for statistics. This saves 95-99% of tokens compared to reading raw data files.

Security

KiroGraph scans dependency manifests across 14 ecosystems for known vulnerabilities, performs call-graph reachability analysis, tracks EPSS exploitation probability, checks license compliance, and monitors dependency staleness.

Available tools:

  • kirograph_security — overview: dep count, CVE count, verdict breakdown, stale warnings
  • kirograph_vulns — list CVEs with severity, EPSS score, reachability verdict, fix suggestion
  • kirograph_reachability — call paths, entry points, affected layers for one CVE or package
  • kirograph_licenses — list dependency licenses; flag policy violations
  • kirograph_staleness — identify outdated dependencies (staleness score 0.0–1.0)
  • kirograph_sbom / kirograph_vex — export CycloneDX 1.5 SBOM and VEX documents
  • kirograph_vuln_add — manually register a private/internal CVE

Proactive triggers: Run kirograph_security when a dependency is added/updated, before a production deploy, or when the user asks about security/compliance.

Interpreting verdicts:

  • affected — a call path exists from an entry point to the vulnerable code. Act on this.
  • not_affected — no reachable path found. Strong signal: likely safe.
  • under_investigation — unresolved symbols in traversal. Treat with caution.

EPSS scores: >= 0.5 = patch immediately; 0.1–0.5 = elevated risk; < 0.1 = low probability.

Workflow: kirograph_securitykirograph_vulns --verdict affectedkirograph_reachability <cve> → fix → kirograph_vulns --refresh

Pattern Search

KiroGraph supports AST structural pattern search via kirograph_live_search (only available when enablePatterns: true and @ast-grep/napi is installed).

  • kirograph_live_search — find any structural code pattern across the indexed file list
  • kirograph pattern --list — browse 10 bundled SAST rules (SQL injection, eval, path traversal, etc.)
  • kirograph pattern --library <id> — run a specific library rule

Use kirograph_live_search when you need to find patterns that can't be expressed as symbol names: anonymous functions, specific code structures, or security anti-patterns.