Skip to content

v0.8 [3/4]: CLI subcommands + hook template #74

@ashu17706

Description

@ashu17706

Part of #71. The user-facing surface — what an engineer actually types.

Scope

New `smriti daemon` subcommands in `src/index.ts`

  • `smriti daemon` — run the daemon in foreground (debugging, systemd target). Imports from `src/daemon/server.ts`
  • `smriti daemon install` — calls `src/daemon/install.ts`. Writes the appropriate service file and registers it
  • `smriti daemon uninstall` — reverses install
  • `smriti daemon status` — connect to socket, print: PID, uptime, pending project queues, last ingest timestamp per project. Falls back to PID-file inspection if socket is unresponsive
  • `smriti daemon stop` — graceful shutdown via socket message; falls back to PID-file SIGTERM after 2s
  • `smriti daemon logs` — tail `~/.cache/smriti/daemon.log` (`tail -f` semantics, Ctrl-C to exit)

Hook template update

  • Update the `save-memory.sh` template documented in `CLAUDE.md` to the poke-with-fallback form:
    ```bash
    #!/bin/bash
    SOCK="$HOME/.cache/smriti/daemon.sock"
    if [ -S "$SOCK" ]; then
    : | nc -U "$SOCK" 2>/dev/null
    else
    /usr/bin/lockf -t 0 /tmp/smriti-ingest.lock smriti ingest claude 2>/dev/null
    fi
    exit 0
    ```

First-run UX

  • If user runs `smriti search` / `smriti recall` and the daemon isn't installed, show a one-line nudge: "💡 `smriti daemon install` keeps your sessions auto-captured across agents." Show once per session, suppress with `SMRITI_NO_NUDGE=1`

Acceptance

  • `smriti daemon --help` shows all six subcommands with clear descriptions
  • All commands work when daemon is running and when it isn't (where applicable)
  • The hook template change is documented in `CLAUDE.md`'s quick reference
  • The first-run nudge appears exactly once and respects the suppression env var

Out of scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions