Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .agents/scripts/aidevops-update-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,28 @@ main() {

echo "$output"

# Output runtime context hint for the AI model
local runtime_hint=""
case "$app_name" in
OpenCode)
runtime_hint="You are running in OpenCode. Global config: ~/.config/opencode/opencode.json"
;;
"Claude Code")
runtime_hint="You are running in Claude Code. Global config: ~/.config/Claude/Claude.json"
;;
esac
if [[ -n "$runtime_hint" ]]; then
echo "$runtime_hint"
fi

# Cache output for agents without Bash (e.g., Plan+)
local cache_dir="$HOME/.aidevops/cache"
mkdir -p "$cache_dir"
echo "$output" > "$cache_dir/session-greeting.txt"
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
Comment on lines +210 to +214

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"


# Check ralph upstream when in aidevops repo
check_ralph_upstream
Expand Down
15 changes: 15 additions & 0 deletions templates/opencode-config-agents.md
Original file line number Diff line number Diff line change
@@ -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. -->


## aidevops Framework Status

**On conversation start**:
1. If you have Bash tool: Run `bash ~/.aidevops/agents/scripts/aidevops-update-check.sh`
2. If no Bash tool: Read `~/.aidevops/cache/session-greeting.txt` (cached by agents with Bash)
3. Relay ALL lines from the output in your greeting. The first line is the version string, subsequent lines are runtime context. Format: "Hi!\n\nWe're running https://aidevops.sh v{version}. {runtime context}\n\nWhat would you like to work on?"
4. Then respond to the user's actual message

If update check output starts with `UPDATE_AVAILABLE|` (e.g., `UPDATE_AVAILABLE|current|latest|AppName`), inform user: "Update available (current → latest). Run `aidevops update` to update."

## Pre-Edit Git Check

Only for agents with Edit/Write/Bash tools. See ~/.aidevops/agents/AGENTS.md for workflow.