Skip to content

Add AGENTS.md - #39

Merged
illeatmyhat merged 5 commits into
mainfrom
agents-md
Jan 28, 2026
Merged

Add AGENTS.md#39
illeatmyhat merged 5 commits into
mainfrom
agents-md

Conversation

@illeatmyhat

@illeatmyhat illeatmyhat commented Jan 27, 2026

Copy link
Copy Markdown
Collaborator

Currently Bob will often make some very consistent errors when doing basic things like running unit tests.
Asking Bob for a feedback loop in making a high quality AGENTS.md file resulted in this
The rest of the changes are linting and formatting changes introduced by ruff.

Summary by CodeRabbit

  • Documentation

    • Added comprehensive AGENTS.md covering concepts, architecture, setup, testing, interfaces, and coding standards.
  • Chores

    • Updated ignore rules and dev linting configuration.
    • Updated baseline metadata timestamp and adjusted a test result entry.
  • Style / Refactor

    • Widespread formatting and inlining of code and tests for consistency.
  • Bug Fixes

    • Trajectories now print/export in deterministic descending timestamp order.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 27, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR is primarily stylistic and documentation: whitespace/formatting normalization, quote-style standardization, adds Ruff config and AGENTS.md, updates .secrets.baseline timestamp/line_number, adds __pycache__ to .gitignore, and sorts trajectories by timestamp (descending) in extract_trajectories.py.

Changes

Cohort / File(s) Summary
Build & Configuration
/.gitignore, pyproject.toml
Added __pycache__ to .gitignore; added Ruff to dev dependencies and [tool.ruff] config (line-length 140, indent-width 4).
Documentation
AGENTS.md
Added new documentation file describing Kaizen concepts, architecture, project layout, setup, testing, interfaces, and coding standards.
Secrets Metadata
.secrets.baseline
Updated top-level generated_at timestamp and adjusted a test result's line_number in results["tests/unit/test_extract_trajectories.py"] (486 → 408).
Core Implementation
extract_trajectories.py
Formatting and literal collapsing; deterministic ordering introduced by sorting trajectories by timestamp descending before output.
CLI Interface
kaizen/frontend/cli/cli.py
Minor prompt/message formatting changes (collapsed multi-line prompt, removed f-string wrapper) with no behavioral change.
Tests & Test Config
tests/conftest.py, tests/unit/test_cli.py, tests/unit/test_client.py, tests/unit/test_extract_trajectories.py
Removed unused imports/mocks, standardized quote styles, collapsed multi-line test literals to single-line forms — stylistic only.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • vinodmut
  • visahak

Poem

🐰 Hopping through the code with cheer,
Lines tucked tight and docs appear,
Ruff in the warren, tests trimmed neat,
Trajectories sorted, tidy and sweet. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.25% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'Add AGENTS.md' accurately summarizes the main change—a new documentation file—but does not capture the substantial linting and formatting work also included in this changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
extract_trajectories.py (2)

395-418: Guard sorting when timestamps are missing.
span.get("start_time") can be None; sorting with mixed None/str keys raises TypeError. Coalesce to a string (or a default) before sorting.

Suggested fix
-    trajectories.sort(key=lambda t: t.get("timestamp", ""), reverse=True)
+    trajectories.sort(key=lambda t: str(t.get("timestamp") or ""), reverse=True)

184-216: Add fallback for gen_ai.usage.total_tokens to prevent data loss.
The code uses gen_ai.usage.* for prompt_tokens and completion_tokens, but llm.usage.total_tokens for total_tokens. If spans still emit the legacy gen_ai.usage.total_tokens, this change will drop it to None. A safe fallback mirrors the pattern used in phoenix_sync.py.

Suggested fix
-    return {
+    total_tokens = attrs.get("llm.usage.total_tokens")
+    if total_tokens is None:
+        total_tokens = attrs.get("gen_ai.usage.total_tokens")
+
+    return {
         "trace_id": span["context"]["trace_id"],
         "span_id": span["context"]["span_id"],
         "model": attrs.get("gen_ai.request.model", "unknown"),
         "timestamp": span.get("start_time"),
         "messages": openai_messages,
         "usage": {
             "prompt_tokens": attrs.get("gen_ai.usage.prompt_tokens"),
             "completion_tokens": attrs.get("gen_ai.usage.completion_tokens"),
-            "total_tokens": attrs.get("llm.usage.total_tokens"),
+            "total_tokens": total_tokens,
         },
     }
🧹 Nitpick comments (1)
AGENTS.md (1)

17-41: Add language specifier to fenced code block.

The directory tree code block is missing a language specifier. Adding text or plaintext satisfies markdown linters.

📝 Proposed fix
 ## Project Directory Tree (Some files omitted for brevity)
-```
+```text
 .
 ├── demo (Files used by the Claude Code demo)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@AGENTS.md`:
- Line 18: The fenced code block in AGENTS.md currently uses an unspecified
language; change the opening fence from ``` to ```text so the block (the
tree/list starting with " . ├── demo (Files used by the Claude Code demo)")
specifies its language and renders with proper formatting and syntax
highlighting.
- Line 27: The tree line uses the wrong continuation character; replace the
leading continuation marker in the line containing "backend (Entity Database
Backend implementations, primarily vector databases)" so the vertical
continuation uses the box-drawing character │ instead of ├ (i.e., change the
tree prefix from "├   ├──" to "│   ├──" so the tree structure renders
correctly).
- Line 56: The command in AGENTS.md contains a stray trailing double-quote;
update the text `To override and run all: `uv run pytest -m 'e2e or unit or
phoenix'"` to remove the extra quote so it reads `To override and run all: uv
run pytest -m 'e2e or unit or phoenix'` (i.e., delete the final `"` character).

Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
@illeatmyhat
illeatmyhat merged commit 45ba53d into main Jan 28, 2026
11 checks passed
@visahak
visahak deleted the agents-md branch April 1, 2026 23:43
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