Skip to content

feat(cli): add /tag for multi-label session filtering#180

Merged
emal-avala merged 1 commit intomainfrom
feat/cmd-tag
Apr 23, 2026
Merged

feat(cli): add /tag for multi-label session filtering#180
emal-avala merged 1 commit intomainfrom
feat/cmd-tag

Conversation

@emal-avala
Copy link
Copy Markdown
Member

Summary

Adds /tag — multi-label session categorization that complements /rename (which is a single human-readable label). Tags let users filter /sessions by project / feature / mood / whatever.

Commands:

/tag                   list tags on the current session
/tag <tag>             add a tag (idempotent)
/tag --remove <tag>    remove one
/tag --clear           remove all
/sessions --tag <tag>  filter the session list

Tag normalization (services::session::normalize_tag):

  • lowercase, trimmed
  • alphanumeric + - / _ only
  • max 32 chars

Rejected tags get a clear error — no path-escape or shell-metachar leakage.

Implementation

  • SessionData.tags: Vec<String> with #[serde(default)] — existing session files load without tags and default to empty
  • add_session_tag / remove_session_tag use the same load-modify-save path as set_session_label, so the per-turn save hot path is untouched
  • SessionSummary.tags surfaces in /sessions as #tag1 #tag2 inline
  • /sessions --tag <t> retains only matching entries; invalid tag arg aborts with a clear error

Test plan

  • cargo fmt --all clean
  • cargo check passes
  • cargo clippy --no-deps clean
  • cargo test -p agent-code-lib --lib session — 21 pass, 3 new (normalize_tag accept/reject + old-JSON defaults-to-empty)
  • Manual: /tag wip then /sessions --tag wip shows only the current session

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Comment thread crates/cli/src/commands/mod.rs Fixed
@emal-avala emal-avala force-pushed the feat/cmd-tag branch 2 times, most recently from 02c5f30 to 20e3579 Compare April 23, 2026 02:54
Complements /rename (single human label) with a set of tags for
filtering. Tags are normalized (lowercase, alphanumeric + -/_, max
32 chars) so they're stable across case and punctuation variants.

- /tag                   list tags on current session
- /tag <tag>             add a tag
- /tag --remove <tag>    remove one
- /tag --clear           remove all
- /sessions --tag <tag>  filter the list

New SessionData.tags field (serde-default for backward compat),
normalize_tag / add_session_tag / remove_session_tag helpers on
services::session with load-modify-save semantics like set_session_label.
@emal-avala emal-avala merged commit cafe781 into main Apr 23, 2026
14 checks passed
@emal-avala emal-avala deleted the feat/cmd-tag branch April 23, 2026 04:09
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.

2 participants