DEV Community

Cover image for Hypnos: The Local Gemma Daemon That Cleans Your Git Tree & Preps Your Standup While You Sleep
Shikhar Verma
Shikhar Verma

Posted on

Hypnos: The Local Gemma Daemon That Cleans Your Git Tree & Preps Your Standup While You Sleep

Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady Submission 🦥

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady

What I Built

Let’s be honest about how we actually write code at 1:30 AM.

We don't make clean, atomic commits. We touch 17 different files across the backend and UI to fix one race condition, leave console.log("HERE_4") in three places, ignore the outdated README.md, and tell ourselves, "I'll untangle the git staging and write my standup notes tomorrow morning."

Spoiler: tomorrow morning, you wake up 6 minutes before standup and push git commit -m "wip fixes".

In honor of International Sloth Day and the Slow and Steady theme, I built Hypnos (hypnos-cli)—an autonomous, local-first overnight janitor for lazy engineers.

When you walk away from your keyboard at night, Hypnos wakes up and does the tedious engineering hygiene you dread:

  1. Untangles Dirty Working Trees: Inspects your uncommitted git diff, strips leftover debug statements, and groups entangled changes across files into logical, atomic git patches (git add -p style) on a shadow staging branch.
  2. Writes Semantic Commits & Docs: Uses a local Gemma model to generate strict Conventional Commits for each logical hunk and automatically patches outdated CLI flags or env variables in your README.md.
  3. Preps Your Morning Standup (With Audio): Cross-references your local shell history, git reflog, and resolved issues to draft a crisp 3-bullet standup update—and uses ElevenLabs to synthesize a calm, 45-second audio briefing waiting for you when you open your laptop with your morning coffee.

Who gets to be lazier? Any developer who wants the reputation of a disciplined 10x staff engineer with the actual daily habits of a caffeinated sloth.

Demo

  • Live Dashboard & Docs:
  • Video Walkthrough:

Terminal & Trace Preview

$ hypnos sleep --watch ~/projects/core-engine

 🦥 System idle detected (15m). Starting Temporal workflow: overnight-hygiene-884a
 🔍 Found 14 modified files (+412, -89 lines) with uncommitted changes.
 đź§ą AST Scrubber removed 3 orphaned debug statements.
 đź§  Gemma (local) partitioned diff into 3 logical atomic commits:
           ├── feat(cache): implement sliding window TTL eviction
           ├── fix(rpc): handle retry backoff on timeout
           └── docs(readme): document REDIS_MAX_POOL env variable
 🎙️ ElevenLabs synthesized morning briefing -> ~/.hypnos/standup-2026-10-25.mp3
 âś… Staged on branch `hypnos/nightly-2026-10-25`. Run `hypnos apply` over coffee.
Enter fullscreen mode Exit fullscreen mode

Core Architecture: Durable Diff Partitioning & Local Inference

Here is how Hypnos pairs Temporal activities with local Gemma structured JSON outputs to split a messy workspace diff into clean, logical commit hunks without losing state if the laptop suspends:

// src/workflows/overnightHygiene.ts
import { proxyActivities } from '@temporalio/workflow';
import type * as activities from '../activities';

const { 
  extractAstDiffs, 
  partitionWithGemma, 
  stageShadowCommits, 
  synthesizeMorningBriefing 
} = proxyActivities<typeof activities>({
  startToCloseTimeout: '5 minutes',
  retry: {
    initialInterval: '10s',
    backoffCoefficient: 2,
    maximumAttempts: 5, // Survives laptop lid sleep/wake cycles
  },
});

export async function overnightHygieneWorkflow(repoPath: string): Promise<string> {
  const rawDiffs = await extractAstDiffs(repoPath);
  if (rawDiffs.length === 0) return 'Workspace already clean. Keep sleeping!';

  // Local Gemma inference clusters file hunks into atomic semantic units
  const commitPlan = await partitionWithGemma(rawDiffs);

  // Apply hunks onto an isolated shadow branch (never mutates main directly!)
  const branchName = await stageShadowCommits(repoPath, commitPlan);

  // Generate the 45-second audio standup summary
  await synthesizeMorningBriefing(commitPlan);

  return branchName;
}
Enter fullscreen mode Exit fullscreen mode

And the local Gemma activity instrumented with Sentry Agent Tracing:

// src/activities/gemmaPartitioner.ts
import * as Sentry from '@sentry/node';
import ollama from 'ollama';

export async function partitionWithGemma(rawDiffs: string) {
  return await Sentry.startSpan(
    {
      op: 'gen_ai.chat',
      name: 'Gemma Diff Partitioning Agent',
      attributes: { 'gen_ai.request.model': 'gemma3:12b' },
    },
    async (span) => {
      const response = await ollama.chat({
        model: 'gemma3:12b',
        format: 'json',
        messages: [
          {
            role: 'system',
            content:
              'You are an autonomous Git hygiene agent. Partition raw git diffs into atomic, logical Conventional Commits and generate a concise 3-bullet standup summary. Output strict JSON.',
          },
          { role: 'user', content: rawDiffs },
        ],
      });

      span.setAttribute('gen_ai.usage.input_tokens', response.prompt_eval_count ?? 0);
      span.setAttribute('gen_ai.usage.output_tokens', response.eval_count ?? 0);

      return JSON.parse(response.message.content);
    }
  );
}
Enter fullscreen mode Exit fullscreen mode

