SCRIPTS_ORGANIZATION.md 8.5 KB

Scripts Organization Summary

Date: 2025-11-26
Status: ✅ Complete


Changes Made

Before Organization

evals/framework/
├── check-agent.mjs
├── debug-claude-session.mjs
├── debug-session.mjs
├── debug-session.ts
├── inspect-session.mjs
├── run-tests-batch.sh
├── test-agent-direct.ts
├── test-event-inspector.js
├── test-session-reader.mjs
├── test-simplified-approach.mjs
├── test-timeline.ts
├── verify-timeline.ts
└── ... (other framework files)

Issues:

  • ❌ 12 scripts cluttering framework root
  • ❌ No clear organization
  • ❌ Hard to find specific scripts
  • ❌ Unclear which scripts are for what purpose

After Organization

evals/framework/
├── scripts/
│   ├── debug/                    # Debugging scripts (4 files)
│   │   ├── debug-session.mjs
│   │   ├── debug-session.ts
│   │   ├── debug-claude-session.mjs
│   │   └── inspect-session.mjs
│   │
│   ├── test/                     # Test scripts (6 files)
│   │   ├── test-agent-direct.ts
│   │   ├── test-event-inspector.js
│   │   ├── test-session-reader.mjs
│   │   ├── test-simplified-approach.mjs
│   │   ├── test-timeline.ts
│   │   └── verify-timeline.ts
│   │
│   ├── utils/                    # Utility scripts (2 files)
│   │   ├── run-tests-batch.sh
│   │   └── check-agent.mjs
│   │
│   └── README.md                 # Script documentation
│
└── ... (other framework files)

Benefits:

  • ✅ Clean framework root
  • ✅ Clear organization by purpose
  • ✅ Easy to find scripts
  • ✅ Comprehensive documentation

Script Categories

Debug Scripts (4 files)

Scripts for debugging sessions, events, and agent behavior.

Script Purpose Lines
debug-session.mjs Debug session data and timeline ~40
debug-session.ts TypeScript version of session debugger ~100
debug-claude-session.mjs Debug Claude-specific sessions ~50
inspect-session.mjs Inspect most recent session events ~80

Usage:

node scripts/debug/inspect-session.mjs
node scripts/debug/debug-session.mjs <session-id>
npx tsx scripts/debug/debug-session.ts <session-id>

Test Scripts (6 files)

Scripts for testing framework components during development.

Script Purpose Lines
test-agent-direct.ts Direct agent execution test ~150
test-event-inspector.js Test event capture system ~40
test-session-reader.mjs Test session reader ~60
test-simplified-approach.mjs Test simplified test approach ~100
test-timeline.ts Test timeline builder ~90
verify-timeline.ts Verify timeline accuracy ~100

Usage:

npx tsx scripts/test/test-agent-direct.ts
node scripts/test/test-event-inspector.js
npx tsx scripts/test/verify-timeline.ts

Utility Scripts (2 files)

General utility scripts for running tests and managing the framework.

Script Purpose Lines
run-tests-batch.sh Run tests in batches ~100
check-agent.mjs Check agent availability ~30

Usage:

./scripts/utils/run-tests-batch.sh openagent 3 10
node scripts/utils/check-agent.mjs

Documentation Updates

Files Updated

  1. evals/README.md

    • Updated run-tests-batch.sh path references
    • Updated directory structure
  2. evals/GETTING_STARTED.md

    • Updated batch execution examples
    • Updated script paths
  3. evals/agents/openagent/README.md

    • Updated batch execution examples
    • Updated script paths
  4. evals/agents/openagent/IMPLEMENTATION_SUMMARY.md

    • Updated script references
    • Updated directory structure
  5. evals/DOCUMENTATION_CLEANUP.md

    • Updated directory structure
  6. evals/framework/README.md

    • Added scripts section
    • Added quick examples

New Documentation

  1. evals/framework/scripts/README.md (NEW - 200 lines)
    • Comprehensive script documentation
    • Usage examples for all scripts
    • Development workflow guide
    • Script templates

