Skip to content

Contributing to Chakshu

Thank you for your interest in contributing to Chakshu! We welcome contributions from both human developers and autonomous AI coding agents.

Chakshu is a local-first, privacy-preserving observability daemon, terminal monitor, security auditor, and web dashboard for AI coding agents.


Code of Conduct

All contributors and participants are expected to adhere to the Code of Conduct. Please report unacceptable behavior following our reporting guidelines.


Development Prerequisites

  • Go: 1.22 or newer (1.23+ recommended, repository uses Go 1.27 module definition)
  • Node.js: 20.x or newer (for developing the embedded Next.js frontend in web/)
  • Git: 2.30 or newer

Getting Started

  1. Clone the repository:

    git clone https://github.com/qdevmahesh/chakshu.git
    cd chakshu
    

  2. Verify Go build and tests:

    go test ./...
    go build ./cmd/chakshu
    

  3. Verify web dashboard build:

    cd web
    npm install
    npm run build
    cd ..
    


Repository Structure & Guidelines

  • cmd/chakshu/main.go: CLI entry point wiring all commands (daemon, stop, reset, count, logs, search, tail, stats, memory, decisions, mcp-memory, eval, rollback, snapshot-hook, approvals, audit, audit-mcp, audit-skills, plugins, audit-plugins, incidents, ps, kill, import, export, ui), plus cmd/chakshu/eval_ci.go.
  • internal/adapter/: Per-agent transcript parsers (Codex, ClaudeCode, Gemini, Cursor). Keep agent-specific parsing isolated inside its adapter and register new adapters through internal/adapter/adapter.go.
  • internal/approval/: Passive human approval extraction, correlation, risk classification, and analytics.
  • internal/watcher/: Tails transcript log streams incrementally with transactional byte offsets and runaway-loop guardrails.
  • internal/event/: Core ToolCall, SecurityEvent, and ApprovalEvent schemas.
  • internal/store/: SQLite persistence (modernc.org/sqlite, zero CGO) for tool calls, FTS5 search, security events, approvals, memory, snapshots, evaluations, and file offsets.
  • internal/formatter/: Terminal row formatting, command wrapper unwrapping, home-path collapsing, short session ID collision resolution, and ANSI color controls.
  • internal/audit/: Security and safety anomaly detection (destructive commands, credential leaks, remote script execution, path traversal, SHA-256 event chaining).
  • internal/evaluation/: Skill benchmarking, deterministic scoring (chakshu-eval-v1.0), comparisons, insights, and opt-in LLM judge.
  • internal/incident/: Incident management, agent process discovery (chakshu ps), and emergency controls (chakshu kill).
  • internal/mcp/: Passive MCP server manifest discovery and security audits.
  • internal/mcpserver/: Local stdio JSON-RPC 2.0 MCP memory server (chakshu mcp-memory).
  • internal/memory/: 3-tier agent memory engine, context analytics, and Decision & Constraint Ledger.
  • internal/plugin/: Multi-agent plugin discovery and static supply-chain auditing.
  • internal/skill/: Local agent skill cataloging, versioning, and prompt-injection auditing.
  • internal/snapshot/: Content-addressed pre-execution file snapshots and rollback.
  • internal/policy/: Security policy evaluation engine.
  • internal/stats/: Telemetry aggregation, session reliability scoring, latency distributions, failure rates, model-wise metrics, and token cost estimation.
  • internal/importer/: Retroactive transcript log file and directory ingestion.
  • internal/exporter/: Telemetry export in structured JSON and CSV formats.
  • internal/ui/: Embedded HTTP server and REST API for the web dashboard.
  • internal/pidfile/: Single-instance daemon lifecycle and PID management.
  • web/: Next.js 16 (React 19 + TypeScript) frontend statically exported to internal/ui/dist/.

Coding Standards

Go Backend

  • Format code with gofmt -w ..
  • Ensure code passes go vet ./....
  • Keep packages focused and avoid adding external third-party dependencies when standard library solutions suffice. The repository uses modernc.org/sqlite for pure Go, zero-CGO SQLite.
  • All exported functions, structs, and interfaces must have clear Go doc comments.
  • Follow Go conventions: tabs for indentation, PascalCase for exported identifiers, camelCase for unexported identifiers.

Web Frontend (web/)

  • Write modular functional components in web/components/.
  • Maintain strict TypeScript type definitions in web/lib/types.ts.
  • Format styling with standard utility classes in web/app/globals.css.
  • Ensure hash-based client-side routing in web/lib/router.ts is preserved for static server compatibility.
  • Ensure all builds pass npm run build and npx tsc --noEmit.

Testing Guidelines

  • Write unit tests alongside implementation code (*_test.go).
  • Ensure all tests are deterministic and do not depend on the user's home directory or real external API keys. Use t.TempDir() and t.Setenv().
  • Run the full test suite before submitting pull requests:
    go test -race ./...
    

Pull Request Guidelines

  1. Create a feature branch: git checkout -b feat/your-feature-name or fix/your-bug-fix.
  2. Follow conventional commit messages:
  3. feat: add new feature
  4. fix: resolve bug
  5. docs: update documentation
  6. test: add unit tests
  7. refactor: clean up implementation without changing behavior
  8. Verify all checks pass locally:
    make test
    make vet
    make fmt-check
    make web-build
    
  9. Fill out the pull request template completely and link related issues.