Skip to content

Commit 8c53600

Browse files
nshkrdotcomnshkrdotcom
authored andcommitted
fb
1 parent 66fe1c7 commit 8c53600

4 files changed

+90
-9
lines changed

research_paper_improvement_gemini_pro_delayed.yaml.tmp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ workflow:
66
- name: "analyze_and_improve_research"
77
type: "gemini"
88
model: "gemini-2.5-pro"
9-
output_to_file: "202507110833_improved_chiral_narrative_synthesis.md"
9+
output_to_file: "202507110839_improved_chiral_narrative_synthesis.md"
1010
token_budget:
1111
temperature: 0.7
1212
max_output_tokens: 65536
@@ -17,7 +17,7 @@ workflow:
1717

1818
````
1919
- type: "file"
20-
path: "./workspace/202507110830_continuing_from_large_file.md"
20+
path: "./workspace/202507110831_chiral_narrative_synthesis_scientific_paper.md"
2121
- type: "static"
2222
content: |
2323
````

research_paper_improvement_pipeline.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ workflow:
4747
# Enable comprehensive conversation logging for debugging
4848
pass_through_streaming: true
4949
verbose: true
50-
output_to_file:
51-
path: "./logs/claude_conversation_TIMESTAMP_PLACEHOLDER.jsonl"
52-
format: "jsonl"
50+
output_to_file: "./logs/claude_conversation_TIMESTAMP_PLACEHOLDER.jsonl"
5351
prompt:
5452
- type: "static"
5553
content: |

research_paper_improvement_pipeline.yaml.tmp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ workflow:
4747
# Enable comprehensive conversation logging for debugging
4848
pass_through_streaming: true
4949
verbose: true
50-
output_to_file:
51-
path: "./logs/claude_conversation_202507110831.jsonl"
52-
format: "jsonl"
50+
output_to_file: "./logs/claude_conversation_202507110837.jsonl"
5351
prompt:
5452
- type: "static"
5553
content: |
@@ -90,7 +88,7 @@ workflow:
9088
- Make the research more technically sound and publishable
9189
- Ensure proper scientific formatting and structure
9290

93-
IMPORTANT: Use the Write tool to save as markdown file with format: 202507110831_{descriptive_filename}.md
91+
IMPORTANT: Use the Write tool to save as markdown file with format: 202507110837_{descriptive_filename}.md
9492

9593
Here are the improvements and analysis to incorporate:
9694
- type: "previous_response"
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
3+
# Research Paper Improvement Pipeline Loop
4+
# Hardcoded to use research_paper_improvement_gemini_pro_delayed.yaml
5+
# Chains iterations by feeding outputs back as inputs
6+
7+
PIPELINE_FILE="research_paper_improvement_gemini_pro_delayed.yaml"
8+
9+
# Check if the pipeline file exists
10+
if [ ! -f "$PIPELINE_FILE" ]; then
11+
echo "Error: Pipeline file '$PIPELINE_FILE' not found!"
12+
exit 1
13+
fi
14+
15+
echo "Starting research paper improvement pipeline loop"
16+
echo "Pipeline: $PIPELINE_FILE"
17+
echo "Press Ctrl+C to stop"
18+
echo ""
19+
20+
counter=1
21+
while true; do
22+
timestamp=$(date -u +"%Y%m%d%H%M")
23+
echo "=== Research Paper Improvement Run #$counter $(date -u) ==="
24+
25+
# Create temporary YAML with unique timestamp
26+
cp "$PIPELINE_FILE" "${PIPELINE_FILE}.tmp"
27+
28+
# Replace {{timestamp}} markers in output_to_file fields with current timestamp
29+
sed -i "s|{{timestamp}}|$timestamp|g" "${PIPELINE_FILE}.tmp"
30+
31+
# Find the most recent output file to use as input for next iteration
32+
if [ $counter -gt 1 ]; then
33+
# Look for latest file in outputs directory (where files are actually saved)
34+
latest_file=$(ls -t ./outputs/202*_improved_chiral_narrative_synthesis.md 2>/dev/null | head -1)
35+
if [ -n "$latest_file" ]; then
36+
echo "🔄 Using previous output as input: $latest_file"
37+
# Update the file path in the YAML to point to the latest output
38+
sed -i 's|path: "\.\./research_papers/tex/ResearchProposal-ChiralNarrativeSynthesis_3\.tex"|path: "'"$latest_file"'"|g' "${PIPELINE_FILE}.tmp"
39+
sed -i 's|path: \.\./research_papers/tex/ResearchProposal-ChiralNarrativeSynthesis_3\.tex|path: "'"$latest_file"'"|g' "${PIPELINE_FILE}.tmp"
40+
else
41+
echo "⚠️ No previous output found, using original research proposal"
42+
fi
43+
else
44+
echo "🚀 First run - using original research proposal"
45+
fi
46+
47+
# Run the pipeline
48+
echo "🧠 Executing Gemini research improvement..."
49+
start_time=$(date +%s)
50+
51+
if timeout 3600 mix pipeline.run.live "${PIPELINE_FILE}.tmp"; then
52+
end_time=$(date +%s)
53+
duration=$((end_time - start_time))
54+
echo "✅ Pipeline completed successfully in ${duration}s"
55+
56+
# Check if new output file was created
57+
latest_after=$(ls -t ./outputs/202*_improved_chiral_narrative_synthesis.md 2>/dev/null | head -1)
58+
if [ "$latest_after" != "$latest_file" ]; then
59+
echo "📄 New improved paper created: $latest_after"
60+
61+
# Show file size for progress tracking
62+
if [ -f "$latest_after" ]; then
63+
size=$(wc -l < "$latest_after" 2>/dev/null || echo "unknown")
64+
echo "📊 Paper length: $size lines"
65+
fi
66+
else
67+
echo "⚠️ WARNING: No new output file detected!"
68+
fi
69+
else
70+
end_time=$(date +%s)
71+
duration=$((end_time - start_time))
72+
echo "❌ Pipeline failed or timed out after ${duration}s"
73+
74+
# Show current outputs for debugging
75+
echo "📁 Current outputs:"
76+
ls -lt ./outputs/202*_improved_chiral_narrative_synthesis.md 2>/dev/null | head -3
77+
fi
78+
79+
# Clean up temp file
80+
rm "${PIPELINE_FILE}.tmp"
81+
82+
echo "=== Completed Research Paper Improvement Run #$counter, waiting 5 seconds... ==="
83+
sleep 5
84+
((counter++))
85+
done

0 commit comments

Comments
 (0)