Skip to content

feat: suppress --append-system-prompt from args display, add Resuming line for --goto#34

Merged
brianruggieri merged 3 commits into
mainfrom
copilot/improve-startup-messaging
Mar 16, 2026
Merged

feat: suppress --append-system-prompt from args display, add Resuming line for --goto#34
brianruggieri merged 3 commits into
mainfrom
copilot/improve-startup-messaging

Conversation

Copilot AI commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Two startup output improvements: the inline AI context system prompt was leaking into the "Claude args" display, and --goto session restores gave no confirmation of what was resumed.

Summary

  • Filters --append-system-prompt + its value from the startup "Claude args" line — keeps internal injection details out of user-facing output while still showing any real user-supplied args
  • Emits ℹ Resuming: <title> in the startup block when --goto successfully matches a saved session

Changes

  • bin/ccp: Added restored_title local; set on --goto match; startup block now shows "Resuming:" when set, and builds a filtered display_args array that strips --append-system-prompt pairs before printing
  • tests/test-suite.sh: Added assert_not_contains helper + 5 tests covering: inline hides prompt arg, extra user args still appear, --goto emits "Resuming:" with correct title

Before/after for inline strategy with no extra args:

# Before
ℹ Claude args: --append-system-prompt [CCP Terminal Title] As your very first action...

# After
(line absent — nothing user-relevant to show)

