Skip to content

docs(claude): improve CLAUDE.md with architecture details#150

Merged
AnnatarHe merged 1 commit intomainfrom
docs/improve-claude-md
Dec 19, 2025
Merged

docs(claude): improve CLAUDE.md with architecture details#150
AnnatarHe merged 1 commit intomainfrom
docs/improve-claude-md

Conversation

@AnnatarHe
Copy link
Copy Markdown
Contributor

Summary

  • Add service interfaces documentation (ConfigService, AIService, CommandService)
  • Add daemon architecture section explaining SocketHandler, GoChannel, CCOtelServer
  • Document CCOtel feature and gRPC port configuration
  • Streamline package structure and configuration sections
  • Add AI service ldflags to build command documentation

Test plan

  • Verify CLAUDE.md renders correctly on GitHub
  • Confirm all documented paths and defaults match codebase

🤖 Generated with Claude Code

Add service interfaces documentation, daemon architecture section,
CCOtel feature documentation, and streamline existing content for
better Claude Code guidance.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @AnnatarHe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the CLAUDE.md documentation, providing a more in-depth understanding of the shelltime project's architecture. The updates focus on clarifying the daemon's operational mechanisms, detailing key service interfaces, and explaining configuration options, including the integration of the CCOtel feature. The goal is to make the project's internal workings more accessible and understandable for developers and contributors.

Highlights

  • Architecture Documentation: Added detailed documentation for service interfaces (ConfigService, AIService, CommandService) and the daemon's internal architecture, including SocketHandler, GoChannel, and CCOtelServer.
  • CCOtel Feature: Documented the CCOtel feature, its purpose for Claude Code metrics/logs passthrough, and its gRPC port configuration.
  • Build and Configuration Updates: Updated build command documentation to include AI service ldflags and streamlined configuration sections, clarifying paths and defaults.
  • Package Structure Refinement: Rewrote the package structure section for improved clarity and detail regarding the roles of cmd/cli, cmd/daemon, commands, daemon, and model packages.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@AnnatarHe AnnatarHe merged commit 79ffaa9 into main Dec 19, 2025
2 checks passed
@AnnatarHe AnnatarHe deleted the docs/improve-claude-md branch December 19, 2025 17:58
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 20.43% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly improves the CLAUDE.md documentation by restructuring the architecture section, adding details on service interfaces, and documenting new features like CCOtel. The changes make the documentation more streamlined and informative. My review focuses on ensuring the accuracy of this new information. I've found a few inconsistencies between the documentation and the codebase, particularly regarding default port numbers and dependency injection descriptions. I've also included a suggestion to improve the clarity of a build command example. Addressing these points will make the documentation even more reliable for developers.

Comment thread CLAUDE.md
- Main config: `$HOME/.shelltime/config.toml`
- Local overrides: `$HOME/.shelltime/config.local.toml` (merged, gitignored)
- Daemon socket: `/tmp/shelltime.sock` (configurable via `socketPath`)
- CCOtel gRPC port: configurable via `ccotel.grpcPort` (default: 4317)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There is an inconsistency in the default gRPC port for CCOtel. This documentation states the default is 4317, which is the standard for OTLP gRPC. However, the code consistently uses 54027 as the default (see model/config.go:139 and model/ccotel_env.go). Please update the documentation to reflect the correct default port used in the code.

Suggested change
- CCOtel gRPC port: configurable via `ccotel.grpcPort` (default: 4317)
- CCOtel gRPC port: configurable via `ccotel.grpcPort` (default: 54027)

Comment thread CLAUDE.md
- Daemon is optional but recommended (<8ms latency vs ~100ms+ direct)
- Encryption requires daemon mode and a token with encryption capability
- Shell hooks are platform-specific (bash, zsh, fish) - test on target shells
- CCOtel feature enables Claude Code metrics/logs passthrough via gRPC (port 4317) No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The CCOtel gRPC port mentioned here is inconsistent with the codebase. The documentation states port 4317, but the code's default is 54027. To avoid confusion, please update this line to match the actual default port.

Suggested change
- CCOtel feature enables Claude Code metrics/logs passthrough via gRPC (port 4317)
- CCOtel feature enables Claude Code metrics/logs passthrough via gRPC (port 54027)

Comment thread CLAUDE.md
# Build with version information
go build -ldflags "-X main.version=v0.1.0 -X main.commit=$(git rev-parse HEAD) -X main.date=$(date -u +%Y-%m-%d)" -o shelltime ./cmd/cli/main.go
# Build with all ldflags (version, commit, AI service config)
go build -ldflags "-X main.version=v0.1.0 -X main.commit=$(git rev-parse HEAD) -X main.date=$(date -u +%Y-%m-%d) -X main.ppEndpoint=<endpoint> -X main.ppToken=<token>" -o shelltime ./cmd/cli/main.go
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better clarity and to avoid ambiguity with other potential tokens or endpoints, it would be beneficial to use more specific placeholder names for the AI service configuration. Since the documentation later identifies the service as PromptPal, using names that reflect this would be more explicit.

Suggested change
go build -ldflags "-X main.version=v0.1.0 -X main.commit=$(git rev-parse HEAD) -X main.date=$(date -u +%Y-%m-%d) -X main.ppEndpoint=<endpoint> -X main.ppToken=<token>" -o shelltime ./cmd/cli/main.go
go build -ldflags "-X main.version=v0.1.0 -X main.commit=$(git rev-parse HEAD) -X main.date=$(date -u +%Y-%m-%d) -X main.ppEndpoint=<promptpal_endpoint> -X main.ppToken=<promptpal_token>" -o shelltime ./cmd/cli/main.go

Comment thread CLAUDE.md
- `AIService`: PromptPal integration for AI-powered command suggestions (`shelltime q`)
- `CommandService`: Executable lookup with fallback paths (handles daemon's limited PATH)

Injection happens in `cmd/*/main.go` via `commands.InjectVar()` and `commands.InjectAIService()`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This statement about dependency injection is slightly inaccurate. The injection of AIService only happens in cmd/cli/main.go, and cmd/daemon/main.go uses model.InjectVar instead of commands.InjectVar. To improve accuracy, it would be better to specify that this particular injection mechanism applies to the CLI.

Suggested change
Injection happens in `cmd/*/main.go` via `commands.InjectVar()` and `commands.InjectAIService()`.
Injection for the CLI happens in `cmd/cli/main.go` via `commands.InjectVar()` and `commands.InjectAIService()`.

Comment thread CLAUDE.md
### Daemon Architecture
1. **SocketHandler**: Unix domain socket server accepting JSON messages from CLI
2. **GoChannel**: Watermill pub/sub for decoupled message processing
3. **SocketTopicProcessor**: Consumes messages and routes to appropriate handlers
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a minor inconsistency between this documentation and the code. The name here is SocketTopicProcessor, but the function call in cmd/daemon/main.go:82 is daemon.SocketTopicProccessor (with a typo, an extra 'c'). While the spelling in this document is correct, it would be best to fix the typo in the Go code to ensure consistency across the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant