Skip to content

fix: require actual system time for audit timestamps#56

Merged
raj-jain-aws merged 4 commits intoawslabs:mainfrom
jimini55:fix/audit-timestamp-accuracy
Feb 10, 2026
Merged

fix: require actual system time for audit timestamps#56
raj-jain-aws merged 4 commits intoawslabs:mainfrom
jimini55:fix/audit-timestamp-accuracy

Conversation

@jimini55
Copy link
Copy Markdown
Contributor

AI tools often fabricate timestamps (e.g., 00:00, 00:01 patterns) or capture incorrect time. This adds explicit instruction to execute a system command and use local timezone with offset for human readability.

Issue #, if available: #55

Description of changes:

Summary

AI tools fabricate timestamps in audit.md instead of capturing actual time. This adds explicit instruction to execute a system command for real timestamps.

Problem Observed

  • Placeholder patterns: 00:00:00, 00:01:00, 00:02:00...
  • Incorrect time even when date tool was used (minutes didn't match)
  • Issue observed on: Claude (via Claude Code), Cursor
  • Reproducible: Start any AIDLC workflow and check audit.md timestamps

Change

  • Requires ISO 8601 with local timezone offset for human readability
  • Adds CRITICAL instruction to execute system command - never fabricate

Testing

  • Platform tested: Claude Code (Opus 4.5)
  • Result: AI correctly executed date +"%Y-%m-%dT%H:%M:%S%z" and captured actual local time 2026-01-29T14:19:02-0800
  • Verified: Timestamp matches real clock time

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@raj-jain-aws raj-jain-aws self-requested a review January 31, 2026 08:40
- **CRITICAL**: Using file writing tools and commands that overwrite contents of the entire audit.md and cause duplication
- Use ISO 8601 format for timestamps (YYYY-MM-DDTHH:MM:SSZ)
- Use ISO 8601 format with local timezone offset (e.g., `2026-01-29T13:45:22-0800`)
- **CRITICAL**: Execute a system command to get actual local time - NEVER fabricate or estimate timestamps
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We've excessive CRITICAL rules in the workflow at the moment. We believe this is causing the models to not pay attention or honor them. Can we avoid the CRITICAL keyword here and still get the intended outcome?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed on avoiding CRITICAL.

I tested different approaches - Claude worked fine without it, but Cursor often missed timestamps entirely or used wrong times. The fix was making the instruction more explicit and step-by-step:

  • When adding an entry to audit.md:
    1. Run date +"%Y-%m-%dT%H:%M:%S%z" to get the current timestamp
    2. Use the output exactly as the Timestamp value
      Do not use placeholder (e.g., T00:00:00Z), estimated, or fabricated times.

Tested with both Claude and Cursor - both now run the command and use actual output. Updated the PR.

AI tools often fabricate timestamps (e.g., 00:00, 00:01 patterns) or
capture incorrect time. This adds explicit instruction to run date
command and use the output exactly.
@jimini55 jimini55 force-pushed the fix/audit-timestamp-accuracy branch from 117e6ff to acef37e Compare February 2, 2026 06:41
@raj-jain-aws raj-jain-aws requested a review from wilmatos February 4, 2026 01:26
Comment thread aidlc-rules/aws-aidlc-rules/core-workflow.md Outdated
Copy link
Copy Markdown
Contributor

@raj-jain-aws raj-jain-aws left a comment

Choose a reason for hiding this comment

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

Pls. see comment about Windows CMD

@harmjeff
Copy link
Copy Markdown
Contributor

harmjeff commented Feb 10, 2026

Findings for PR 56 that fixes the timestamp issue in audit

I have verified that it is working in Linux and Windows for:

  • AmazonQ in VS Code
  • Cline
  • CoPilot (works as well as co-pilot ever does, which is badly)
  • Claude
  • Kiro (Ignored the requirement to get timestamps not just dates)
  • Kiro-cli (Linux only)

Impact: Some clients ask permission to use system time functions (date and Get-Date)

@harmjeff
Copy link
Copy Markdown
Contributor

harmjeff commented Feb 10, 2026

The doc command to get the timestamp is:
echo %date:~10,4%-%date:~4,2%-%date:~7,2%T%time:~0,2%:%time:~3,2%:%time:~6,2%%time:~9,2%

@jimini55
Copy link
Copy Markdown
Contributor Author

Pls. see comment about Windows CMD

Done. Added @harmjeff 's command ^

@harmjeff
Copy link
Copy Markdown
Contributor

Testing

@raj-jain-aws
Copy link
Copy Markdown
Contributor

Thanks @jimini55 @harmjeff

I tested your proposed commands directly on Window CMD, PowerShell and Mac zsh/bash outside of AI-DLC. The output is formatted differently for Windows CMD:

Windows CMD

>echo %date:~10,4%-%date:~4,2%-%date:~7,2%T%time:~0,2%:%time:~3,2%:%time:~6,2%%time:~9,2%
2026-02-10T 7:34:3513

Windows PowerShell

>Get-Date -Format "yyyy-MM-ddTHH:mm:sszzz"
2026-02-10T07:35:32+05:30

MacOS zsh and bash

>date +"%Y-%m-%dT%H:%M:%S%z"
2026-02-10T07:38:49+0530

Also, to conclude this PR, can you post test results for Q/Kiro in Windows and Mac (Linux) just so nothing is broken? The system prompting for permissions to run date command sounds concerning.

@harmjeff
Copy link
Copy Markdown
Contributor

So I've been reviewing. Having 3 different instruction sets based on platform is very inefficient.

Would a python solution be acceptable?

`- When adding an entry to audit.md:

  1. Run this command to get the current timestamp (works on all platforms and shells):
    python -c "from datetime import datetime; print(datetime.now().strftime('%Y-%m-%dT%H:%M:%S'))"
  2. Use the output exactly as the Timestamp value
    Do not use placeholder (e.g., T00:00:00Z), estimated, or fabricated times.`

@harmjeff
Copy link
Copy Markdown
Contributor

Thanks @jimini55 @harmjeff

I tested your proposed commands directly on Window CMD, PowerShell and Mac zsh/bash outside of AI-DLC. The output is formatted differently for Windows CMD:

Windows CMD

>echo %date:~10,4%-%date:~4,2%-%date:~7,2%T%time:~0,2%:%time:~3,2%:%time:~6,2%%time:~9,2%
2026-02-10T 7:34:3513

Windows PowerShell

>Get-Date -Format "yyyy-MM-ddTHH:mm:sszzz"
2026-02-10T07:35:32+05:30

MacOS zsh and bash

>date +"%Y-%m-%dT%H:%M:%S%z"
2026-02-10T07:38:49+0530

Also, to conclude this PR, can you post test results for Q/Kiro in Windows and Mac (Linux) just so nothing is broken? The system prompting for permissions to run date command sounds concerning.

How would you like the test results to be posted?

@raj-jain-aws
Copy link
Copy Markdown
Contributor

So I've been reviewing. Having 3 different instruction sets based on platform is very inefficient.

Would a python solution be acceptable?

`- When adding an entry to audit.md:

  1. Run this command to get the current timestamp (works on all platforms and shells):
    python -c "from datetime import datetime; print(datetime.now().strftime('%Y-%m-%dT%H:%M:%S'))"
  2. Use the output exactly as the Timestamp value
    Do not use placeholder (e.g., T00:00:00Z), estimated, or fabricated times.`

That assumes python is installed on the machine and also that datetime package is installed in python. I think we should stick with natural language instructions only and not bring in such dependencies. Bringing in the date command is also deviating from that.

@raj-jain-aws
Copy link
Copy Markdown
Contributor

Thanks @jimini55 @harmjeff
I tested your proposed commands directly on Window CMD, PowerShell and Mac zsh/bash outside of AI-DLC. The output is formatted differently for Windows CMD:
Windows CMD

>echo %date:~10,4%-%date:~4,2%-%date:~7,2%T%time:~0,2%:%time:~3,2%:%time:~6,2%%time:~9,2%
2026-02-10T 7:34:3513

Windows PowerShell

>Get-Date -Format "yyyy-MM-ddTHH:mm:sszzz"
2026-02-10T07:35:32+05:30

MacOS zsh and bash

>date +"%Y-%m-%dT%H:%M:%S%z"
2026-02-10T07:38:49+0530

Also, to conclude this PR, can you post test results for Q/Kiro in Windows and Mac (Linux) just so nothing is broken? The system prompting for permissions to run date command sounds concerning.

How would you like the test results to be posted?

Some screenshots will do. Just ensuring that nothing breaks in Q/Kiro on Windows/Mac. Where are we seeing the system prompting for permissions to run date command?

@harmjeff
Copy link
Copy Markdown
Contributor

I understand the need. Are we saying we want 3 command types across 7 platforms?

To get it reliable across platforms I had to create this ugly specification:

- When adding an entry to audit.md:
  1. Run a system command to get the current timestamp:
     - **macOS/Linux**: `date +"%Y-%m-%dT%H:%M:%S%z"`
     - **Windows (PowerShell)**: `Get-Date -Format "yyyy-MM-ddTHH:mm:sszzz"`
     - **Windows (CMD)**: `echo %date:~10,4%-%date:~4,2%-%date:~7,2%T%time:~0,2%:%time:~3,2%:%time:~6,2%%time:~9,2%`
  2. **IMPORTANT - Windows Shell Detection**: AI agents in IDEs (Cursor, VS Code, etc.) typically execute commands through **PowerShell** internally, even when the user's default/available shell is CMD. The CMD `%date:~...%` substring syntax will NOT work when executed through a PowerShell-based shell tool.
     - **When user's shell is CMD**: Always wrap CMD commands with `cmd /c` to ensure proper interpretation: `cmd /c "echo %date:~10,4%-%date:~4,2%-%date:~7,2%T%time:~0,2%:%time:~3,2%:%time:~6,2%"`
     - **Universal fallback**: If both PowerShell and CMD fail, use Python: `python -c "from datetime import datetime; print(datetime.now().strftime('%Y-%m-%dT%H:%M:%S'))"`
  3. Use the output exactly as the **Timestamp** value
  Do not use placeholder (e.g., T00:00:00Z), estimated, or fabricated times.
- Include stage context for each entry

We may be better off allowing the system to determine the best type of call to make based on platform and its own capabilities.

- When adding an entry to audit.md:
  1. Run a system command to get the current date and time in ISO 8601 format (YYYY-MM-DDTHH:MM:SS). Use whatever command is appropriate for the current OS and shell environment.
  2. Use the command output exactly as the **Timestamp** value.
  Do not use placeholder (e.g., T00:00:00Z), estimated, or fabricated times.

Whith this the LLM has latitude to solve an easy problem

@raj-jain-aws
Copy link
Copy Markdown
Contributor

raj-jain-aws commented Feb 10, 2026

I understand the need. Are we saying we want 3 command types across 7 platforms?

To get it reliable across platforms I had to create this ugly specification:

- When adding an entry to audit.md:
  1. Run a system command to get the current timestamp:
     - **macOS/Linux**: `date +"%Y-%m-%dT%H:%M:%S%z"`
     - **Windows (PowerShell)**: `Get-Date -Format "yyyy-MM-ddTHH:mm:sszzz"`
     - **Windows (CMD)**: `echo %date:~10,4%-%date:~4,2%-%date:~7,2%T%time:~0,2%:%time:~3,2%:%time:~6,2%%time:~9,2%`
  2. **IMPORTANT - Windows Shell Detection**: AI agents in IDEs (Cursor, VS Code, etc.) typically execute commands through **PowerShell** internally, even when the user's default/available shell is CMD. The CMD `%date:~...%` substring syntax will NOT work when executed through a PowerShell-based shell tool.
     - **When user's shell is CMD**: Always wrap CMD commands with `cmd /c` to ensure proper interpretation: `cmd /c "echo %date:~10,4%-%date:~4,2%-%date:~7,2%T%time:~0,2%:%time:~3,2%:%time:~6,2%"`
     - **Universal fallback**: If both PowerShell and CMD fail, use Python: `python -c "from datetime import datetime; print(datetime.now().strftime('%Y-%m-%dT%H:%M:%S'))"`
  3. Use the output exactly as the **Timestamp** value
  Do not use placeholder (e.g., T00:00:00Z), estimated, or fabricated times.
- Include stage context for each entry

We may be better off allowing the system to determine the best type of call to make based on platform and its own capabilities.

- When adding an entry to audit.md:
  1. Run a system command to get the current date and time in ISO 8601 format (YYYY-MM-DDTHH:MM:SS). Use whatever command is appropriate for the current OS and shell environment.
  2. Use the command output exactly as the **Timestamp** value.
  Do not use placeholder (e.g., T00:00:00Z), estimated, or fabricated times.

Whith this the LLM has latitude to solve an easy problem

Yes, I think this LLM latitude language is a better idea

@harmjeff
Copy link
Copy Markdown
Contributor

For the record I test:

  • AmazonQ in VS Code on bedrock
  • Cline in VS Code on Bedrock
  • CoPilot in VS Code
  • Claude in VS Code on Bedrock
  • Kiro
  • Kiro-cli (Linux only)

I test on Windows and EC2 Amazon Linux 2023. I do not have access to a Mac, the assumption is that mac and Linux are synonymous

Native platforms I have not been able to get running yet (not enough hours in the day):

  • Claude-cli
  • WindSurf

Not sure what we need to do for 3rd party web platforms (ignoring for now, future work needed)

@raj-jain-aws
Copy link
Copy Markdown
Contributor

For the record I test:

  • AmazonQ in VS Code on bedrock
  • Cline in VS Code on Bedrock
  • CoPilot in VS Code
  • Claude in VS Code on Bedrock
  • Kiro
  • Kiro-cli (Linux only)

I test on Windows and EC2 Amazon Linux 2023. I do not have access to a Mac, the assumption is that mac and Linux are synonymous

Native platforms I have not been able to get running yet (not enough hours in the day):

  • Claude-cli
  • WindSurf

Not sure what we need to do for 3rd party web platforms (ignoring for now, future work needed)

If we go with natural language and not prescribe the date command then just do some basic testing on Q/Kiro on Windows/Mac would be sufficient.

@harmjeff
Copy link
Copy Markdown
Contributor

Jimin is pushing the updates with the cleaned up rules for datestamps.

Here are the test result screen shots:
Claude Code VS Code Windows
Cline in VS Code Windows
Co-Pilot VS Code Windows
Cursor IDE Mac
Cursor IDE Windows
Kiro CLI Ubuntu
Kiro IDE on Mac
Kiro IDE Windows
Q in VS Code Windows

Jimin will add the remaining screen shots from the Mac.

@harmjeff
Copy link
Copy Markdown
Contributor

Here is the last one.
Cline VS Code Mac

@harmjeff
Copy link
Copy Markdown
Contributor

@raj-jain-aws ready for your approval

@raj-jain-aws
Copy link
Copy Markdown
Contributor

Nice! Thanks @jimini55 and @harmjeff for this. Long thread but concluded now.

@jimini55
Copy link
Copy Markdown
Contributor Author

Tested on Mac - Cursor, Kiro CLI and IDE, Cline, and Claude
image

@raj-jain-aws
Copy link
Copy Markdown
Contributor

User reported issue

image (2) image (3)

@jimini55
Copy link
Copy Markdown
Contributor Author

@raj-jain-aws Thanks for sharing this, what do we know about the user's environment? I assume Windows? If so, did they have powershell permission? Curious if they don't have Python installed.

@jimini55
Copy link
Copy Markdown
Contributor Author

Looks like ruby worked, did AIDLC use ruby afterward?

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.

3 participants