Testing

  • shellcheck bin/ccp lib/*.sh install.sh uninstall.sh passes
  • bash tests/test-suite.sh passes (170 tests)
  • Manually tested on macOS with iTerm2 / Terminal.app / tmux

Checklist

  • Code follows the Google Shell Style Guide
  • New functions have a one-line description comment
  • Documentation updated (if behavior changed)
  • CHANGELOG.md updated under [Unreleased]
Original prompt

This section details on the original issue you should resolve

<issue_title>feat: improve startup messaging — suppress verbose args, add session-resume context</issue_title>
<issue_description>## Problem

Two gaps in the startup output block (bin/ccp ~line 394–410):

1. --append-system-prompt floods the Claude args line

When --ai-context-strategy inline is active, claude_args contains the full inline system prompt (~200 chars). The existing "Claude args" display prints it verbatim:

ℹ Claude args: --append-system-prompt [CCP Terminal Title] As your very first action, run a single bash...

This is noisy and leaks internal implementation detail to the user.

2. No session-resume context shown

When --goto <title> successfully matches and restores a session, the startup block shows nothing about what was restored. A brief line like:

ℹ Resuming: Fix Auth Bug

would confirm to the user that the resume worked.


Proposed Fix

1. Filter --append-system-prompt from the Claude args display

In the "Claude args" display block (bin/ccp ~line 408), build a filtered copy of claude_args that omits --append-system-prompt and its following value before printing:

if [[ ${#claude_args[@]} -gt 0 ]]; then
    local display_args=()
    local skip_next=false
    for arg in "${claude_args[@]}"; do
        if [[ "${skip_next}" == true ]]; then
            skip_next=false
            continue
        fi
        if [[ "${arg}" == "--append-system-prompt" ]]; then
            skip_next=true
            continue
        fi
        display_args+=("${arg}")
    done
    if [[ ${#display_args[@]} -gt 0 ]]; then
        log_info "Claude args:    ${display_args[*]}"
    fi
fi

2. Show restored session context on --goto match

After a successful session restore in the --goto path, capture the restored title and emit it in the startup block. The restored title is already available from find_session output — store it in a variable (e.g. restored_title) and print:

if [[ -n "${restored_title:-}" ]]; then
    log_info "Resuming:       ${restored_title}"
fi

Files

  • bin/ccp — both changes live here; startup display block ~line 394, --goto handling ~line 340–360

Testing

  • Run ccp --ai-context --ai-context-strategy inline — "Claude args" line should be absent (no other extra args passed)
  • Run ccp --ai-context --ai-context-strategy inline -- --some-flag — "Claude args" should show --some-flag only
  • Run ccp --goto "some saved title" on a repo with a saved session — should show ℹ Resuming: <title>
  • Run ccp --goto "nonexistent" — no "Resuming" line shown
    </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

… line for --goto

Co-authored-by: brianruggieri <2104689+brianruggieri@users.noreply.github.com>
Copilot AI changed the title [WIP] [ISSUE-123] Improve startup messaging by suppressing verbose args feat: suppress --append-system-prompt from args display, add Resuming line for --goto Mar 13, 2026
Copilot AI requested a review from brianruggieri March 13, 2026 00:11

@brianruggieri brianruggieri left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Code reviewed. All 180 tests pass, shellcheck is clean, no Bash 3.2 incompatibilities.

Changes reviewed:

  • --append-system-prompt filtering from args display: correctly handles the two-element (flag + value) form, which is the only way it enters claude_args. Edge cases (no args, only --append-system-prompt, mixed args) all covered by tests.
  • Resuming: line for --goto: straightforward, correctly set only when find_session_title succeeds.
  • assert_not_contains test helper: follows existing pattern.
  • 5 new tests cover the claimed behavior well.

One minor fix pushed: Removed excess padding on the "Resuming:" label so it aligns with the "Starting:" / "Directory:" group above it rather than the "Dynamic titles:" settings block below.

Note: When fix/status-write-improvements merges, there will be a textual conflict at the end of tests/test-suite.sh (both branches append tests before the Summary section). It's a trivial append conflict to resolve.

@brianruggieri
brianruggieri marked this pull request as ready for review March 16, 2026 18:02
Copilot AI review requested due to automatic review settings March 16, 2026 18:02
@brianruggieri
brianruggieri merged commit 141d6fc into main Mar 16, 2026
4 checks passed
@brianruggieri
brianruggieri deleted the copilot/improve-startup-messaging branch March 16, 2026 18:02

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 refines ccp startup output to avoid exposing internal inline-context prompt injection details and to provide clearer feedback when resuming sessions via --goto.

Changes:

  • Adds a Resuming: <title> startup line when --goto successfully restores a session.
  • Filters --append-system-prompt (and its value) out of the user-facing “Claude args” startup display.
  • Extends the shell test suite with assert_not_contains and new startup messaging tests.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.

File Description
bin/ccp Adds restored_title for --goto resumes and filters --append-system-prompt from the printed Claude args.
tests/test-suite.sh Adds assert_not_contains and new tests intended to verify args filtering and --goto resume messaging.

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

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tests/test-suite.sh
Comment on lines +1059 to +1073
"${BIN_CCP}" --ai-context --ai-context-strategy inline --no-dynamic "messaging test" \
>"${cli_out}" 2>&1 || true
assert_not_contains "bin/ccp: inline strategy hides --append-system-prompt from args display" \
"--append-system-prompt" "$(cat "${cli_out}" 2>/dev/null || true)"

# Extra user-supplied args should still appear when --append-system-prompt is also injected
cli_out2="${CLI_TMP_DIR}/startup-inline-extra.out"
CCP_CLAUDE_CMD=/usr/bin/true CCP_STATUS_PROFILE=quiet \
STATE_DIR="${CLI_STATE_DIR}" SESSION_FILE="${CLI_SESSION_FILE}" \
"${BIN_CCP}" --ai-context --ai-context-strategy inline --no-dynamic "messaging test" -- --some-flag \
>"${cli_out2}" 2>&1 || true
assert_contains "bin/ccp: extra args still shown when inline strategy active" \
"--some-flag" "$(cat "${cli_out2}" 2>/dev/null || true)"
assert_not_contains "bin/ccp: --append-system-prompt still hidden when extra args present" \
"--append-system-prompt" "$(cat "${cli_out2}" 2>/dev/null || true)"
Comment thread tests/test-suite.sh
Comment on lines +1064 to +1069
# Extra user-supplied args should still appear when --append-system-prompt is also injected
cli_out2="${CLI_TMP_DIR}/startup-inline-extra.out"
CCP_CLAUDE_CMD=/usr/bin/true CCP_STATUS_PROFILE=quiet \
STATE_DIR="${CLI_STATE_DIR}" SESSION_FILE="${CLI_SESSION_FILE}" \
"${BIN_CCP}" --ai-context --ai-context-strategy inline --no-dynamic "messaging test" -- --some-flag \
>"${cli_out2}" 2>&1 || true
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.

feat: improve startup messaging — suppress verbose args, add session-resume context

3 participants