(and why it matters, even if nothing else does)
When I failed JEE for the last time, I wasnβt just grieving a test. I was mourning a version of myself I thought Iβd become.
In that stillness, when motivation became meaningless, I realized something quieter might survive ambition: ritual.
grain is not a productivity app. Itβs a companion for the slow, deliberate act of continuing. It runs in your terminal. It doesnβt sync. It doesnβt push notifications or pretend to be your friend.
It just countsβone hour, one credit at a time.
You earn 90 credits a week. Surplus becomes your break time. There are no hacks, no gamification. Just the quiet math of effort and rest.
Because when everything else falls apart, the only question worth answering is: can I still show up?
And grain answers, without fanfare: yes. once more.
Grain isnβt built for optimizationβitβs built for intention. It treats focus as a ritual, not a race.
At its core is a quiet loop:
-
Log: Record your study or break credits with minimal friction.
-
Read: Review your daily or weekly patterns.
-
Reflect: Adjust your rhythmβwhen to lean in, and when to pause.
No sync, no noise. Just your effort, your data, and a clean terminal interface that stays out of your way.
- Ensure Go is installed: You need Go (version 1.18 or later recommended). Check with
go version. - Clone the repository:
# git clone https://github.com/CodeDreamer06/GrainCLI.git # cd grainCLI
- Build the binary:
This creates the
go build -o grain .grainexecutable in the current directory. - Move to PATH (Optional but recommended):
Move the compiled
grainbinary to a directory in your system's$PATH(e.g.,/usr/local/binor~/bin) for easy access from anywhere.# Example for macOS/Linux: # sudo mv grain /usr/local/bin/ # Or choose a user-specific path: # mkdir -p ~/bin && mv grain ~/bin # Ensure ~/bin is in your PATH
The first time you run grain (or any grain command), it will check for ~/.grain/config.json. If not found, it will prompt you for initial setup:
π Welcome to Grain CLI!
Enter your study goal per week (default: 90): 90
Set initial break credits (default: 12): 12
β¨ Configuration saved to /Users/yourname/.grain/config.jsonThis creates ~/.grain/config.json and ~/.grain/data.json (initially empty or with default stats).
Grain uses simple commands for core actions.
grain: Logs +1 study credit (default action).grain <N>: Logs +N study credits (e.g.,grain 3).grain s [N]: Logs +N study credits (e.g.,grain sorgrain s 2).Ndefaults to 1 if omitted.grain b [N]: Logs -N break credits (e.g.,grain borgrain b 5).Ndefaults to 1 if omitted.- Constraint: You cannot log more break credits than currently available for the week.
Example Output:
grain 3β¨ +3 study credits logged. Keep it rolling!grain bπ΅ -1 break credit logged. Breathe easy.grain log: View today's log entries.ποΈ Log for Jul 15 ββββββββββββββββββββββββββββ [09:30] +2 study [11:05] +1 study [14:00] -1 break Total βΈ π§ 3 study π€ 1 break
grain week: View the current weekly overview (Monday-Sunday, excluding Sunday logs).π Week of Jul 15 ββββββββββββββββββββββββββββ π§ Study βΈ 74 / 90 π€ Breaks βΈ 4 / 12 β¨ Surplus βΈ 0 π₯ Streak βΈ 4 weeks
grain stats: Show overall historical statistics.π Your Stats ββββββββββββββββββββββββββββ π Streak: 4 weeks π Best Surplus: +18 π Total Study: 210 credits π΅ Total Breaks: 35 credits π§Ύ Total Entries: 85
grain undo: Reverts the last logged action (study or break) and updates stats.π Undid log: [14:00] -1 break Remaining undo steps: 8
grain config: Opens~/.grain/config.jsonin your system's default editor. It respects the$EDITORenvironment variable or falls back tovim,nano, orcodeif found.Attempting to open /Users/yourname/.grain/config.json with vim... Editor closed. Configuration changes will be applied the next time you run grain.
grain reset: Prompts to delete all log entries for the current week (Monday-Sunday). Requires confirmation by typingreset grain.β οΈ Are you sure you want to reset this week's data? Type "reset grain" to confirm: reset grain π§Ή Current week data has been reset.
grain backup: Creates a timestamped backup ofdata.jsonin the~/.grain/backups/directory.ποΈ Backup saved to: ~/.grain/backups/backup_2024-07-15_10-30-00.json
grain restore <filename.json>: Replaces the currentdata.jsonwith the contents of a specific backup file from the~/.grain/backups/directory. Requires confirmation by typingyes.grain restore backup_2024-07-15_10-30-00.json
β οΈ This will overwrite current data with the contents of 'backup_2024-07-15_10-30-00.json'. Type "yes" to confirm: yes β»οΈ Data restored from backup_2024-07-15_10-30-00.json and current stats recalculated.
All application data is stored locally within the ~/.grain/ directory:
~/.grain/config.json: User configuration (weekly goal, break start). Edit viagrain configor manually.~/.grain/data.json: Contains all log entries (logs), weekly surplus history (weekly_surplus), current streak (streak), best surplus ever (best_surplus), and the undo stack (undo_stack).~/.grain/backups/: Stores timestamped JSON backups created withgrain backup.
- Weekly Goal: Set in
config.json(default90). This is the target number of study credits per week. - Break Credits: You start each week (Monday) with a base number of break credits set in
config.json(default12). - Surplus Bonus: If your total study credits for the week exceed the
weekly_goal, each extra study credit earns you +2 additional break credits for that week. Surplus =(StudyCredits - WeeklyGoal) * 2. - Break Cap: Available break credits at the start of the week are capped by
break_startin the config. Surplus earned during the week can increase this. - Weekly Cycle: Weeks run Monday to Sunday. Stats like available breaks and goal progress reset on Monday. Logging is disabled on Sundays.
- Streak: Tracks the number of consecutive previous weeks where the
weekly_goalfor study credits was met or exceeded. - Undo: Uses a stack (
undo_stackindata.json) to allow reversing log actions infinitely.
- Uses Go standard library and
github.com/spf13/cobrafor CLI structure. - Build:
go build -o grain . - Format:
go fmt ./... - Tidy dependencies:
go mod tidy - Run tests (if any added):
go test ./...
Study. Pause. Repeat.