Skip to main content

/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)

FlagDescriptionDefault
--todayFiles modified today-
--hours NFiles modified in last N hours-
--days NFiles modified in last N days7
--allAll files regardless of time (slow)-

Time Selection (Absolute Date Range)

FlagDescriptionDefault
--date YYYY-MM-DDSpecific date to filter-
--from HH:MMStart time on the date00:00
--to HH:MMEnd time on the date23:59

File Selection

FlagDescriptionDefault
NLimit to N filesall
-i, --interactiveInteractive mode with guided menusfalse
--type EXTFilter by extension (e.g., md, "ts,tsx")all
--dir PATHDirectory to search.
--gitGit-tracked onlyfalse
--no-submodulesExclude submodules directoryfalse
--submodules-onlyOnly show files in submodulesfalse

Export Options

FlagDescriptionOutput
--exportExport file list to JSON~/.coditect/recently-modified/*.json
--diff-reviewExport diffs for MoE review~/.coditect/recently-modified/diffs/*.md

Diff Options

FlagDescription
--diffShow full git diffs for changed files
--diff-statShow diff statistics only (lines added/removed)
--diff-reviewExport diffs in markdown for MoE agent review
--include-newShow 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:

  1. Detects git directory for each file
  2. Runs git commands in correct context
  3. 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

FieldDescription
filenameBase filename
pathFull relative path from working directory
directoryParent directory path
submoduleSubmodule name (e.g., "core/coditect-core") or empty
size_bytesFile size in bytes
createdCreation timestamp (ISO 8601 with timezone)
modifiedLast modified timestamp (ISO 8601 with timezone)

Interactive Mode

Run /recent -i for a guided selection menu:

  1. Time frame - Last hour, 4 hours, today, 24h, 7 days, 30 days, all time, or specific date/time range
  2. Submodules - Include (default), exclude, or only submodules
  3. File type - All, markdown, TypeScript, Python, JavaScript, JSON, shell, or custom
  4. Count - All (default), 25, 50, 100, or custom number
  5. Export - Display only or export to JSON
  6. 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

ColorMeaning
GreenFiles in submodules
YellowSession logs and learnings files
BlueMarkdown files
MagentaPython and shell scripts

Diff Output

ColorMeaning
GreenAdded lines (+)
RedRemoved lines (-)
CyanDiff headers (@@)
YellowFile headers (#)

MoE Integration

The --diff-review output is designed for these agents:

AgentAnalysis Focus
orchestrator-code-reviewADR compliance, multi-agent coordination
code-reviewerQuality, security, performance
llm-judgeBefore/after quality scoring
quality-gate-enforcerEvidence-based validation
cloud-architect-code-reviewerInfrastructure 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
CommandPurpose
/git-syncGit status and sync
/session-logSession history
/cxq --recentRecent context messages
/cxContext extraction

Architecture

See ADR-072: Recent Files Command with Diff Analysis


Version: 2.4.0 Created: 2026-01-15 Author: CODITECT Team