Skip to content

fix(learner): make ace-learn logs informative and user-friendly#111

Open
withsivram wants to merge 1 commit into
kayba-ai:mainfrom
withsivram:fix/informative-logs-issue-74
Open

fix(learner): make ace-learn logs informative and user-friendly#111
withsivram wants to merge 1 commit into
kayba-ai:mainfrom
withsivram:fix/informative-logs-issue-74

Conversation

@withsivram

Copy link
Copy Markdown

Summary

Users running ace-learn had no visibility into what was happening — the progress output was opaque and silent. This adds clear, step-by-step progress messages at every key stage:

  • "Scanning for latest Claude Code session..." on startup
  • Session ID, transcript path, and project displayed before analysis
  • "Analyzing session..." with session ID and line count
  • "Running Reflector (analyzing session patterns)..." during Reflector
  • "Running SkillManager (extracting strategies)..." during SkillManager
  • Per-session strategy summary: "N added, M updated, K removed"
  • Final summary: total strategies in skillbook and net change
  • --verbose flag now shows task context, feedback, and per-strategy details

Also adjusts logging level to WARNING when not verbose (was INFO) since user-facing messages are now delivered via print() directly.

Test plan

  • Run ace-learn → see step-by-step progress messages
  • Run ace-learn --verbose → see additional detail per strategy
  • Run with no sessions available → see clear "no sessions found" message
  • Verify no duplicate output from both print() and logger

Fixes #74

🤖 Generated with Claude Code

Users running `ace-learn` had no visibility into what was happening —
the progress output was opaque and silent. This commit adds clear,
step-by-step progress messages at every key stage of the learn command:

- "Scanning for latest Claude Code session..." on startup
- Session ID, transcript path, and project displayed before analysis
- "Analyzing session..." with session ID and line count indented below
- "Running Reflector (analyzing session patterns)..." during Reflector
- "Running SkillManager (extracting strategies)..." during SkillManager
- Per-session strategy summary: "N added, M updated, K removed"
- Final summary: total strategies in skillbook and net change this session
- --verbose flag now shows task context, feedback, and per-strategy details

Also adjusts logging level to WARNING when not verbose (was INFO) since
user-facing messages are now delivered via print() directly, keeping the
logger for debug/internal tracing only.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Copilot AI review requested due to automatic review settings March 20, 2026 16:34

Copilot AI 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.

Pull request overview

This PR improves the ace-learn CLI user experience by adding explicit, step-by-step progress output (primarily via print()), and adjusts default logging verbosity to reduce noise when not running in verbose mode.

Changes:

  • Add user-facing progress messages during transcript discovery and session analysis.
  • Add verbose mode details (task context, feedback, and per-operation strategy details).
  • Change default logging level to WARNING when not verbose.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +829 to 831
print(" Running Reflector (analyzing session patterns)...")
logger.info("Running Reflector...")
reflection = self._run_reflector_with_retry(

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

When --verbose is enabled, this prints a user-facing progress line and also logs Running Reflector... at INFO, which results in duplicate progress output (stdout + stderr). Prefer making the logger call DEBUG, or suppressing one of the two in verbose mode.

Copilot uses AI. Check for mistakes.
Comment on lines +838 to 840
print(" Running SkillManager (extracting strategies)...")
logger.info("Running SkillManager...")
skill_manager_output = self._run_skill_manager_with_retry(

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

Same duplication issue as Reflector: in verbose mode you'll get both the print(...) progress message and logger.info("Running SkillManager..."). Consider using DEBUG for the logger message or gating one of them.

Copilot uses AI. Check for mistakes.
Comment on lines +813 to +816
if verbose:
print(f" Task context: {task[:100]}{'...' if len(task) > 100 else ''}")
print(f" Feedback: {feedback}")

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

New verbose behavior introduces additional stdout output (task context + feedback) but there are no existing unit tests covering verbose=True/False output differences. Consider adding tests (e.g., using pytest capsys) to assert the presence/absence of these lines so future refactors don’t regress the CLI UX.

Copilot uses AI. Check for mistakes.
Comment on lines +991 to +992
print("Analyzing session...")
success = learner.learn_from_transcript(

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

PR description says the "Analyzing session..." step should include the session ID and line count, but this message is currently generic. Either include {session_id} / {lines_desc} here, or update the PR description to match the actual output.

Copilot uses AI. Check for mistakes.
Comment on lines 779 to 783
Args:
transcript_path: Path to Claude Code transcript JSONL
start_line: Start learning from this line (for incremental learning)
verbose: Print detailed progress to stdout

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

The verbose parameter docstring says it controls printing detailed progress, but this method now prints multiple progress lines even when verbose=False (session id, Reflector/SkillManager, strategy summary). Update the docstring to reflect that verbose only enables additional details, or gate the non-verbose prints behind verbose as well to match the documentation.

Copilot uses AI. Check for mistakes.
Comment on lines 794 to 796
logger.info(
f"Skipping trivial session ({actual_lines} lines, minimum {MIN_LINES})"
)

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

In verbose mode (logging.basicConfig(... level=DEBUG)), this will emit logger.info(...) and also print(...), causing duplicated user-facing messages. Consider either removing the logger.info here, downgrading it to logger.debug, or wrapping it in if not verbose to avoid duplicate output.

Suggested change
logger.info(
f"Skipping trivial session ({actual_lines} lines, minimum {MIN_LINES})"
)
if not verbose:
logger.info(
f"Skipping trivial session ({actual_lines} lines, minimum {MIN_LINES})"
)

Copilot uses AI. Check for mistakes.
Comment on lines +825 to +827
# Count skills before update so we can report the delta
skills_before = len(self.skillbook.skills())

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

skills_before is assigned but never used, which looks like leftover code and can trigger linting failures. Either remove it, or use it to report a per-transcript net change after _persist_skillbook_update(...) succeeds.

Suggested change
# Count skills before update so we can report the delta
skills_before = len(self.skillbook.skills())

Copilot uses AI. Check for mistakes.
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.

Make logs more informative for user

2 participants