How I Built It

Hypnos is designed around a local-first, resilient systems architecture:

  • Open-Weight Inference (Gemma via Ollama): At the core of Hypnos is Google's open-weight Gemma model (gemma3:12b) running locally via Ollama with strict JSON schema constraints. I built a custom Two-Pass Agent loop:
    • Pass 1 (The Classifier): Takes AST-parsed diff chunks and clusters related line modifications across files by semantic intent—separating a quick UI styling tweak from a core backend state change that happened in the same late-night coding session.
    • Pass 2 (The Scribe): Generates the Conventional Commit message (feat, fix, refactor, docs), updates markdown documentation tables, and summarizes the engineering impact in plain English.
  • Durable Execution (Temporal): Background daemons on laptops are notoriously fragile—OS sleep states, battery throttling, or locked git index files (index.lock) easily kill standard cron jobs. Wrapping the agent pipeline in a Temporal workflow guarantees that if the machine suspends halfway through local inference, the workflow pauses and resumes cleanly the moment the CPU wakes up.
  • Observability (Sentry Agent Tracing): Local open-weight models can occasionally hallucinate hunk line numbers or stall on massive lockfile diffs. I integrated Sentry Agent Tracing across every tool call and LLM span to inspect token generation speed (tokens/sec), catch malformed JSON patches, and profile latency across the pipeline.
  • Voice Synthesis (ElevenLabs): Because reading terminal logs before coffee violates the spirit of slothfulness, Hypnos pipes the final standup script to the ElevenLabs API (eleven_turbo_v2_5) to generate a crisp audio summary triggered via hypnos morning.
  • Frontend & TUI: Built with TypeScript, Node.js, simple-git, and a high-contrast obsidian terminal UI paired with a Next.js trace dashboard hosted on a .tech domain.

Why Does Open Innovation Matter?

For a tool like Hypnos, open-weight models and local inference aren't just a nice-to-have—they are the only reason this project can exist.

  1. Zero Source Code Exfiltration: Hypnos reads your raw, uncommitted source code, .env.example diffs, and local shell history. Most developers (and virtually all enterprises) cannot pipe proprietary uncommitted diffs to a closed cloud LLM API every night without violating security compliance. Running Gemma locally means your code never leaves 127.0.0.1.
  2. Zero Idle Tax ($0.00/night): An autonomous daemon that runs every single night across multiple repositories would rack up continuous API token bills on closed frontier models—especially when parsing multi-thousand-line diffs. With open weights running on local silicon, Hypnos utilizes idle overnight GPU/NPU cycles for free. Set it up once, and never pay for it again.
  3. Offline & Airplane Mode Ready: Whether you're hacking on a train, in a campus hostel during a Wi-Fi outage, or on a flight, your local git hygiene agent keeps working without an internet connection.
  4. Deterministic Model Pinning: Closed APIs silently update weights and deprecate snapshots, breaking brittle git-patch formatting prompts overnight. Open weights let us lock the exact quantized GGUF hash so our diff parser never regresses.

My Agent Session

During development, I used an agentic workflow to iterate on the git apply --cached patch generator—specifically debugging edge cases where adjacent modified lines in the same file needed to be split into two separate logical commits.

The Lazy Payoff

I ran Hypnos on my own workspace over the last 4 days while building this project:

  • Before Hypnos: ~15–20 minutes every morning spent running git diff, trying to remember why I modified a utility helper at 2:00 AM, staging hunks manually with git add -p, and typing up standup notes.
  • With Hypnos: 0 minutes. Every morning, I ran hypnos morning, listened to a 40-second audio recap while making coffee, inspected the pre-staged shadow branch with git log --stat, and fast-forwarded it into main with a single command (hypnos apply).

Over a full year (~250 coding days), saving 15 minutes of daily git and standup housekeeping reclaims 62.5 hours of pure engineering laziness.

Prize Categories

  • Best Use of Gemma: Uses local Gemma open-weight models (gemma3:12b via Ollama) as the core reasoning engine to classify AST diffs, generate semantic commits, and draft standup summaries completely offline.
  • Best Use of Temporal: Orchestrates the entire multi-step overnight agent pipeline as a fault-tolerant Temporal workflow that survives OS sleep cycles and git lockfile collisions.
  • Best Use of Sentry Agent Tracing: Instruments every local LLM call, prompt token count, latency span, and git tool execution with Sentry Agent Tracing to monitor throughput and debug diff-hunk boundary errors.
  • Best Use of ElevenLabs: Turns the overnight git activity and changelog into a hands-free morning audio standup briefing (eleven_turbo_v2_5).
  • Best Use of a .tech Domain: Deployed the interactive trace explorer and documentation portal on a custom .tech domain claimed via Hacktoberfest.

Top comments (0)