Skip to content

feat: add runtime context hint to session greeting#419

Merged
marcusquinn merged 2 commits intomainfrom
chore/greeting-runtime-context
Feb 7, 2026
Merged

feat: add runtime context hint to session greeting#419
marcusquinn merged 2 commits intomainfrom
chore/greeting-runtime-context

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 7, 2026

Summary

  • Adds app-specific runtime context (config path) to the session greeting output so the AI model knows where settings are stored without guessing
  • Includes managed template (templates/opencode-config-agents.md) for the OpenCode config-level AGENTS.md greeting instructions
  • Also updates the greeting cache for agents without Bash access

Tested: new sessions now show You are running in OpenCode. Global config: ~/.config/opencode/opencode.json in the greeting context.

Summary by CodeRabbit

  • Chores
    • Updated agent initialization with improved runtime context detection
    • Enhanced caching mechanisms for developer tool configuration and session management

Output app-specific config paths (e.g. OpenCode global config location)
after the version line so the AI model knows where settings are stored.
Also adds managed template for the OpenCode config-level AGENTS.md.
@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, 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 AI model's operational awareness by embedding crucial runtime context, such as the application name and its global configuration path, directly into the session greeting. This change aims to provide AI models with explicit environmental information, reducing the need for inference and enabling more accurate and context-aware responses. It also includes a new template to guide OpenCode agents on how to properly handle and present this enriched greeting, ensuring consistent behavior across different agent types.

Highlights

  • Runtime Context Hint: Introduced logic to dynamically generate and output an app-specific runtime context hint (e.g., application name and global configuration path) for AI models, improving their awareness of the operating environment.
  • New Template for OpenCode Agents: Added a new markdown template (templates/opencode-config-agents.md) that provides detailed instructions for OpenCode agents on how to retrieve, format, and relay session greetings, including the new runtime context.
  • Enhanced Greeting Cache: Updated the session greeting caching mechanism to ensure that agents without Bash access (e.g., Plan+) also receive the full greeting, including the newly added runtime context hint.
Changelog
  • .agents/scripts/aidevops-update-check.sh
    • Added a case statement to determine the runtime_hint based on the app_name (e.g., OpenCode, Claude Code) and include the global configuration path.
    • Modified the script to echo the runtime_hint directly to the console if present.
    • Updated the caching logic for session-greeting.txt to include both the original output and the new runtime_hint using printf for better formatting control.
  • templates/opencode-config-agents.md
    • New file added, providing instructions for AI agents on how to integrate ~/.aidevops/agents/AGENTS.md into their context.
    • Details the process for agents to run aidevops-update-check.sh or read the cached greeting, and how to format the greeting output.
    • Includes guidance on informing users about available updates and performing pre-edit Git checks.
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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 7, 2026

Warning

Rate limit exceeded

@marcusquinn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 47 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

The changes implement runtime context detection in the update-check script to identify the running application (OpenCode or Claude Code) and append this hint to version output. A new configuration template documents the agent initialization workflow, including update-check script execution and caching behavior for session greetings.

Changes

Cohort / File(s) Summary
Update-check Script Enhancement
.agents/scripts/aidevops-update-check.sh
Added runtime context hint detection based on the running app environment, extended caching logic to store both output and hint in the session greeting file.
Agent Configuration Template
templates/opencode-config-agents.md
New documentation file defining aidevops agent initialization workflow, including update-check script execution, fallback caching behavior, and guidance for relaying runtime context hints.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • PR #219: Modifies the same update-check script to detect and append running app context to session greeting with caching adjustments
  • PR #248: Updates .agents/scripts/aidevops-update-check.sh for version-file selection logic and readability checks on the same component

Poem

🔍 The script now knows which app it calls home,
Appending hints as it roams,
Caching greetings with contextual flair,
From OpenCode to Claude—awareness in the air! 🚀

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 title 'feat: add runtime context hint to session greeting' directly and clearly describes the main change: adding runtime context information to the session greeting output.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/greeting-runtime-context

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 25 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Sat Feb 7 04:28:23 UTC 2026: Code review monitoring started
Sat Feb 7 04:28:23 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 25
Sat Feb 7 04:28:23 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Sat Feb 7 04:28:25 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 25
  • VULNERABILITIES: 0

Generated on: Sat Feb 7 04:28:28 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

Copy link

@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 adds a runtime context hint to the session greeting, which is a helpful feature for the AI model to locate configuration files. The implementation is sound, and it also introduces a new template for agent instructions. I have provided a couple of suggestions to enhance the clarity and maintainability of the shell script and the new markdown template.

Comment on lines +210 to +214
if [[ -n "$runtime_hint" ]]; then
printf '%s\n%s\n' "$output" "$runtime_hint" > "$cache_dir/session-greeting.txt"
else
echo "$output" > "$cache_dir/session-greeting.txt"
fi

Choose a reason for hiding this comment

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

medium

The logic for caching the session greeting can be simplified to improve readability and maintainability. Instead of an if/else block with output redirection in each branch, you can use a subshell to group the commands and redirect the output once. This makes the intent clearer and the code easier to follow.