Path Changes

Old Paths → New Paths

Old Path New Path
run-tests-batch.sh scripts/utils/run-tests-batch.sh
check-agent.mjs scripts/utils/check-agent.mjs
debug-session.mjs scripts/debug/debug-session.mjs
debug-session.ts scripts/debug/debug-session.ts
debug-claude-session.mjs scripts/debug/debug-claude-session.mjs
inspect-session.mjs scripts/debug/inspect-session.mjs
test-agent-direct.ts scripts/test/test-agent-direct.ts
test-event-inspector.js scripts/test/test-event-inspector.js
test-session-reader.mjs scripts/test/test-session-reader.mjs
test-simplified-approach.mjs scripts/test/test-simplified-approach.mjs
test-timeline.ts scripts/test/test-timeline.ts
verify-timeline.ts scripts/test/verify-timeline.ts

Migration Guide

For Users

If you have scripts or documentation referencing the old paths:

# Old
./run-tests-batch.sh openagent 3 10

# New
./scripts/utils/run-tests-batch.sh openagent 3 10

For Developers

If you have custom scripts importing from these files:

// Old
import { SessionReader } from './dist/collector/session-reader.js';

// New (from scripts directory)
import { SessionReader } from '../../dist/collector/session-reader.js';

Benefits

Organization

  • Clear structure - Scripts grouped by purpose
  • Easy navigation - Know where to find scripts
  • Clean root - Framework root no longer cluttered
  • Scalable - Easy to add new scripts

Documentation

  • Comprehensive README - All scripts documented
  • Usage examples - Clear examples for each script
  • Development workflow - Guide for using scripts
  • Templates - Easy to create new scripts

Maintainability

  • Easier to maintain - Clear organization
  • Easier to find - Logical grouping
  • Easier to update - Centralized documentation
  • Easier to extend - Clear patterns

Statistics

Before

  • Total scripts: 12
  • In framework root: 12
  • Organized: 0
  • Documented: Minimal

After

  • Total scripts: 12 (same)
  • In framework root: 0
  • Organized: 12 (100%)
  • Documented: Comprehensive (200+ lines)

File Count

  • Debug scripts: 4
  • Test scripts: 6
  • Utility scripts: 2
  • Documentation: 1 (README.md)
  • Total: 13 files (12 scripts + 1 doc)

Maintenance Guidelines

Adding New Scripts

  1. Determine category:

    • Debug? → scripts/debug/
    • Test? → scripts/test/
    • Utility? → scripts/utils/
  2. Create script in appropriate directory

  3. Update scripts/README.md:

    • Add to table
    • Add usage example
  4. Test the script:

    npm run build
    node scripts/debug/my-script.mjs
    

Removing Obsolete Scripts

  1. Delete the script file

  2. Update scripts/README.md:

    • Remove from table
    • Remove usage example
  3. Check for references:

    rg "my-script" --type md
    

Updating Scripts

  1. Make changes to script

  2. Test changes:

    npm run build
    node scripts/debug/my-script.mjs
    
  3. Update documentation if usage changed


Next Steps

Immediate

  • ✅ Scripts organized
  • ✅ Documentation updated
  • ✅ References updated
  • ✅ README created

Future Enhancements

  1. Add more debug scripts

    • Session comparison tool
    • Event diff tool
    • Performance profiler
  2. Add more test scripts

    • Integration test runner
    • Performance benchmarks
    • Stress tests
  3. Add more utilities

    • Test result analyzer
    • Coverage reporter
    • Cleanup utilities

Summary

12 scripts organized into 3 categories
Framework root cleaned (0 scripts remaining)
Comprehensive documentation (200+ lines)
All references updated (6 files)
Clear structure for future additions

Organization is now:

  • Clean and organized
  • Well-documented
  • Easy to navigate
  • Easy to maintain
  • Easy to extend

Organization Completed: 2025-11-26
Scripts Organized: 12
Documentation Created: 1 README (200+ lines)
Files Updated: 6