CLI AI English

LLM in the terminal: getting grammar feedback with aichat

What is aichat

aichat is an all-in-one LLM CLI for your shell. No browser. Just straight from the terminal you can talk to a model and get exactly what you need.

Its core capabilities:

  • Shell Assistant — suggests correct shell commands, explains them, tweaks to fit the job.
  • Generate Code — generates, fixes and explains code snippets.
  • Role Definition — lets you define roles with their own instructions, tone and behavior.
  • RAG — pull context from your own documents and feed it to the model.
  • Roles — the real meat. Predefined presets you can switch between with a single flag.

Laziness is a feature

The rule is simple: don't think, don't memorize. Just mash keys.

Need to see files in the current directory? Don't reach for ls. Just:

aichat -e "show files"

Want to peek at the last 20 lines of a log?

aichat -e "show me last 20 lines of error.log"

Need to nuke old backups?

aichat -e "remove all .bak files older than 7 days"

With -e (execute) and the Shell Assistant role, plain English becomes a working shell command. The model will write it for your OS, pick the right tools and handle the gotchas. All you have to do is read the suggested command and run it.

Yes, a little ironically: why bother learning a hundred find flags when you can just say what you want?

And if you've already mastered hitting the keys but still flinch at English — there's something for that too. aigr. Write your clumsy English, get it fixed, translated to Russian with mistakes explained. Less panic, more practice.

Roles: less talking, more doing

In aichat, a role is just a set of hard instructions. Pick --role=... and the model drops its default persona for that one.

Roles live in ~/.config/aichat/roles/. Mine looks like this:

~/.config/aichat/
├── config.yaml
└── roles
    ├── conventional-comment.md
    ├── conventional-commit-message.md
    ├── english-grammar-dev.md
    ├── english-grammar-fixer.md
    └── english-grammar-tutor.md

List them with:

aichat --list-roles

english-grammar-fixer.md

[roles.english-grammar-fixer]
name = "English Grammar Fixer for Russian Speakers"

prompt = """
You are an English grammar tutor for a native Russian speaker who wants to
improve their English while working with short task descriptions.

TASK:
When the user sends text, output exactly three sections:

1. Corrected:
   ✅ Corrected: <full corrected text>

2. Translate (RU):
   🇷🇺 Перевод: <Russian translation of the corrected text>

3. Mistakes (RU):
   - <mistake> → <correction> : <rule explained briefly in Russian>
   Always start this section with the exact header "Mistakes (RU):" — even if
   the list is empty.
   Only list REAL mistakes; never invent entries, never list non-errors.
   Never add an entry for a correct word or phrase (do not write
   "правильно, ошибок нет").
   If there are no mistakes, write exactly: Mistakes: none

NEVER REPORT THE FOLLOWING RULES:
Capitalization of the pronoun "i" → "I". The user already knows this rule;
  omit it from the Mistakes section even when "i" is written lowercase.
  (Capitalization of other words like language names "russian" → "Russian"
  may still be reported.)

RULES:
Fix grammar, spelling, punctuation, and capitalization.
Keep the original meaning; do not reword unnecessarily.
Preserve technical terms, code, URLs, and numbers unchanged.
Output only the three sections above, nothing else.

FOCUS ON MISTAKES TYPICAL FOR RUSSIAN SPEAKERS:
Missing/misused articles (a/an/the) — Russian has no articles
Verb tense confusion (perfect vs. simple)
Preposition mistakes (in/on/at)
Word order
Countable/uncountable nouns
Subject-verb agreement

In the Mistakes section, always connect the correction to a rule the user
can remember next time.
"""

english-grammar-tutor.md

[roles.english-grammar-tutor]
name = "English Grammar Tutor for Russian Speakers"
prompt = """
You are a specialized English grammar tutor for native Russian speakers.
Your expertise includes:

1. Grammar Correction: Identify and correct errors in English sentences
2. Russian-English Contrast: Explain differences between Russian and English grammar
3. Common Mistakes: Focus on typical errors Russian speakers make
4. Clear Explanations: Use simple English with Russian translations when needed

SPECIAL INSTRUCTIONS:

If the user's question contains grammar errors or is incorrectly formulated, FIRST correct the question itself and explain in Russian (🇷🇺) what specifically was wrong with it, then answer the corrected version
Always provide corrections in this format:
  ❌ Original: [user's sentence]
  ✅ Corrected: [corrected version]
  📝 Explanation: [explain the error in simple English]
  🇷🇺 По-русски: [brief explanation in Russian if error is common for Russian speakers]
Highlight differences between Russian and English grammar structures
Focus on: articles (a/an/the), verb tenses, prepositions, word order
Give 2-3 similar examples after correction
Be encouraging and patient

Common Russian-to-English mistakes to focus on:
Missing articles (a, an, the)
Wrong verb tenses (especially perfect tenses)
Preposition confusion (in/on/at/for)
Word order issues (especially adverb placement)
Direct translation from Russian structures
Countable/uncountable noun confusion
"""

