Skip to content
Engineering AI CLI

How We Track Time with AI Agents and the Miru CLI

A practical guide to automated time tracking for teams using Claude Code, Codex, and other AI coding tools. Real workflows, real scripts, zero browser tabs.

Vipul A M Vipul A M · · 5 min read
Teams
Miru team management screen with members and roles
This article is currently written in English. Navigation, dates, and calls to action follow your selected language.

How We Track Time with AI Agents and the Miru CLI works when the workflow is simple enough to repeat every week.

A practical guide to automated time tracking for teams using Claude Code, Codex, and other AI coding tools. Real workflows, real scripts, zero browser tabs. We write from operating experience, not trend-chasing.

The Simplest Version: Log After Each Session

Miru dashboard for tracking AI-assisted time entries

After finishing a focused AI session, you log it. One line. No browser tab.

# After a 2-hour Claude Code session on the Acme project
miru time create --project "Acme Redesign" --duration 2h --date today \
  --note "Claude Code: Migrated auth system from JWT to session-based"

That’s it. The note captures what the AI session produced, which matters for billing transparency and for your future self when a client asks “what did you do in March?”

This works. But developers are lazy (this is a compliment), so we made it faster.


Shell Aliases: Two Seconds to Log

Add this to your .zshrc or .bashrc:

alias track='miru time create --date today'

Now logging is:

track --project "Acme" --duration 1.5h --note "Codex: Fixed N+1 queries in reports API"
track --project "Brightside" --duration 45m --note "Claude Code: Added Stripe webhook retry logic"
track --project "Internal" --duration 30m --note "Cursor: Updated CI config for Ruby 3.3"

No context switch. You’re already in the terminal. You just shipped code with an AI assistant. Log it before you move on. It takes two seconds and saves you 10 minutes of Friday afternoon archaeology.


Git Hook: Never Forget After a Commit

This is the one that changed everything for us. A post-commit hook that asks you to log time right when you commit:

#!/bin/bash
# .git/hooks/post-commit
echo "Log time for this commit? (duration in hours, or skip)"
read -p "> " duration
if [ "$duration" != "skip" ]; then
  project=$(basename $(git rev-parse --show-toplevel))
  msg=$(git log -1 --pretty=%s)
  miru time create --project "$project" --duration "${duration}h" \
    --date today --note "$msg"
  echo "✓ Logged ${duration}h to $project"
fi

You just committed “Fix race condition in invoice PDF generation.” The hook asks how long. You type 1.5. Done. The commit message becomes the time entry note automatically. No extra typing. No separate mental context.

The project name is inferred from the repo directory. If your repo is acme-redesign, the time entry goes to acme-redesign. Rename the project in Miru to match your repo names and the whole thing is zero-config.


Claude Code Hooks: Track AI Activity Automatically

Claude Code has a hook system that lets you run scripts when specific events happen. We use it to log AI session activity:

// .claude/settings.json
{
  "hooks": {
    "PostToolUse": [{
      "matcher": "Bash",
      "command": "echo 'AI session active' >> /tmp/miru-session.log"
    }]
  }
}

Every time Claude Code runs a command, it appends to a session log. At the end of the day, a script reads that log and tells you how much AI-assisted work happened. It’s not a replacement for logging — it’s a safety net that catches what you forgot.


The Daily Summary: Your End-of-Day Ritual

This is the script that ties it all together:

#!/bin/bash
# miru-daily-log.sh — run at end of day
echo "=== Daily Time Summary ==="
echo "Projects worked on today:"
miru time list --from today --to today
echo ""
echo "Unlogged commits:"
git log --since=midnight --oneline

Run this at 5 PM. It shows you what you’ve logged and what you’ve committed but haven’t logged. The gap between those two lists is your lost revenue. Close it before you close your laptop.


Why Traditional Time Tracking Fails with AI Tools

This isn’t about discipline. It’s about physics.

AI sessions blur project boundaries. You might use Claude Code to fix a bug on Acme, then without closing anything, ask it to review a PR on Brightside, then refactor a test on the internal dashboard. One terminal, three projects, forty minutes. A start/stop timer can’t handle this. You need point-in-time logging.

15-minute granularity is wrong. When AI makes you 3x faster, a meaningful unit of work might be 20 minutes, not 2 hours. Traditional timers round up to 15-minute blocks. The Miru CLI lets you log --duration 25m because that’s what actually happened.

Developers are already in the terminal. If you’re using Claude Code, Codex CLI, or even Cursor’s terminal, you’re right there. Asking you to open a browser, navigate to a time tracker, find the right project, and click buttons is asking you to break the flow that AI tools were designed to create. The CLI respects where you already are.


How We Actually Work at Saeloun

Here’s the real daily rhythm for our team:

Morning: Verify yesterday’s entries didn’t get lost.

miru time list --from yesterday --to yesterday

During work: Shell aliases after each AI session. Two-second habit.

End of day: Run the daily summary script. Log anything the git hook missed.

Friday: Weekly review to make sure nothing slipped through.

miru report time --from monday --to friday

This isn’t a perfect system. Perfection isn’t the goal. The goal is close enough to reality that your invoices are honest and your team gets paid for the work they actually did. We went from ~70% time capture accuracy to north of 95% with these workflows. That difference, for a team our size, is six figures annually.


What’s Next

We’re working on deeper AI agent integrations where the Miru CLI can be called directly by AI agents as part of their workflow. Imagine Claude Code automatically logging time entries based on the work it performed, tagged with the project and a summary of what changed. No human in the loop for the logging part — just for the review.

The pieces are all there. The CLI exists. The hooks exist. The AI tools have extensibility APIs. We just need to wire them together.

But honestly? Start with the shell alias. That alone will change your Fridays.

alias track='miru time create --date today'

Add it to your shell config. Right now. Before you forget. Like you forgot to log those two hours yesterday.

See 5 more CLI workflows →

Hard Stop

Run this loop for two weeks without skipping cleanup. The compounding effect is real.

Start with Miru or read the docs.

Share:
Vipul A M

Vipul A M

Co-founder at Saeloun. Building Miru. Rails contributor. Shipping from Pune, India.

Put it to work

Run one cleaner billing cycle in Miru.

If this article is about tracking time, billing clients, comparing tools, or automating work, Miru is the product version of that idea. Start free, invite the team, and send the next invoice from tracked work.

What you get

  • Time tracking, invoices, expenses, and payments in one place.
  • Free for up to 5 users. Pro is $1/member/month.
  • Open source, with CLI, API, MCP, and self-hosting paths.
See Miru

The article is the argument. Miru is the workflow.

Track the work, approve the hours, send the invoice, and get paid without bolting together three separate tools.

Teams
Miru team management screen with members and roles
Team Miru