openclaw - 💡(How to fix) Fix feat(exec): add optional description field for intent-based hook审批 [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#61562Fetched 2026-04-08 02:57:18
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

Code Example

{
  "command": "rm -rf ./node_modules",
  "description": "Clean install dependencies"  // ← new optional field
}

---

// hook approval logic
const isDestructive = desc => [delete, remove, drop, clean].some(k => desc.includes(k));
if (isDestructive(description)) {
  // prompt user for confirmation
}
RAW_BUFFERClick to expand / collapse

Motivation

The current hook system relies on pattern matching against the command field, which makes it difficult to implement intent-based approval flows. Adding a description field to the exec tool would allow hooks to understand the purpose of a command rather than just its text pattern.

Proposed Solution

Add an optional description field to the exec tool schema:

{
  "command": "rm -rf ./node_modules",
  "description": "Clean install dependencies"  // ← new optional field
}

Hook scripts can then use this description to make smarter approval decisions, e.g.:

// hook approval logic
const isDestructive = desc => [delete, remove, drop, clean].some(k => desc.includes(k));
if (isDestructive(description)) {
  // prompt user for confirmation
}

Alternatives Considered

  • Pattern matching on command: Already possible but brittle (e.g. rm can mean legitimate cleanup or data deletion)
  • LLM-based classification: Requires external API calls; description provides explicit intent

Impact

  • Minimal: fully backward-compatible, description is purely optional
  • Enables: smarter hooks, safer defaults, better audit trails

extent analysis

TL;DR

Add an optional description field to the exec tool schema to enable intent-based approval flows in hooks.

Guidance

  • Update the exec tool schema to include the optional description field as proposed.
  • Modify hook scripts to utilize the new description field for smarter approval decisions, such as the provided isDestructive function example.
  • Test the updated hook scripts with various description values to ensure correct approval flow behavior.
  • Consider adding documentation for the new description field to inform users of its purpose and usage.

Example

{
  "command": "rm -rf ./node_modules",
  "description": "Clean install dependencies"
}

And the corresponding hook approval logic:

const isDestructive = desc => [delete, remove, drop, clean].some(k => desc.includes(k));
if (isDestructive(description)) {
  // prompt user for confirmation
}

Notes

The proposed solution is fully backward-compatible, as the description field is optional. However, the effectiveness of the intent-based approval flows relies on users providing accurate and descriptive values for the description field.

Recommendation

Apply the proposed workaround by adding the description field to the exec tool schema, as it enables smarter hooks and safer defaults without introducing significant changes or dependencies.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix feat(exec): add optional description field for intent-based hook审批 [1 participants]