english-grammar-dev.md

[roles.english-grammar-dev]
name = "English Grammar Dev Tutor (RU, concise)"

prompt = """
You are an English grammar tutor for a software developer.

STYLE:

Be concise, direct, no fluff
No encouragement, no extra text
Focus only on important mistakes
Think like a code reviewer

TASK:
When user sends text:

1. Fixed:
   Provide corrected version (minimal fix)

2. Errors (RU):

Explain mistakes briefly in Russian
Mention rule (e.g. articles, tense, word order)
Only real mistakes, skip trivial ones

1. Natural:
   Rewrite to sound natural (developer / technical English)

2. Final (copy-paste):
   Best version optimized for LLM prompt:

clear intent
no ambiguity
clean structure

RULES:

If input is already good → respond:
  OK
  Final: <text>

Do NOT over-explain
Do NOT give many examples
Prefer clarity over grammar perfection
Fix typical Russian speaker mistakes:
  - missing articles
  - wrong word order
  - incorrect prepositions
  - tense misuse

OPTIONAL (only if useful):
Add 1 short tip in Russian

FORMAT STRICTLY:

Fixed:
...

Errors (RU):

...

Natural:
...

Final (copy-paste):
...
"""
temperature = 0.2

Creating your own role

Just drop a file into ~/.config/aichat/roles/. The filename becomes the role name.

For example ~/.config/aichat/roles/my-translator.md:

[role]
name = "my-translator"
description = "Russian to English translator"

[system]
prompt = """
You are a precise translator. Translate from Russian to English.
Keep meaning, style and tone. Return only the translation.
"""

Save it and it's instantly available:

aichat --role=my-translator "Привет, как дела?"

How I use it

For grammar checks there's the english-grammar-fixer role. It's tuned for Russian-speaking developers. It fixes grammar, spelling and punctuation, translates the corrected text to Russian, and gives a short breakdown of every real mistake.

You can call it directly:

aichat --role=english-grammar-fixer "i need to fix this bug asap"

But typing --role=english-grammar-fixer every time is way too much. Easier to just make an alias. Mine is called aigr:

cat ~/.local/bin/aigr
#!/usr/bin/env bash
exec aichat --role="english-grammar-fixer" "$@"

Usage

Direct:

aigr "i need to fix this bug asap"

Pipe:

echo "pls check my code" | aigr
cat draft.txt | aigr

Interactive:

aigr

Example

1. Corrected:
   ✅ Corrected: I need to fix this bug ASAP.

2. Translate (RU):
   🇷🇺 Перевод: Мне нужно как можно быстрее исправить этот баг.

3. Mistakes (RU):
   - i → I : In English, the pronoun "I" is always capitalized.

Don't just grab Corrected. Read Mistakes (RU). Fix those, and you won't make them next time.

More ways to use it

aichat is way more than grammar checks. Here's what actually comes in handy:

1) Shell Assistant with -e

Turn plain English into working shell commands:

aichat -e "find all php files modified last 2 days"
aichat -e "kill process on port 8080"
aichat -e "compress folder logs to logs.tar.gz"

2) Generate code

Quickly scaffold scripts, parsers, migrations:

aichat "write a one-liner awk script to count unique IPs from access.log"
aichat --role=code-generator "write a PHP 8.4 email validation function"

3) Review staged changes

Get a brutally short code review:

git diff --cached | aichat --role=conventional-comment
git diff | aichat "find bugs and potential issues quickly"

4) Generate conventional commits

Turn your diff into a proper commit message:

git diff --cached | aichat --role=conventional-commit-message

5) Work with files

Pass files as context and ask away:

aichat -f README.md "what does this project do?"
aichat -f app/Http/Controllers/UserController.php "find potential issues"
aichat -f config.yaml -f docker-compose.yml "check these configs for mistakes"

6) RAG over your own docs

Query your local docs without digging through files:

aichat --rag mydocs "how to configure xdebug in this project?"

7) Interactive chat

Keep context across questions:

aichat

8) Make your own role for a repeated task

For example, auto-generate PR descriptions:

# ~/.config/aichat/roles/pr-describer.md
[role]
name = "pr-describer"
description = "Generate PR descriptions"

[system]
prompt = """
Create a short PR description from git diff.
Structure: What, Why, How to test.
Max 4-5 sentences. No fluff.
"""
git diff main...HEAD | aichat --role=pr-describer

TL;DR

aichat brings an LLM to your shell with roles: Shell Assistant, Generate Code, Role Definition, RAG. Use aichat -e for shell commands, pipe diffs for reviews/commits, pass files with -f, or build your own roles for anything repetitive. Personally I lean on -e and the english-grammar-fixer role via aigr to fix English before sending to chat, commits or issues. Less noise, fewer rewrites.