agentleFS
specstoryaispecstoryai/getspecstory/specstory-cli/CLAUDE.md

getspecstory / specstory-cli

CLAUDE.md1.3k starsChanged 6 months agoApache-2.0View on GitHub

SpecStory CLI is a wrapper for coding agents that tracks conversations and generates markdown files. The project uses the Go language and follows standard Go project conventions. The command is always built as specstory, located in the root of the repository. Don't try linting individual files. This often fails with noise in Go Lang, just lint the whole project, it's fast. There are two main modes of operation: To see debug output, you can use the following commands: The codebase…

Trending

More talk lately.thin dataabout the whole repository

Dec 2025: 0 mentionsJan 2026: 1 mentionFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 1 mentionAug 2026: 0 mentionsSep 2026: 2 mentionsOct 2026: 2 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the specstoryai/getspecstory repository that our weekly crawl found: only 8 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about specstoryai/getspecstory

The biggest 5 of 8 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 8

Talked about on GitHub, Hacker News and Bluesky (8 times).

On GitHub · 6

1 more on GitHub

On Hacker News · 1

The file

Show its rules and text

We split this CLAUDE.md into the rules it gives an agent

25 rules. About 0 are common, 19 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Don't try linting individual files.

    line 39
  2. Distinctive:

    When adding new features, track usage with PostHog:

    line 106
  3. Distinctive:

    Write only idomatic Go code.

    line 116
  4. Distinctive:

    Use Go lang libraries, not external dependencies where possible, if a dependency is needed explain why

    line 119
  5. Distinctive:

    Use "Why" comments, not "what" or "how" unless specifically requested

    line 121
  6. Distinctive:

    Use single function exit point where possible (immediate guard clauses are OK)

    line 122
  7. Very specific:

    Start wait-group goroutines with wg.Go(func() { ...

    line 124
  8. Distinctive:

    Follow existing patterns in the codebase

    line 125
  9. Distinctive:

    Write unit tests for things with complicated logic

    line 131
  10. Distinctive:

    Don't write unit tests for simple, tautological things

    line 132
  11. Very specific:

    Test files follow Go convention: *_test.go alongside source files in the same package

    line 133
  12. Distinctive:

    Use clear test function naming: TestFunctionName or TestFunctionName_Scenario

    line 137
  13. Distinctive:

    Test permission errors, missing files, invalid inputs

    line 144
  14. Distinctive:

    Never put text immediately after the header in markdown, put in a newline first.

    line 148
  15. Very specific:

    Use zsh code blocks in markdown (not bash)

    line 149
  16. Distinctive:

    Keep the repository README.md up to date with the latest changes.

    line 150
  17. Distinctive:

    When planning, never write time/calendar estimates into documents.

    line 151
  18. Very specific:

    When searching for code, ALWAYS exclude the .specstory directory.

    line 155
  19. Distinctive:

    Don't just make your own decision, explain the options, the pros and cons, and what you recommend.

    line 157
  20. Distinctive:

    Don't ever respond with just code changes.

    line 159
  21. Distinctive:

    Always ask before introducing any new dependencies.

    line 161
  22. Distinctive:

    Always ask before introducing any new code files.

    line 163
  23. Very specific:

    Run the linter after every code change golangci-lint run.

    line 165
  24. Very specific:

    Run tests after every major code change go test -v ./....

    line 167
  25. Distinctive:

    Don't just run commands, explain what you're doing and why.

    line 169

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to coding agents when working with code in this repository.

Project Overview

SpecStory CLI is a wrapper for coding agents that tracks conversations and generates markdown files. The project uses the Go language and follows standard Go project conventions.

Key Commands

Building

The command is always built as specstory, located in the root of the repository.

# Build for current platform
go build -o specstory

Testing

# Run all tests
go test ./...

# Run tests with verbose output
go test -v ./...

# Run tests for specific package
go test -v ./pkg/cli
go test -v ./pkg/utils

# Run specific test
go test -v -run TestGenerateFilename ./pkg/utils

Linting

Don't try linting individual files. This often fails with noise in Go Lang, just lint the whole project, it's fast.

# Run linter
golangci-lint run

# Format code
gofmt -w .

Running the CLI

There are two main modes of operation:

# Interactive interactive auto-save mode
./specstory run

# Sync mode - process all sessions
./specstory sync

# Sync mode - process specific session
./specstory sync -u <uuid>

Debugging

To see debug output, you can use the following commands:

# Debug output to stdout
./specstory sync --debug

# Debug log output in ./.specstory/debug/debug.log
./specstory sync --log

# Hidden debug flag (not in public docs)
./specstory sync --debug-raw          # Debug mode to output pretty-printed raw data files

Technical Details

Code Structure

The codebase package structure:

  • main.go - CLI entry point
  • pkg/analytics/ - PostHog analytics integration
  • pkg/cloud - Cloud sync integration
  • pkg/cmd - CLI commands and command parsing
  • pkg/config - Optional TOML config file handling
  • pkg/log/ - Logging utilities
  • pkg/provenance/ - Optional AI provenance tracking
  • pkg/redact/ - Secret redaction (betterleaks) shared by markdown generation and cloud sync
  • pkg/providers/* - Provider implementations including file watching, data processing, and session data generation
  • pkg/session/ - Session data validation, helpers and markdown generation
  • pkg/spi/ - SPI implementation for provider implementations
  • pkg/utils/ - Helper functions

JSONL File Behavior

  • Session data files grow during conversation (append-only)
  • run and watch commands uses fsnotify for real-time monitoring of the agent's session data directory
  • Many agents (e.g. Claude Code) use JSONL files for session data (e.g. ~/.claude/projects/<dir-derived-from-project-dir>/<session-id>.jsonl)

Analytics Events

When adding new features, track usage with PostHog:

analytics.TrackEvent(analytics.EventExtensionActivated, analytics.Properties{
	"property": "value",
})

Code Conventions

  • Write only idomatic Go code.
  • Prioritize simplicity and readability over terse or clever code
  • Emphasize DRY code, look for existing code that can be reused, don't just write new code first.
  • Use Go lang libraries, not external dependencies where possible, if a dependency is needed explain why
  • Comment everything that's not obvious, if in doubt, comment it.
  • Use "Why" comments, not "what" or "how" unless specifically requested
  • Use single function exit point where possible (immediate guard clauses are OK)
  • Provide consistent observability and tracing with log/slog for logging, not fmt.Println or fmt.Printf
  • Start wait-group goroutines with wg.Go(func() { ... }), never wg.Add(1) plus go func() { defer wg.Done() ... }(). The pairing is what goes wrong: an Add without its Done, or a Done that lives in a different function from its Add, deadlocks Wait or panics. wg.Go makes them inseparable.
  • Follow existing patterns in the codebase
  • The application supports macOS, Linux (including WSL), and native Windows. Keep all three platforms working: guard OS-specific code by runtime.GOOS or build tags, and prefer shape-based path handling (e.g. drive-letter detection) over GOOS checks where data written on one OS is read on another.

Testing Strategy & Conventions

  • Tests use Go's standard testing package
  • Write unit tests for things with complicated logic
  • Don't write unit tests for simple, tautological things
  • Test files follow Go convention: *_test.go alongside source files in the same package
  • Table-driven tests: tests are structured with test cases defined in slices of structs
    • Each struct contains: name, input parameters, and expected results
    • Uses t.Run(tt.name, func(t *testing.T) {...}) for subtests
  • Use clear test function naming: TestFunctionName or TestFunctionName_Scenario
  • Make manual assertions using t.Errorf()
  • Unit Tests: Most tests focus on individual functions
  • Edge Case Testing: Comprehensive coverage of error conditions, empty inputs, invalid data
  • Integration-style Tests: Some tests like TestSessionProcessingFlow test multiple components together
  • Tests both success and failure paths
  • Validates error messages contain expected strings
  • Test permission errors, missing files, invalid inputs

Writing Conventions

  • Never put text immediately after the header in markdown, put in a newline first.
  • Use zsh code blocks in markdown (not bash)
  • Keep the repository README.md up to date with the latest changes.
  • When planning, never write time/calendar estimates into documents.

Development Workflow

When searching for code, ALWAYS exclude the .specstory directory.

Don't just make your own decision, explain the options, the pros and cons, and what you recommend. Have the user make the decision.

Don't ever respond with just code changes. Always include explanations of what you're doing, why you're doing it, and how.

Always ask before introducing any new dependencies.

Always ask before introducing any new code files.

Run the linter after every code change golangci-lint run. Fix formatting errors yourself with gofmt -w ..

Run tests after every major code change go test -v ./....

Don't just run commands, explain what you're doing and why.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.