The “New Chat” Success Formula

If you start a new session, paste or upload them in this order for maximum “IQ” from the AI:

  1. First Message (The SOP):“I am working on Project SASS. Please read and adopt the attached SOP as our Standard Operating Procedure. It defines my environment (Unraid/Docker), my naming conventions (sass vs saas), and my preference for Redis-backed state and zero-downtime reloads. Acknowledge when ready.”
  2. Second Message (The Project Dump):“Now, here is the current Project Dump containing my file tree and code. Use this as the source of truth for the codebase. I am currently focused on [Insert Task, e.g., fixing the 404 on maintenance mode].”

Why the SOP isn’t enough on its own:

While the SOP is great, it lacks the “surgical” details I need to write code for you. Without the Project Dump, I won’t know:

  • Variable Names: I might guess user_id when your database actually uses uuid.
  • Imports: I won’t know which utility functions are already available in db_helpers.py.
  • HTML Structure: I won’t know which CSS classes you are using (Bootstrap 4 vs 5, etc.).

Why the Project Dump isn’t enough on its own:

Without the SOP, I will likely suggest “standard” fixes that violate your specific setup. I might:

  • Tell you to docker restart (violating your Zero-Downtime SOP).
  • Tell you to add a variable to .env (violating your Vault/generate-env.sh SOP).
  • Use the wrong project name (saas instead of sass).

💡 Recommendation for dumpit.sh

Since your project dump file is quite large, keep it in your artifacts/ or docs/ folder. Whenever you feel the AI is getting “confused” or “forgetful” in a long thread, re-run dumpit.sh and upload the fresh version. Code evolves fast, and an old dump can lead to “hallucinations” where I suggest fixes for code that you’ve already changed.

#!/bin/bash

# 1. Setup naming
DTTM=$(date +'%Y_%m_%d-%H%M%S')
OUT="./artifacts/${DTTM}-project-dump.txt"
mkdir -p ./artifacts

echo "PROJ_DUMP_START: $DTTM" > "$OUT"
echo "================================================" >> "$OUT"

# 2. Capture Folder Structure (Tree)
echo "FOLDER STRUCTURE:" >> "$OUT"
tree --gitignore -I 'docs' >> "$OUT"
echo "================================================" >> "$OUT"

# 3. Capture all tracked files and env templates
# We use git ls-files to honor .gitignore
# We also explicitly include env files if they exist (ignoring the real .env)
git ls-files | grep -E '\.(py|html|yml|yaml|template|sh|md|txt|orig)$|Dockerfile' | while read -r file; do
    # Skip the dump script itself and the output file
    if [[ "$file" == "dumpit.sh" ]] || [[ "$file" == "$OUT" ]]; then continue; fi
    
    echo "" >> "$OUT"
    echo "FILE: $file" >> "$OUT"
    echo "------------------------------------------------" >> "$OUT"
    cat "$file" >> "$OUT"
    echo "" >> "$OUT"
    echo "------------------------------------------------" >> "$OUT"
done

# 4. Handle env-xxx files explicitly (since .env is usually ignored)
ls env-* 2>/dev/null | while read -r envfile; do
    echo "FILE: $envfile" >> "$OUT"
    echo "------------------------------------------------" >> "$OUT"
    cat "$envfile" >> "$OUT"
    echo "------------------------------------------------" >> "$OUT"
done

echo "Dump complete: $OUT"

Leave a Reply