Suggested change
if [[ -n "$runtime_hint" ]]; then
printf '%s\n%s\n' "$output" "$runtime_hint" > "$cache_dir/session-greeting.txt"
else
echo "$output" > "$cache_dir/session-greeting.txt"
fi
(
echo "$output"
if [[ -n "$runtime_hint" ]]; then
echo "$runtime_hint"
fi
) > "$cache_dir/session-greeting.txt"

@@ -0,0 +1,15 @@
Add ~/.aidevops/agents/AGENTS.md to context for AI DevOps capabilities.

Choose a reason for hiding this comment

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

medium

The first line of this file appears to be a meta-instruction for developers rather than for the AI agent. As plain text, it could be misinterpreted by the agent. If this is a note for humans, it's best practice to enclose it in a Markdown comment to avoid confusion.

Suggested change
Add ~/.aidevops/agents/AGENTS.md to context for AI DevOps capabilities.
<!-- Add ~/.aidevops/agents/AGENTS.md to context for AI DevOps capabilities. -->

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

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

⚠️ Outside diff range comments (1)
.agents/scripts/aidevops-update-check.sh (1)

163-167: ⚠️ Potential issue | 🟡 Minor

Runtime hint and cache are skipped on the UPDATE_AVAILABLE early-return path.

When an update is available (line 165), main returns before reaching the runtime hint output (line 193) and cache write (line 210). This means:

  1. The AI model won't receive the runtime context hint when an update is pending.
  2. The cached session-greeting.txt won't be refreshed — agents without Bash will see a stale greeting.

If this is intentional (the update banner is a distinct flow), a brief comment would help future maintainers understand the design choice. If it's unintentional, the hint and cache logic should be hoisted above the early return or duplicated in the update branch.

Also applies to: 193-214

🤖 Fix all issues with AI agents
In @.agents/scripts/aidevops-update-check.sh:
- Around line 193-205: The runtime hint for the "Claude Code" case uses an
incorrect config path; update the assignment to runtime_hint inside the case
pattern "Claude Code") so it reads the correct global settings path
(~/.claude/settings.json) instead of ~/.config/Claude/Claude.json, ensuring the
variable runtime_hint contains the accurate hint string that will be echoed
later.

In `@templates/opencode-config-agents.md`:
- Line 11: The template's documented UPDATE_AVAILABLE format is wrong — the
script emits four fields (UPDATE_AVAILABLE|$current|$remote|$app_name) not
three; update the example and user message in the template to match that format
(e.g., `UPDATE_AVAILABLE|current|latest|app_name`) and show how agents should
parse it (include app_name in the displayed message, e.g., "Update available
(app_name: current → latest). Run `aidevops update` to update."). Ensure you
reference the UPDATE_AVAILABLE token and the $current, $remote, $app_name fields
so parsing logic and examples align with the script output.

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 25 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Sat Feb 7 04:32:34 UTC 2026: Code review monitoring started
Sat Feb 7 04:32:34 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 25
Sat Feb 7 04:32:34 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Sat Feb 7 04:32:36 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 25
  • VULNERABILITIES: 0

Generated on: Sat Feb 7 04:32:39 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 7, 2026

@marcusquinn
Copy link
Owner Author

@coderabbitai resolve

Fixed the UPDATE_AVAILABLE format mismatch in the template (now shows 4 fields matching the script).

The other two items:

  • Early return skipping hint: By design - the update banner is a distinct flow. The hint is for normal sessions.
  • Claude Code config path: Moot - we only run in OpenCode. The Claude Code path is a fallback that may never be used.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 7, 2026

@marcusquinin, thank you for addressing the UPDATE_AVAILABLE format issue and clarifying the design decisions!

Format fix confirmed - The 4-field UPDATE_AVAILABLE format now matches the script output.

Design explanations accepted:

  • Early return for updates is intentionally separate from the normal session greeting flow - makes sense to keep the update banner distinct.
  • Claude Code fallback path noted as rarely/never used since OpenCode is the primary runtime.

I'll resolve all the review comments now.


✏️ Learnings added
Learnt from: marcusquinn
URL: https://github.com/marcusquinn/aidevops/pull/419

Timestamp: 2026-02-07T04:34:07.008Z
Learning: In .agents/scripts/aidevops-update-check.sh, the early return for UPDATE_AVAILABLE is by design - the update banner flow is intentionally separate from the normal session greeting flow with runtime hints.

Learnt from: marcusquinn
URL: https://github.com/marcusquinn/aidevops/pull/419

Timestamp: 2026-02-07T04:34:07.008Z
Learning: The aidevops framework primarily runs in OpenCode. The Claude Code config path detection is a fallback that may never be used in practice.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

✅ Actions performed

Comments resolved and changes approved.

@marcusquinn marcusquinn merged commit b2aa4ac into main Feb 7, 2026
11 checks passed
@marcusquinn marcusquinn deleted the chore/greeting-runtime-context branch February 7, 2026 04:34
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