/recent - Recently Modified Files with Diff Analysis
Show recently modified files with optional git diff analysis and MoE review export.
DEFAULTS:
- Includes submodules (where most work happens in monorepos)
- Shows ALL files for the time frame (no truncation)
- Last 7 days time window
System Prompt
EXECUTION DIRECTIVE: When /recent is invoked, IMMEDIATELY list recent files.
Usage
# Basic file listing (relative time)
/recent # All files from past 7 days
/recent --today # All files modified today
/recent --hours 4 # Last 4 hours
/recent --days 30 # Last 30 days
/recent 20 # Limit to 20 files
# Absolute date/time range
/recent --date 2026-01-14 # All files from Jan 14
/recent --date 2026-01-14 --from 09:00 # Jan 14, 9am onwards
/recent --date 2026-01-14 --from 09:00 --to 17:00 # Jan 14, 9am-5pm
/recent --date 2026-01-14 --from 14:00 --to 18:00 --diff # With diffs
# Submodule filtering
/recent --no-submodules # Exclude submodules directory
/recent --submodules-only # Only show submodule changes
# Type filtering
/recent --type md # Only markdown files
/recent --type "ts,tsx" # TypeScript files
# Export
/recent --today --export # Export to JSON
# Diff analysis
/recent --hours 4 --diff # Show full git diffs
/recent --today --diff-stat # Show diff statistics only
/recent --hours 24 --diff-review # Export for MoE review panel
/recent --hours 1 --diff --include-new # Include new file content as additions
# Interactive
/recent -i # Interactive mode with all options
Execution
~/.coditect/scripts/recent.sh
~/.coditect/scripts/recent.sh --today --export
~/.coditect/scripts/recent.sh --hours 4 --diff
~/.coditect/scripts/recent.sh --today --diff-stat
~/.coditect/scripts/recent.sh --hours 24 --diff-review
~/.coditect/scripts/recent.sh -i
Options
Time Selection (Relative)
| Flag | Description | Default |
|---|---|---|
--today | Files modified today | - |
--hours N | Files modified in last N hours | - |
--days N | Files modified in last N days | 7 |
--all | All files regardless of time (slow) | - |
Time Selection (Absolute Date Range)
| Flag | Description | Default |
|---|---|---|
--date YYYY-MM-DD | Specific date to filter | - |
--from HH:MM | Start time on the date | 00:00 |
--to HH:MM | End time on the date | 23:59 |
File Selection
| Flag | Description | Default |
|---|---|---|
N | Limit to N files | all |
-i, --interactive | Interactive mode with guided menus | false |
--type EXT | Filter by extension (e.g., md, "ts,tsx") | all |
--dir PATH | Directory to search | . |
--git | Git-tracked only | false |
--no-submodules | Exclude submodules directory | false |
--submodules-only | Only show files in submodules | false |
Export Options
| Flag | Description | Output |
|---|---|---|
--export | Export file list to JSON | ~/.coditect/recently-modified/*.json |
--diff-review | Export diffs for MoE review | ~/.coditect/recently-modified/diffs/*.md |
Diff Options
| Flag | Description |
|---|---|
--diff | Show full git diffs for changed files |
--diff-stat | Show diff statistics only (lines added/removed) |
--diff-review | Export diffs in markdown for MoE agent review |
--include-new | Show full content of untracked files as additions |
Diff Analysis
--diff (Full Diffs)
Shows complete git diffs with color-coded output:
──────────────────────────────────────────────────────────────────
[1] scripts/recent.sh
──────────────────────────────────────────────────────────────────
# scripts/recent.sh (uncommitted changes)
@@ -1,5 +1,6 @@
#!/bin/bash
+# Version: 2.2.0
# recent.sh - Show recently modified files
-VERSION="2.1.0"
+VERSION="2.2.0"
--diff-stat (Statistics Only)
Shows summary of changes per file:
======================================================================
Git Diffs for Recently Modified Files
======================================================================
Diff statistics for 4hours
File +Lines -Lines Status
---- ------ ------ ------
scripts/recent.sh +450 -12 uncommitted
commands/recent.md +85 -30 2 hours ago
internal/architecture/adrs/ADR-072.md +280 -0 uncommitted
--diff-review (MoE Export)
Exports a markdown report for MoE agent consumption:
Output: ~/.coditect/recently-modified/diffs/YYYY-MM-DDTHH-MM-SS_<time>_diff-review.md
Contents:
- Summary statistics table
- Detailed diffs in code blocks
- MoE review instructions
- Suggested agent invocation
Example workflow:
# 1. Export changes
/recent --hours 24 --diff-review
# 2. Review with MoE panel
/agent orchestrator-code-review "Review the changes in ~/.coditect/recently-modified/diffs/2026-01-15T06-19-49_24hours_diff-review.md"
--include-new (New File Content)
By default, untracked (new) files show only "not tracked by git". Use --include-new to show their full content as additions:
──────────────────────────────────────────────────────────────────
[1] new-feature.md
──────────────────────────────────────────────────────────────────
# new-feature.md (NEW FILE - 45 lines)
--- /dev/null
+++ b/new-feature.md
@@ -0,0 +1,45 @@
+# New Feature Documentation
+
+This is a new file...
With --diff-stat --include-new:
new-feature.md +45 -0 NEW FILE
Submodule-Aware Git
The diff analysis correctly handles files in git submodules:
- Detects git directory for each file
- Runs git commands in correct context
- Shows relative paths within submodule
JSON Export
Use --export to save results to ~/.coditect/recently-modified/ with full metadata.
Export Filename Format
YYYY-MM-DDTHH-MM-SS_<time-filter>_<submodule-mode>[_type-EXT][_limit-N].json
Examples:
2026-01-15T06-08-02_today_with-submodules.json
2026-01-15T12-30-00_7days_no-submodules_type-md.json
2026-01-15T18-45-15_4hours_submodules-only_limit-50.json
2026-01-15T20-00-00_2026-01-14_09-00-17-00_with-submodules.json # Date range
JSON Schema
{
"export_metadata": {
"exported_at": "2026-01-15T06:08:02Z",
"time_filter": "today",
"include_submodules": true,
"submodules_only": false,
"type_filter": "",
"count_limit": 0,
"working_directory": "/Users/user/PROJECTS/repo"
},
"files": [
{
"filename": "example.md",
"path": "submodules/core/coditect-core/docs/example.md",
"directory": "submodules/core/coditect-core/docs",
"submodule": "core/coditect-core",
"size_bytes": 25621,
"created": "2026-01-15T01:23:39-03:00",
"modified": "2026-01-15T04:23:20-03:00"
}
],
"total_files": 300
}
JSON Fields
| Field | Description |
|---|---|
filename | Base filename |
path | Full relative path from working directory |
directory | Parent directory path |
submodule | Submodule name (e.g., "core/coditect-core") or empty |
size_bytes | File size in bytes |
created | Creation timestamp (ISO 8601 with timezone) |
modified | Last modified timestamp (ISO 8601 with timezone) |
Interactive Mode
Run /recent -i for a guided selection menu:
- Time frame - Last hour, 4 hours, today, 24h, 7 days, 30 days, all time, or specific date/time range
- Submodules - Include (default), exclude, or only submodules
- File type - All, markdown, TypeScript, Python, JavaScript, JSON, shell, or custom
- Count - All (default), 25, 50, 100, or custom number
- Export - Display only or export to JSON
- Diff - No diffs, full diffs, full diffs + new files, statistics only, or MoE export
Output Format
======================================================================
Recently Modified Files
======================================================================
All files (includes submodules) | Today
Modified Size File
-------- ---- ----
2026-01-15 04:23 25.0K submodules/core/coditect-core/docs/guide.md
2026-01-15 03:15 1.1M context-storage/skill-learnings.json
2026-01-15 02:30 12.3K scripts/recent.sh
Total: 300 files shown
======================================================================
Color Coding
File List
| Color | Meaning |
|---|---|
| Green | Files in submodules |
| Yellow | Session logs and learnings files |
| Blue | Markdown files |
| Magenta | Python and shell scripts |
Diff Output
| Color | Meaning |
|---|---|
| Green | Added lines (+) |
| Red | Removed lines (-) |
| Cyan | Diff headers (@@) |
| Yellow | File headers (#) |
MoE Integration
The --diff-review output is designed for these agents:
| Agent | Analysis Focus |
|---|---|
orchestrator-code-review | ADR compliance, multi-agent coordination |
code-reviewer | Quality, security, performance |
llm-judge | Before/after quality scoring |
quality-gate-enforcer | Evidence-based validation |
cloud-architect-code-reviewer | Infrastructure changes |
Examples
Session Retrospective
# What did I work on in the last 4 hours?
/recent --hours 4 --diff-stat
Code Review Preparation
# Export today's changes for review
/recent --today --diff-review
# Then invoke MoE panel
/agent orchestrator-code-review "Review changes in the exported diff file"
Daily Export
# Export today's changes to JSON
/recent --today --export
# Output: ~/.coditect/recently-modified/2026-01-15T00-00-00_today_with-submodules.json
Filter by Type with Diffs
# Show diffs for TypeScript changes in last 4 hours
/recent --hours 4 --type "ts,tsx" --diff
Submodule Analysis
# What changed in submodules today?
/recent --today --submodules-only --diff-stat
Date Range Analysis
# What changed on January 14th?
/recent --date 2026-01-14
# What changed during working hours (9am-5pm)?
/recent --date 2026-01-14 --from 09:00 --to 17:00
# Show diffs for afternoon changes (2pm-6pm)
/recent --date 2026-01-14 --from 14:00 --to 18:00 --diff
# Export specific time window
/recent --date 2026-01-14 --from 09:00 --to 12:00 --export
Performance Notes
- File listing is fast (uses batched find/stat)
- Diff analysis is slower (git operations per file)
- Recommend limiting files when using
--diff:/recent --hours 4 --diff 20 # Limit to 20 files
Related Commands
| Command | Purpose |
|---|---|
/git-sync | Git status and sync |
/session-log | Session history |
/cxq --recent | Recent context messages |
/cx | Context extraction |
Architecture
See ADR-072: Recent Files Command with Diff Analysis
Version: 2.4.0 Created: 2026-01-15 Author: CODITECT Team