AI Agent Use Cases

Added today

44All 189

Prompt to Prepare a Shopping Cart from a Recipe Photo

The author reports that Grok Bot receives a recipe photo, organizes the ingredients and quantities, and creates a shopping list by excluding ingredients already available at home.

Grok Bot
Life & Hobbies

1–20 of 189

DevWalkthrough

Adding a Check to Prevent the Agent from Making Up Timestamps

The author blocked Claude Code from guessing and entering timestamps in operation logs by adding a script that checks just before tool execution.

How it works

  1. The author reports that Claude Code often wrote unverified timestamps while keeping long operation logs. Even when these were written to a memory file, the same issue kept happening.
  2. The author created a Python pre-tool-use hook that runs just before command execution, file writing, modification, or message sending. If a guessed time like '16:4x' is detected, the script blocks the action and instructs the agent to read the clock using the date command at the same step.
  3. Because Python might not find the script, which could result in exit code 2 and block all execution, the author added a short wrapper that only blocks on a custom exit code 3. The configuration file was updated with a script that backs it up and adds just one key.

Results

In less than two hours after setup, the author reports that an attempt to enter a guessed timestamp into a note was blocked, and the agent then read the clock and entered the correct time.

Notes

The author notes that this check does not catch rounded times without an 'x' (like 06:00) or regular chat responses.

Source

Reddit Original post ↗

Example prompt · Claude Code

Set up a check to prevent Claude Code from entering unverified timestamps in operation logs.

Input: Claude Code configuration file location [path], log file format [e.g., markdown log], patterns to block [e.g., 16:4x, xx:xx as placeholders], your operating system [OS]. First, check the official documentation for your current Claude Code version to see what input the pre-tool-use hook receives and which exit code blocks execution.

Create a Python script that checks only the new content added just before command execution, file writing/modification, or message sending. If a guessed timestamp pattern is found, block the action and return a message at the same step instructing the agent to read the system clock and use that value. Do not block old entries already in the file, so cleanup is possible. Add a short wrapper to distinguish between exit codes caused by missing scripts/errors and actual blocks, only blocking on your custom block code.

Do not edit the configuration file by hand; instead, use a script that backs it up and adds just one hook entry, then reread it to confirm other permissions remain unchanged. Include instructions for reverting the changes.

Deliverables: check script, wrapper, configuration update script, and revert instructions. In a test folder, try one write with a guessed timestamp and one with a correct time to confirm only the former is blocked.