Mert
Yerli sağlık girişimi Viseur AI, 350 bin dolar yatırım aldı
Xbox Game Pass’e eklenecek ve çıkacak yeni oyunlar açıklandı
Mayıs ayının sonunda Xbox Game Pass’e eklenecek ve ayrılacak yeni oyunlar açıklandı. Persona 4 Golden ve Spray Paint Simulator dahil olmak üzere birçok oyun kütüphaneden siliniyor.Mercedes-AMG GT 4-Kapı Coupe elektrikli oldu: 1.153 beygir güç!
Mercedes-AMG, tamamen elektrikli yeni GT 4-Kapı Coupe modelini tanıttı. 1.153 beygire ulaşan güç, 2 saniyelik 0-100 km/s süresi ve 700 km menzil sunan model, AMG tarihinde yeni bir dönemi başlatıyor.Conductor Joins the Cloud Coding Agent Rush: Remote AI Devs Leave the Laptop
For about two years, “AI coding agent” meant something that ran next to your editor: a Copilot completion, a Cursor chat panel, a Claude Code session in your terminal. The work used your CPU, held your attention, and stopped when you closed the laptop. That assumption is breaking. A separate class of tools runs the agent on remote infrastructure instead — you describe a task, close the tab, and come back to a pull request. Conductor is the newest name moving in this direction, and it lands in a category that already includes background agents from Cursor, GitHub, OpenAI, and Google.
The agent leaves your laptop
A cloud coding agent executes on a vendor’s servers rather than your machine. You hand it a task — fix a failing test, migrate a module, draft an endpoint — through a web UI, a chat message, or a linked issue. It spins up an isolated sandbox, clones your repository, works through the task, and pushes a branch or opens a PR. You don’t watch the edits land in your editor; you review the output.
That sounds like a small plumbing change, but it shifts what you can reasonably ask for. An IDE assistant is interactive: fast, visible, and dependent on you staying in the loop. A remote agent is asynchronous: slower to finish any single task, but it doesn’t need your attention while it runs and doesn’t compete with your machine for memory or battery.
A concrete version: you notice a flaky integration test on Friday afternoon. With an IDE assistant you would open the file and work through it interactively. With a cloud agent you describe the symptom, link the failing run, and close the tab — the fix shows up as a PR you review on Monday, having spent no local time on it.
The field filled out fast. GitHub’s Copilot coding agent takes an assigned issue and returns a PR. Cursor’s background agents run a task remotely while you keep editing locally. OpenAI’s Codex cloud agent and Google’s Jules both work asynchronously against your GitHub repositories. Devin markets itself as an autonomous teammate. Anthropic runs Claude Code as a hosted web service alongside the CLI. Conductor — known for orchestrating several agents at once, each in its own isolated workspace — is extending that orchestration toward remote execution. The pitch is consistent across all of them: stop treating your laptop as the place the work happens.
What changes when the work runs remotely
Moving the agent off your laptop is not just a hardware swap. It changes the unit of work you delegate and the way you supervise it. Three shifts matter most.
Parallelism stops being a resource problem. Running five local agents means five processes competing for your CPU, your RAM, and your battery — in practice you run one and wait. Running five remote agents costs you nothing locally. Your machine becomes a dashboard rather than a worker, and you can fan a bug triage out across several tasks, then review each branch as it finishes instead of serially.
Long-running work stops blocking you. A dependency upgrade that touches 30 files, or a refactor that takes 40 minutes, no longer locks the editor you need for everything else. You assign it before a meeting and review the PR after. Wall-clock time per task may be longer than a local run, but it overlaps with the rest of your day rather than consuming it.
Collaboration gets a shared surface. Because the task and its output live in shared infrastructure, a teammate can inspect an agent’s branch, leave review comments, or take it over the same way they would any pull request. You can trigger a task from a phone, a Slack thread, or an issue tracker — the work no longer depends on your specific dev environment being awake, which also means a handoff across time zones stops stalling on “it’s on my other machine.”
A remote agent you aren’t watching can spend 30 minutes confidently heading the wrong direction. The asynchronous model removes your token-by-token oversight, so a vague task description costs more — you discover the misread only when the PR arrives. Write the task like a spec: name the files, state the constraints, and define what “done” looks like.
Picking a cloud agent without locking yourself in
The tools differ most in details that are easy to skip past in a demo. Check how the sandbox is provisioned — can the agent install your dependencies and run your real test suite, or does it work against a stripped-down environment? Check what crosses into the vendor’s cloud: your repository, and any secrets you grant for builds or integration tests, are processed on third-party infrastructure. Check the pricing model, because per-task, usage-based, and per-seat plans reward very different workloads. And check the review path — an agent that opens clean, scoped PRs into your existing flow is far less disruptive than one that invents its own.
Lock-in is the quiet risk. Because the task description is the real interface, a task written for one agent usually transfers to another. Keep your prompts in version control or an issue tracker rather than buried in a vendor UI, and switching costs stay low.
Conductor’s angle — orchestrating multiple agents rather than running one — is worth weighing here. If your work splits cleanly into independent chunks, an orchestrator that launches and tracks several remote agents at once can beat a single-agent tool. If you mostly delegate one task at a time, that coordination layer is overhead you don’t need yet.
Start with a contained, low-stakes task — a flaky test, a small dependency bump, a docs fix — before you delegate anything on a critical path. You learn an agent’s failure modes on work that is cheap to throw away.
If you want to test the remote model without leaving an editor you already know, Cursor is a low-risk place to start: the same IDE for interactive edits, plus background agents for delegated tasks.
The remote agent category is young, and Conductor’s arrival is a signal more than a verdict. The question for tooling teams is shifting from “which assistant runs in my IDE” to “where does my agent work run, and who can pick it up” — and that is worth deciding deliberately rather than by default.
Originally published at pickuma.com. Subscribe to the RSS or follow @pickuma.bsky.social for new reviews.
CI/CD avec GitHub Actions
CI/CD avec GitHub Actions : Guide Complet
GitHub Actions révolutionne l’intégration et le déploiement continus en intégrant directement ces fonctionnalités dans votre repository GitHub. Ce guide vous accompagne dans la mise en place d’une pipeline CI/CD robuste.
Qu’est-ce que GitHub Actions ?
GitHub Actions est une plateforme d’automatisation qui permet de :
- Exécuter des workflows basés sur des événements
- Automatiser les tests, builds et déploiements
- Créer des actions personnalisées réutilisables
- S’intégrer parfaitement avec l’écosystème GitHub
Concepts Fondamentaux
1. Composants Clés
- Workflow : Processus automatisé défini dans un fichier YAML
- Job : Ensemble de steps qui s’exécutent sur un runner
- Step : Action individuelle (commande ou action)
- Runner : Machine virtuelle qui exécute les jobs
- Action : Application réutilisable qui effectue une tâche
2. Structure d’un Workflow
name: CI/CD Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
Pipeline CI Complète
1. Workflow Python avec Tests
name: Python CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 black mypy
pip install -r requirements.txt
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
- name: Format check with black
run: black --check .
- name: Type check with mypy
run: mypy src/
test:
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
pip install -r requirements.txt
- name: Run tests with coverage
run: |
pytest --cov=src --cov-report=xml --cov-report=html
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run security scan
uses: pypa/[email protected]
with:
inputs: requirements.txt
- name: Run Bandit security check
run: |
pip install bandit
bandit -r src/ -f json -o bandit-report.json
- name: Upload security report
uses: actions/upload-artifact@v4
if: always()
with:
name: security-report
path: bandit-report.json
2. Workflow Node.js/React
name: Node.js CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16, 18, 20]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint
- name: Run type checking
run: npm run type-check
- name: Run unit tests
run: npm test -- --coverage --watchAll=false
- name: Run integration tests
run: npm run test:integration
- name: Build application
run: npm run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-files-${{ matrix.node-version }}
path: dist/
e2e-tests:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Playwright
run: npx playwright install --with-deps
- name: Start application
run: |
npm run build
npm run start &
sleep 30
- name: Run Playwright tests
run: npx playwright test
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
Pipeline CD avec Déploiement
1. Déploiement sur AWS
name: Deploy to AWS
on:
push:
branches: [main]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run build
env:
REACT_APP_API_URL: ${{ secrets.API_URL }}
REACT_APP_ENV: production
- name: Deploy to S3
run: |
aws s3 sync dist/ s3://${{ secrets.S3_BUCKET }} --delete
- name: Invalidate CloudFront
run: |
aws cloudfront create-invalidation
--distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
--paths "/*"
- name: Notify Slack
if: always()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
channel: '#deployments'
webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
2. Déploiement Docker
name: Docker Build and Deploy
on:
push:
branches: [main]
tags: ['v*']
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy to staging
if: github.ref == 'refs/heads/main'
run: |
echo "Deploying to staging environment"
# Commandes de déploiement ici
Workflows Avancés
1. Matrix Strategy avec Conditions
name: Cross-platform Testing
on: [push, pull_request]
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11']
exclude:
- os: windows-latest
python-version: '3.9'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies (Unix)
if: runner.os != 'Windows'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
shell: cmd
- name: Run tests
run: pytest
2. Déploiement Multi-Environnement
name: Multi-Environment Deploy
on:
push:
branches: [main, develop]
jobs:
deploy-staging:
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
environment:
name: staging
url: https://staging.example.com
steps:
- name: Deploy to Staging
run: |
echo "Deploying to staging"
# Logique de déploiement staging
deploy-production:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment:
name: production
url: https://example.com
steps:
- name: Deploy to Production
run: |
echo "Deploying to production"
# Logique de déploiement production
Actions Personnalisées
1. Action Composite
# .github/actions/setup-node-cache/action.yml
name: 'Setup Node with Cache'
description: 'Setup Node.js with dependency caching'
inputs:
node-version:
description: 'Node.js version'
required: false
default: '18'
working-directory:
description: 'Working directory'
required: false
default: '.'
runs:
using: 'composite'
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: 'npm'
cache-dependency-path: ${{ inputs.working-directory }}/package-lock.json
- name: Install dependencies
working-directory: ${{ inputs.working-directory }}
run: npm ci
shell: bash
2. Usage de l’Action
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js with cache
uses: ./.github/actions/setup-node-cache
with:
node-version: '18'
working-directory: './frontend'
Bonnes Pratiques
1. Sécurité
# Utilisation des secrets
steps:
- name: Deploy with secrets
env:
API_KEY: ${{ secrets.API_KEY }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
run: |
echo "API_KEY is set: ${API_KEY:+yes}"
# Utiliser les secrets de manière sécurisée
2. Optimisation des Performances
# Cache des dépendances
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
# Parallélisation des jobs
jobs:
lint:
runs-on: ubuntu-latest
test:
runs-on: ubuntu-latest
build:
needs: [lint, test]
runs-on: ubuntu-latest
3. Monitoring et Notifications
- name: Notify on failure
if: failure()
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '❌ Pipeline failed! Please check the logs.'
})
Conclusion
GitHub Actions offre une solution puissante et flexible pour l’automatisation :
- Intégration native avec GitHub
- Écosystème riche d’actions réutilisables
- Scaling automatique des runners
- Support multi-plateforme
- Gestion fine des permissions
Une pipeline bien conçue améliore la qualité du code, réduit les risques de déploiement et accélère le cycle de développement. L’investissement initial en configuration est rapidement rentabilisé par la réduction des erreurs et l’automatisation des tâches répétitives.
kop — A Modern Kubernetes Terminal UI Built with Python
I spend most of my day managing Kubernetes clusters from the terminal.
Like many engineers, I rely heavily on:
- kubectl
- SSH
- log streaming
- pod debugging
- cluster troubleshooting
Over time, I realized I wanted something that felt more interactive and efficient than constantly switching between terminal commands and browser dashboards.
So I started building kop.
What is kop?
kop is a modern terminal UI for Kubernetes built with Python.
It provides an interactive Kubernetes experience directly inside the terminal while remaining lightweight, keyboard-driven, and SSH-friendly.
Project site:
Why Another Kubernetes TUI?
Tools like K9sare already excellent.But while using existing tools, I still wanted:
- A cleaner modern UI
- Better keyboard workflows
- Faster navigation
- More extensible architecture
- Improved terminal interaction
- A smoother troubleshooting experience
kop is my attempt to explore those ideas.
Features
Interactive Kubernetes Resource Navigation
Browse resources interactively:
- Pods
- Deployments
- StatefulSets
- DaemonSets
- Services
- Nodes
- Namespaces
- ConfigMaps
- Secrets
- Events
- …
Screenshots
CLI ile Aracı Token Maliyetlerini Düşürme (2026 Rehberi)
Bir CLI kodlama ajanı, fatura gelene kadar “özgür” görünür. Claude Code veya Codex’i bir depoya yönlendirip bir modülü yeniden düzenlemesini istediğinizde, on dakika içinde kırk dosya okumuş, testleri üç kez çalıştırmış ve aslında hiç gerek olmayan bağlam için altı haneli token harcamış olabilir. Bunu gün boyu ajan kullanan sekiz kişilik bir ekiple çarptığınızda maliyet hızla büyür. İyi haber: Kodlama ajanlarında token israfının büyük kısmı, modeli değiştirmeden veya çıktı kalitesinden vazgeçmeden komut satırı alışkanlıklarıyla azaltılabilir.
TL;DR
Ajan maliyetini düşürmek için modele gitmeden önce bağlamı küçültün:
- Çalışma kümesini dosya/dizin bazında sınırlayın.
-
CLAUDE.mdgibi bellek dosyalarını kısa tutun. - Uzun oturumlarda
/compactveya/clearkullanın. - Kararlı ön ekler için istem önbellekleme açın.
- Basit alt görevleri daha ucuz modele yönlendirin.
- Test, kurulum ve diff çıktısını filtreleyin.
- Her çalıştırmanın token ve maliyetini ölçün.
Giriş
Sorun genelde iki şekilde görünür: Ya görev ortasında haftalık/oturum limitine çarparsınız ya da ay sonunda API faturası gelir ve “AI asistanı neden bu kadar pahalı?” sorusu sorulur.
Temel neden aynıdır: CLI ajanları varsayılan olarak çok fazla bağlam taşır. On satır koda ihtiyaç duyduklarında tüm dosyayı okurlar, her dönüşte konuşma geçmişini yeniden gönderirler, komut çıktılarını ham haliyle bağlama eklerler ve aynı sistem istemini binlerce kez tekrar yollarlar.
Bu kaçınılmaz değildir. 2.000 token’lık kod üzerinde akıl yürütmesi gereken bir refactor işleminin 180.000 token bağlama ihtiyacı yoktur. Aradaki fark sizin tasarruf alanınızdır.
Bu rehberde şu başlıkları uygulamalı olarak ele alacağız:
- CLI ajan çalışmasında token’ların nereye gittiği
- Bağlam hijyeni ve bellek dosyaları
- İstem önbellekleme
- Model yönlendirme
- Araç çıktısını ve dosya alımını kısaltma
- Çalıştırma başına maliyet ölçümü
Örnekler Claude Code ve Codex üzerinden ilerliyor, ancak aynı ilkeler token tabanlı API kullanan çoğu kodlama ajanı için geçerlidir.
Ek bir maliyet kaynağı da API hata ayıklamasıdır. Güvenilmez bir dahili API’ye bağlanan ajan, her denemede token harcar: yeniden dener, hata gövdelerini okur, belgeleri tekrar tarar ve aynı döngüye girer.
💡 Ajanlarınız API’lerle çalışıyorsa, API’leri ajana vermeden önce Apidog’da tasarlamak, mock verilerle test etmek ve sözleşmesini doğrulamak pahalı deneme-yanılma döngülerini azaltır. Ajan, sürprizlerle dolu canlı bir endpoint yerine beklenen davranışı olan bir API sözleşmesine karşı çalışır.
CLI Ajan Çalışmasında Token’lar Nereye Gider?
Bir ajan dönüşünde modele giriş yükü gönderilir ve modelden çıktı alınır. İkisi için de ödeme yaparsınız. Çoğu sağlayıcıda çıktı token’ları, giriş token’larından daha pahalıdır.
Örnek olarak bir model ailesinde:
- Giriş: milyon token başına yaklaşık 3$
- Çıkış: milyon token başına yaklaşık 15$
- Daha küçük modelde giriş: yaklaşık 1$
- Daha küçük modelde çıkış: yaklaşık 5$
Bunları sabit fiyat olarak değil, oranları anlamak için örnek kabul edin. Güncel fiyatları her zaman sağlayıcının fiyatlandırma sayfasından kontrol edin.
Tipik bir ajan çalışmasında giriş token’larını büyüten kalemler şunlardır:
- Sistem istemi ve araç tanımları: Ajan talimatları ve araç JSON şemaları. Her dönüşte tekrar gönderilir.
-
Bellek/proje dosyaları:
CLAUDE.mdgibi dosyalar, depo kuralları ve kalıcı talimatlar. - Konuşma geçmişi: Önceki kullanıcı mesajları, model yanıtları, araç çağrıları ve araç sonuçları.
- Okunan dosya içerikleri: Ajanın açtığı kaynak dosyalar.
-
Araç çıktısı: Test logları,
npm installçıktısı,git diff, stack trace’ler.
En kritik nokta: Konuşma geçmişi her dönüşte yeniden oynatılır.
30 dönüşlük bir oturum, tek dönüşün 30 katı değildir; büyüyen bir ön ekin tekrar tekrar gönderilmesine benzer. Bu yüzden uzun ve dağınık oturumlar pahalıdır.
Oturum ve limit muhasebesi hakkında daha fazla detay için Claude Code token penceresinin nasıl sıfırlandığına dair açıklama faydalı bir tamamlayıcıdır.
1. Bağlam Hijyeni ve Bellek Dosyaları
En ucuz token, hiç göndermediğiniz tokendir.
Çalışma kümesini baştan sınırlayın
Ajanı depo kökünde açıp şunu demeyin:
claude "fatura mantığını yeniden düzenle"
Bu, ajanın gereksiz keşif yapmasına yol açar.
Bunun yerine dosya ve kapsam belirtin:
claude "src/payments/retry.ts ve ilgili test dosyasında üstel geri çekilmeyi kullanacak şekilde yeniden deneme mantığını yeniden düzenle"
Daha iyi bir istem şunları içerir:
- Değiştirilecek dosyalar
- Değişiklik hedefi
- Test kapsamı
- Okunmaması gereken alanlar
Örnek:
claude "
Sadece şu dosyaları kullan:
- src/payments/retry.ts
- src/payments/retry.test.ts
Amaç:
Yeniden deneme mantığını üstel geri çekilme kullanacak şekilde düzenle.
Kısıtlar:
- Public API imzasını değiştirme.
- Başka dizinleri tarama.
- Sadece başarısız testleri çalıştır.
"
Bellek dosyasını kısa tutun
CLAUDE.md veya eşdeğer proje bellek dosyası her dönüşte bağlama eklenebilir. Bu dosya büyüdükçe her ajan çağrısının sabit maliyeti artar.
Yaklaşık token sayısını kontrol edin:
wc -c CLAUDE.md | awk '{print "≈", int($1/4), "token/dönüş"}'
İyi bir CLAUDE.md şunları içermelidir:
# Proje Kuralları
## Komutlar
- Test: npm test --silent
- Lint: npm run lint
- Typecheck: npm run typecheck
## Kod Kuralları
- Public API imzalarını değiştirme.
- Yeni bağımlılık eklemeden önce sor.
- Test eklemeden refactor tamamlanmış sayılmaz.
## Belgeler
- API sözleşmeleri: docs/api.md
- Ödeme akışı: docs/payments.md
Kötü örnek:
# Proje Hakkında
Bu proje 2021 yılında başladı...
Burada tüm mimari geçmişi...
Tüm endpoint belgeleri...
Tüm veritabanı tabloları...
Tüm onboarding notları...
Bellek dosyası wiki değildir. Sık kullanılan kuralları tutun, detaylı belgeleri linkleyin.
Uzun oturumları sıkıştırın veya temizleyin
Bir görev bittiğinde aynı konuşma içinde yeni göreve geçmeyin. Eski bağlam yeni görevin maliyetini artırır.
Claude Code’da:
/compact
Bu, geçmişi kısa bir özete dönüştürür.
Yeni ve ilgisiz bir göreve başlıyorsanız:
/clear
Basit kural:
- Aynı mantıksal görev: devam edin.
- Yeni görev:
/compactveya/clear.
Claude Code iş akışlarındaki desenler bu kapsam belirleme alışkanlığına dayanır.
Ignore dosyası kullanın
Ajanın şu dizinleri okumasını engelleyin:
node_modules/
dist/
build/
coverage/
.next/
.vendor/
*.lock
Ajan node_modules/ veya dist/ görmezse, bu dosyaları okuyup token harcayamaz.
2. İstem Önbellekleme: Aynı Ön Ek İçin Tekrar Ödeme Yapmayın
İstem önbellekleme, sistem istemi, araç tanımları ve depo kuralları gibi kararlı ön eklerin sağlayıcı tarafından önbelleğe alınmasını sağlar.
Ekonomi basittir:
- İlk yazma normal girişten biraz pahalıdır.
- Sonraki okumalar yaklaşık %90 indirimlidir.
- Büyük ve sabit ön eklerde ciddi tasarruf sağlar.
Kararlı içeriği önce, değişken içeriği sonra koyun:
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=2048,
system=[
{
"type": "text",
"text": SYSTEM_PROMPT + REPO_CONVENTIONS,
"cache_control": {"type": "ephemeral"},
}
],
messages=[
{
"role": "user",
"content": user_task,
}
],
)
Kullanımı ölçün:
u = response.usage
print("önbellek yazma:", u.cache_creation_input_tokens)
print("önbellek okuma :", u.cache_read_input_tokens)
print("yeni giriş :", u.input_tokens)
Dikkat edilmesi gerekenler:
- Önbellek kesme noktasından önce değişken veri koymayın.
- Sistem istemine timestamp eklemeyin.
- Aynı işleri yakın zaman aralığında çalıştırın.
- Ön ek bayt düzeyinde kararlı olmalıdır.
Örnek senaryo:
- Sistem istemi + repo kuralları: 8.000 token
- Günlük çağrı sayısı: 60
Önbellekleme yoksa 8.000 token için 60 kez ödeme yaparsınız. Önbellekleme varsa ilk yazmadan sonra çoğu çağrı indirimli okunur.
OpenAI tarafında da desteklenen modellerde önbelleğe alınmış giriş için benzer indirimler otomatik uygulanabilir. Ayarlar değişebilir, ancak ilke aynıdır.
Codex tarafında yönlendirme ve ücretsiz katman seçenekleri için Codex aracılığıyla GPT-5.5’i ücretsiz çalıştırma rehberi bu stratejiyi tamamlar.
3. Model Yönlendirme: Basit İşe Ucuz Model
Her görev en güçlü modeli gerektirmez.
Şunlar genellikle küçük modelle yapılabilir:
- Commit mesajı yazma
- Diff özetleme
- Changelog girdisi oluşturma
- Basit test taslağı üretme
- Değişken yeniden adlandırma
- Lint hatası açıklama
Şunlar daha güçlü model gerektirebilir:
- Mimari karar
- Karmaşık refactor
- Çok dosyalı hata ayıklama
- Performans analizi
- Güvenlik açısından kritik değişiklik
CLI’dan model seçimi:
claude --model haiku "evreye alınmış diff için conventional commit mesajı yaz"
claude --model sonnet "ödeme servisi için cache katmanını yeniden tasarla"
Varsayılan strateji:
# Basit görevler için ucuz model
alias ccheap='claude --model haiku'
# Zor görevler için güçlü model
alias cstrong='claude --model sonnet'
Kullanım:
ccheap "bu diff'i 5 maddede özetle"
cstrong "src/payments içindeki retry ve idempotency akışını analiz et"
Çoğu ekip tersini yapar: Her şeyi pahalı modelle çalıştırır ve basit işler için gereksiz ödeme yapar.
Alt-ajan destekleyen sistemlerde de aynı kural geçerlidir:
- Üst ajan: güçlü model, küçük karar sayısı
- Alt ajan: ucuz model, dar görev, kısa bağlam
Örneğin:
Alt ajan görevi:
Sadece src/payments dizininde retry ile ilgili fonksiyonları bul.
Kod değiştirme.
En fazla 10 maddelik özet döndür.
Üst ajan sadece özetlenmiş sonucu görür; tüm arama bağlamını taşımak zorunda kalmaz.
Bu yetki devri desenleri için Codex ve Claude Code’daki hedef komut rehberindeki otonom döngü örnekleri faydalıdır.
Limitli plan kullanıyorsanız model yönlendirme yalnızca maliyeti değil, hakkınızın ne kadar dayanacağını da etkiler. Claude Code haftalık limit artışı yardımcı olabilir, ancak doğru yönlendirme hâlâ kritik kaldıraçtır.
4. Araç Çıktısını Kısaltın
Ajanın çalıştırdığı her komut metin döndürür. Bu metin bağlama eklenir ve sonraki dönüşlerde tekrar gönderilir.
Gürültülü komutlar pahalıdır:
npm test
npm install
git diff
pytest
Komutları sessiz çalıştırın
# Gürültülü
npm test
# Daha kısa çıktı
npm test --silent -- --reporter=dot
# Gürültülü
npm install
# Daha kısa çıktı
npm install --silent --no-audit --no-fund
Çıktıyı filtreleyin
pytest -q 2>&1 | tail -n 30
git diff --stat
npm test 2>&1 | grep -E "(FAIL|✗|Error)" | head -n 20
Ajan çoğu zaman tüm loga değil, şu bilgilere ihtiyaç duyar:
- Test geçti mi?
- Hangi test başarısız oldu?
- Hata mesajı nedir?
- İlgili stack trace’in son kısmı nedir?
Büyük diff’leri sınırlayın
Şunu yaptırmayın:
git diff
Önce özet alın:
git diff --stat
Sonra yalnızca ilgili dosyayı açtırın:
git diff -- src/payments/retry.ts
Kilit dosyaları özellikle tehlikelidir:
git diff -- package-lock.json
Bu çıktı binlerce satır olabilir. Ajanın genelde tamamına ihtiyacı yoktur.
5. Tüm Dosya Yerine Hedefli Okuma Kullanın
Bir fonksiyonu değiştirmek için 1.500 satırlık dosyanın tamamını okumak israftır.
Daha iyi yaklaşım:
grep -n "function retryPayment" src/payments/retry.ts
Sonra ilgili pencereyi okuyun:
sed -n '120,220p' src/payments/retry.ts
Ajan istemine bunu açıkça yazın:
Tüm dosyayı okuma.
Önce retry mantığını grep ile bul.
Sadece ilgili fonksiyonun çevresindeki yaklaşık 100 satırı oku.
Büyük dosyalarda bu fark ciddi olabilir:
- Tüm dosya: ~18.000 token
- Hedefli pencere: ~800 token
6. RAG ve Doküman Alımını Sınırlayın
Ajanınız kod tabanı araması veya doküman RAG kullanıyorsa, alınan parçaların sayısı ve boyutu maliyeti doğrudan etkiler.
Kötü varsayılan:
top_k = 50
chunk_size = 800
Bu, modele 40.000 token’a yakın bağlam taşıyabilir.
Daha iyi başlangıç:
top_k = 8
chunk_size = 200
Pratik kural:
- Daha az ama daha alakalı parça
- Kısa chunk
- Soruya göre filtrelenmiş dizin
- Gereksiz doküman koleksiyonlarını dışarıda bırakma
Örnek istem:
Sadece docs/payments ve src/payments altında arama yap.
Genel README, changelog ve onboarding belgelerini kullanma.
En fazla 8 kısa sonuç döndür.
7. Her Çalıştırmanın Maliyetini Ölçün
Ölçmediğiniz maliyeti azaltamazsınız.
API yanıtındaki kullanım bilgilerini kaydedin:
u = response.usage
INPUT_RATE = 3.00 / 1_000_000
OUTPUT_RATE = 15.00 / 1_000_000
CACHE_READ = 0.30 / 1_000_000
CACHE_WRITE = 3.75 / 1_000_000
cost = (
u.input_tokens * INPUT_RATE +
u.output_tokens * OUTPUT_RATE +
u.cache_read_input_tokens * CACHE_READ +
u.cache_creation_input_tokens * CACHE_WRITE
)
print(
f"çalıştırma maliyeti ≈ ${cost:.4f} "
f"(girdi={u.input_tokens}, "
f"çıktı={u.output_tokens}, "
f"önbellek okuma={u.cache_read_input_tokens})"
)
CLI kullanıyorsanız:
claude /cost
Daha iyi izleme için ajan çağrısını küçük bir wrapper içine alın:
#!/usr/bin/env bash
TASK="$1"
START=$(date -Iseconds)
claude "$TASK"
END=$(date -Iseconds)
echo "$START,$END,$TASK" >> agent-runs.csv
Daha gelişmiş sürümde şunları da kaydedin:
- Model
- Proje
- Görev etiketi
- Giriş token
- Çıkış token
- Cache read/write token
- Yaklaşık maliyet
API anahtarlarını da ayırın:
- Proje başına anahtar
- Ajan türü başına anahtar
- Ortam başına anahtar
Böylece harcama tek bir toplamda kaybolmaz.
Taktik Karşılaştırması
| Taktik | Tipik token tasarrufu | Çaba |
|---|---|---|
| Çalışma kümesini sınırlama | Çalıştırma başına girdide %30–60 | Düşük |
| Kısa ve kararlı bellek dosyası | Her dönüşte %5–15 | Düşük |
/compact veya /clear
|
Uzun oturumlarda %40–80 | Düşük |
| İstem önbellekleme | Önbelleğe alınan ön ekte ~%90 | Orta |
| Model yönlendirme | Yönlendirilen alt görevlerde %50–80 | Orta |
| Sessiz/filtrelenmiş araç çıktısı | Araç yoğun çalıştırmalarda %20–50 | Düşük |
| Hedefli dosya okuma | Büyük dosyalarda %70–95 | Düşük |
| Kısıtlı RAG alımı | RAG yoğun ajanlarda %30–60 | Orta |
| Çalıştırma başına maliyet ölçümü | Doğrudan %0; diğerlerini mümkün kılar | Düşük |
Tasarruf oranları örnektir. Gerçek kazanç, mevcut israf seviyenize bağlıdır.
Uygulanabilir Kontrol Listesi
Başlamak için sırayla şunları yapın:
[ ] CLAUDE.md dosyasını 1.000 token altına indir.
[ ] node_modules, dist, build, coverage ve lock dosyalarını ignore et.
[ ] Ajan istemlerinde dosya/dizin kapsamı belirt.
[ ] Test komutlarını sessiz moda al.
[ ] git diff yerine önce git diff --stat kullan.
[ ] Uzun oturumlarda /compact kullan.
[ ] Yeni görevlerde /clear ile başla.
[ ] Commit mesajı/diff özeti gibi işleri ucuz modele yönlendir.
[ ] Kararlı sistem istemi için prompt caching aç.
[ ] Her çalıştırma için token ve maliyet kaydı tut.
Sonuç
Ajan token maliyetlerinin çoğu modelden değil, çalışma şeklinden kaynaklanır. Gereksiz bağlam, uzun konuşma geçmişi, ham araç çıktısı ve yanlış model seçimi faturayı büyütür.
Önce düşük çabalı adımları uygulayın:
- Kapsamı daraltın.
- Bellek dosyasını küçültün.
- Araç çıktısını sessizleştirin.
- Uzun oturumları temizleyin.
- Basit işleri ucuz modele taşıyın.
Ardından istem önbellekleme ve maliyet ölçümü ekleyin. Bu kombinasyon, çıktı kalitesini düşürmeden ajan maliyetlerini yönetilebilir hale getirir.
วิธีลดค่าใช้จ่ายโทเค็นเอเจนต์จาก CLI (คู่มือปี 2026)
เอเจนต์เขียนโค้ด CLI อย่าง Claude Code หรือ Codex ช่วยให้ทำงานเร็วขึ้น แต่ค่าโทเค็นจะพุ่งทันทีถ้าปล่อยให้มันอ่าน repo ทั้งก้อน รัน test ซ้ำหลายรอบ และส่งประวัติสนทนาทั้งหมดกลับเข้าโมเดลทุกเทิร์น ข่าวดีคือคุณลดค่าใช้จ่ายได้จากบรรทัดคำสั่ง: จำกัดบริบท, ทำ output ให้สั้น, ใช้ prompt caching, route งานง่ายไปโมเดลราคาถูก และวัดต้นทุนต่อการรันจริง
สรุปสั้นๆ (TL;DR)
ถ้าต้องการลดค่าใช้จ่ายโทเค็นของ CLI coding agents ให้เริ่มจากสิ่งเหล่านี้:
- จำกัด scope ก่อนให้เอเจนต์ทำงาน
- ทำ
CLAUDE.mdหรือ memory file ให้สั้น - ใช้
/compactหรือ/clearเมื่อเปลี่ยนงาน - เปิด prompt caching สำหรับ prefix ที่เสถียร
- ใช้โมเดลราคาถูกกับงานย่อยที่ความเสี่ยงต่ำ
- ลด output จาก test runner, install command, logs และ diff
- วัด token usage และต้นทุนต่อ run
เป้าหมายคือส่งเฉพาะบริบทที่จำเป็นให้โมเดล ไม่ใช่ส่งทั้ง repo และประวัติทั้งหมดทุกครั้ง
ทำไม CLI agents ถึงกินโทเค็นเยอะ
ปัญหาหลักไม่ได้อยู่ที่โมเดลอย่างเดียว แต่อยู่ที่พฤติกรรม default ของเอเจนต์:
- อ่านไฟล์ทั้งไฟล์ ทั้งที่ต้องใช้แค่ฟังก์ชันเดียว
- ส่ง system prompt, tool definitions และ repo context ซ้ำทุกเทิร์น
- เล่นซ้ำ conversation history ทั้งหมด
- dump log จาก test runner หรือ command line กลับเข้า context
- ใช้โมเดลแพงกับงานง่าย เช่น commit message หรือ changelog
ตัวอย่าง: งาน refactor ที่ต้องใช้โค้ดจริงประมาณ 2,000 tokens อาจกลายเป็น request ขนาด 180,000 tokens ได้ ถ้าเอเจนต์อ่านหลายไฟล์ รัน test verbose และแบก history ยาวๆ ไปด้วย
ค่าใช้จ่ายที่ซ่อนอีกจุดคือการ debug API เอเจนต์ที่เรียก API ภายในซึ่งไม่เสถียรจะ retry, อ่าน error, อ่าน docs ซ้ำ และวนหลายรอบ ทุก loop มีค่าโทเค็นเต็ม
💡 หากเอเจนต์ของคุณต้องทำงานกับ API ให้ design, mock และ test API เหล่านั้นใน Apidog ก่อน แล้วค่อยให้เอเจนต์เขียนโค้ดกับ contract ที่คาดเดาได้ วิธีนี้ช่วยลดการลองผิดลองถูกกับ endpoint จริงที่อาจสร้าง error และกินโทเค็นโดยไม่จำเป็น
โทเค็นหายไปไหนในการรันจริง
หนึ่ง turn ของเอเจนต์มีทั้ง input tokens และ output tokens คุณจ่ายทั้งสองฝั่ง โดย output tokens มักแพงกว่า input tokens หลายเท่า
สิ่งที่อยู่ใน input payload มักประกอบด้วย:
-
System prompt และ tool definitions
เช่น instruction ของ agent และ JSON schema ของ tools มักถูกส่งซ้ำทุก turn
-
Memory/project files
เช่น
CLAUDE.md, coding conventions, repo rules -
Conversation history
user message, model response, tool call และ tool output เก่าทั้งหมด
-
ไฟล์ที่เอเจนต์อ่าน
การอ่านไฟล์ 1,200 บรรทัดครั้งเดียวอาจมีขนาด 12,000–18,000 tokens
-
Tool output
log จาก
npm install, test failure, stack trace,git diff, lockfile diff
จุดสำคัญคือ conversation history ถูกส่งซ้ำทุก turn ดังนั้น session 30 turns ไม่ได้แพงแค่ 30 เท่าของ 1 turn แต่แพงขึ้นตาม prefix ที่โตขึ้นเรื่อยๆ
ถ้าต้องการเข้าใจเรื่อง session/window เพิ่มเติม อ่านได้ที่ วิธีการรีเซ็ตหน้าต่างโทเค็นของ Claude Code
1. จำกัด scope ก่อนให้เอเจนต์เริ่มงาน
โทเค็นที่ถูกที่สุดคือโทเค็นที่ไม่ต้องส่ง อย่าเริ่มจาก prompt กว้างๆ เช่น:
claude "refactor the billing logic"
ให้ระบุไฟล์และขอบเขตให้ชัด:
claude "refactor the retry logic so it uses exponential backoff,
only in src/payments/retry.ts and src/payments/retry.test.ts"
ถ้าต้องให้เอเจนต์สำรวจ codebase ให้จำกัด directory:
claude "find the payment retry implementation under src/payments only,
then propose the minimal change"
แนวทางใช้งาน:
- หนึ่ง prompt ควรมีหนึ่งงานหลัก
- ระบุไฟล์หรือ directory
- บอกสิ่งที่ห้ามแตะ เช่น migration, generated files, lockfiles
- หลีกเลี่ยงคำสั่งประเภท “scan the whole repo”
2. ทำ memory file ให้สั้น
ไฟล์อย่าง CLAUDE.md ถูกโหลดเข้า context บ่อยมาก ถ้ามันกลายเป็น wiki ยาว 4,000 tokens ทีมจะจ่ายซ้ำทุก turn
ตรวจขนาดแบบคร่าวๆ:
wc -c CLAUDE.md | awk '{print "≈", int($1/4), "tokens per turn"}'
ควรเก็บเฉพาะ:
# CLAUDE.md
## Commands
- Run tests: npm test --silent -- --reporter=dot
- Typecheck: npm run typecheck
- Lint: npm run lint
## Rules
- Do not edit generated files.
- Do not modify package-lock.json unless dependency changes are requested.
- Keep changes minimal and scoped to the requested files.
## References
- API contracts: docs/api/
- Architecture notes: docs/architecture.md
ไม่ควรใส่:
- onboarding docs ทั้งชุด
- changelog ยาวๆ
- architecture document ทั้งไฟล์
- ตัวอย่างโค้ดจำนวนมากที่ไม่ได้ใช้ทุกงาน
ถ้าเอกสารบางส่วนใช้เดือนละครั้ง ให้เก็บไว้เป็นไฟล์แยก แล้วให้เอเจนต์อ่านเมื่อจำเป็น
3. ใช้ /compact หรือ /clear เมื่อเปลี่ยนงาน
session ยาวคือแหล่งกินโทเค็นหลัก เพราะทุก turn ใหม่ต้องแบก history เก่าทั้งหมด
ใน Claude Code:
/compact
ใช้เมื่อ session ยาว แต่ยังอยากเก็บสรุปของงานเดิมไว้
/clear
ใช้เมื่อเริ่มงานใหม่ที่ไม่เกี่ยวข้อง
กฎง่ายๆ:
- หนึ่ง logical task ต่อหนึ่ง session
- หลัง refactor เสร็จแล้ว อย่าใช้ session เดิมไปเขียน docs ต่อ
- ก่อนเริ่มงานใหม่ ให้
/clear - ถ้างานยังต่อเนื่องแต่ history ยาว ให้
/compact
ดู workflow เพิ่มเติมได้ที่ เวิร์กโฟลว์ของ Claude Code
4. ใช้ ignore files เพื่อตัดไฟล์ที่ไม่ควรเห็น
ให้เอเจนต์หลีกเลี่ยงไฟล์ที่สร้างขึ้นหรือไม่ควรแก้ เช่น:
node_modules/
dist/
build/
coverage/
.next/
.nuxt/
*.log
package-lock.json
pnpm-lock.yaml
yarn.lock
ถ้าเอเจนต์ไม่เห็น dist/, coverage/ หรือ lockfile diff มันก็ไม่เสียโทเค็นกับสิ่งเหล่านั้น
เพิ่มกฎใน memory file ด้วย:
Do not read or edit generated files, build output, coverage output, or dependency directories.
5. เปิด prompt caching สำหรับ prefix ที่เสถียร
Prompt caching ช่วยลดค่าใช้จ่ายของ prefix ที่ส่งซ้ำ เช่น system prompt, tools และ repo conventions
แนวคิดคือ:
- วางข้อมูลที่เสถียรไว้ด้านหน้า
- วาง input ที่เปลี่ยนบ่อยไว้ด้านหลัง
- cache เฉพาะ prefix ที่ไม่เปลี่ยน
ตัวอย่างถ้าเรียก API เอง:
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=2048,
system=[
{
"type": "text",
"text": SYSTEM_PROMPT + REPO_CONVENTIONS,
"cache_control": {"type": "ephemeral"},
}
],
messages=[
{
"role": "user",
"content": user_task,
}
],
)
u = response.usage
print("cache write:", u.cache_creation_input_tokens)
print("cache read :", u.cache_read_input_tokens)
print("fresh input:", u.input_tokens)
ข้อควรระวัง:
- prefix ต้อง byte-stable
- อย่าใส่ timestamp หรือข้อมูล runtime ไว้ก่อน cache boundary
- ถ้าเปลี่ยน character เดียวก่อนจุด cache อาจทำให้ cache miss
- จัดกลุ่มงานที่เกี่ยวข้องให้รันใกล้กัน เพื่อใช้ cache ที่ยัง warm อยู่
Prompt caching เหมาะมากกับ agent ที่ใช้ system prompt และ repo rules เดิมซ้ำหลายสิบครั้งต่อวัน
ถ้าใช้ Codex หรือ OpenAI models ที่มี cached input discount หลักการคล้ายกัน แม้รายละเอียด implementation ต่างกัน อ่านเสริมได้ที่ การรัน GPT-5.5 ฟรีผ่าน Codex
6. Route งานง่ายไปโมเดลราคาถูก
ไม่ใช่ทุกงานต้องใช้โมเดลหลัก งานเหล่านี้มักใช้โมเดลเล็กได้:
- commit message
- changelog
- summarize diff
- generate boilerplate test
- explain lint error
- rename variable แบบตรงไปตรงมา
ตัวอย่าง:
# งานง่าย ใช้โมเดลถูก
claude --model haiku "write a conventional commit message for the staged diff"
# งานยาก ใช้โมเดลแรง
claude --model sonnet "redesign the caching layer for the payments service"
แนวทางที่ดีคือ default เป็นโมเดลราคาถูก แล้วค่อยยกระดับเมื่อจำเป็น แทนที่จะใช้โมเดลแพงกับทุกอย่าง
ถ้า framework รองรับ sub-agent ให้ใช้โมเดลเล็กกับงานค้นหา/สรุป แล้วส่งผลลัพธ์สั้นๆ กลับให้ parent agent ที่ใช้โมเดลแพง
อ่านรูปแบบ autonomous loop เพิ่มเติมได้ที่ คำสั่ง goal ใน Codex และ Claude Code
การ route ไม่ได้ช่วยแค่ค่าเงิน แต่ยังช่วยยืด quota ในแผนที่มี usage limit ด้วย แม้จะมี การเพิ่มขีดจำกัดรายสัปดาห์ของ Claude Code การใช้โมเดลแพงกับงานเล็กก็ยังเป็นการเผา quota โดยไม่จำเป็น
7. ทำ command output ให้สั้น
Tool output เป็นตัวกินงบแบบเงียบๆ เพราะทุกบรรทัดที่ command print ออกมาอาจถูกส่งกลับเข้า context
เปลี่ยนจาก command ที่ verbose:
npm test
เป็นแบบสั้น:
npm test --silent -- --reporter=dot
ติดตั้ง dependency แบบลด noise:
npm install --silent --no-audit --no-fund
จำกัด test output:
pytest -q 2>&1 | tail -n 30
ดู diff แบบสรุปก่อน:
git diff --stat
กรองเฉพาะ error:
npm test 2>&1 | grep -E "(FAIL|✗|Error)" | head -n 20
ถ้าเอเจนต์ต้อง debug test failure มันมักต้องการแค่:
- test ไหน fail
- error message
- stack trace ส่วนบน
- expected vs actual
ไม่ต้องการ log ทั้งหมด 5,000 บรรทัด
8. ให้เอเจนต์อ่านเฉพาะส่วนที่เกี่ยวข้อง
แทนที่จะให้เอเจนต์อ่านไฟล์ 1,500 บรรทัด ให้สั่งให้ค้นหา symbol ก่อน:
claude "find the function that handles payment retry,
read only that function and nearby tests, then suggest the minimal patch"
หรือใช้ shell ช่วยตัดบริบท:
grep -n "function retryPayment" -n src/payments/retry.ts
sed -n '120,220p' src/payments/retry.ts
ถ้าใช้ ripgrep:
rg "retryPayment|exponentialBackoff|RetryPolicy" src/payments
เป้าหมายคือให้โมเดลเห็น context ขนาด 500–1,000 tokens แทนที่จะเป็นทั้งไฟล์ขนาด 18,000 tokens
9. จำกัด retrieval/RAG
ถ้า agent ใช้ code search หรือ RAG บนเอกสาร ให้จำกัดจำนวน chunk และขนาด chunk
ตัวอย่าง configuration ที่ควรตั้ง:
{
"retrieval": {
"max_chunks": 10,
"chunk_size_tokens": 200,
"include_full_file": false
}
}
หลักการ:
- chunk สั้นแต่ตรงคำถามดีกว่า chunk ยาวจำนวนมาก
- อย่าดึง full file ถ้าไม่จำเป็น
- ให้ ranking เลือกเฉพาะ context ที่เกี่ยวข้องจริง
- log จำนวน retrieved tokens เพื่อวัดผล
คุณจ่ายสำหรับทุก token ที่ดึงมา แม้โมเดลจะไม่ได้ใช้มันตอบก็ตาม
10. วัดต้นทุนต่อการรัน
อย่าดูแค่ bill รายเดือน ให้เก็บต้นทุนต่อ task เช่น:
- daily refactor run
- PR review run
- test-fix run
- API integration run
ถ้าเรียก API เอง ให้เก็บ usage:
u = response.usage
INPUT_RATE = 3.00 / 1_000_000
OUTPUT_RATE = 15.00 / 1_000_000
CACHE_READ = 0.30 / 1_000_000
CACHE_WRITE = 3.75 / 1_000_000
cost = (
u.input_tokens * INPUT_RATE +
u.output_tokens * OUTPUT_RATE +
u.cache_read_input_tokens * CACHE_READ +
u.cache_creation_input_tokens * CACHE_WRITE
)
print(
f"run cost ≈ ${cost:.4f} "
f"(in={u.input_tokens} out={u.output_tokens} "
f"cache_read={u.cache_read_input_tokens})"
)
ถ้าใช้ CLI ให้ใช้วิธีเหล่านี้:
# ตรวจ cost ของ session
claude /cost
หรือแยก API key ตาม project/agent เพื่อดู usage จาก provider console
หรือห่อ command ด้วย script ที่ log ข้อมูลลง CSV:
#!/usr/bin/env bash
TASK="$1"
START=$(date -Iseconds)
claude "$TASK"
END=$(date -Iseconds)
echo "$START,$END,$TASK" >> agent-runs.csv
จากนั้นเทียบต้นทุนก่อน/หลังปรับ:
- ก่อนใช้ prompt caching
- หลังลด
CLAUDE.md - หลังเปลี่ยน test reporter
- หลัง route งานง่ายไปโมเดลถูก
ถ้าตัวเลขไม่ลด แปลว่ากลยุทธ์นั้นอาจไม่ใช่จุดรั่วหลักของคุณ
ตารางเปรียบเทียบกลยุทธ์
| กลยุทธ์ | การประหยัดโทเค็นโดยทั่วไป | ความพยายาม |
|---|---|---|
| จำกัดขอบเขตการทำงาน เช่น ระบุชื่อไฟล์ | 30–60% ของ input ต่อ run | ต่ำ |
| ทำ memory file ให้สั้นและเสถียร | 5–15% ต่อ turn | ต่ำ |
ใช้ /compact หรือ /clear ระหว่างงาน |
40–80% สำหรับ session ยาว | ต่ำ |
| Prompt caching สำหรับ prefix ที่เสถียร | ประมาณ 90% สำหรับส่วนที่ cache | ปานกลาง |
| Route งานง่ายไปโมเดลราคาถูก | 50–80% สำหรับงานย่อยนั้น | ปานกลาง |
| ลด/กรอง tool output | 20–50% สำหรับ run ที่ใช้ tools เยอะ | ต่ำ |
| อ่านเฉพาะส่วนของไฟล์ | 70–95% สำหรับไฟล์ใหญ่ | ต่ำ |
| จำกัด retrieval/RAG | 30–60% สำหรับ agent ที่ใช้ retrieval มาก | ปานกลาง |
| วัดต้นทุนต่อ run | ไม่ลดโดยตรง แต่ทำให้ optimize ได้จริง | ต่ำ |
ตัวเลขเป็นช่วงโดยประมาณ ผลจริงขึ้นอยู่กับ workflow และความสิ้นเปลืองตั้งต้นของแต่ละทีม
Checklist สำหรับนำไปใช้ทันที
เริ่มจากรายการที่ทำครั้งเดียวแล้วได้ผลทุก run:
[ ] ลด CLAUDE.md ให้เหลือเฉพาะ command, rule และ pointer
[ ] เพิ่ม ignore สำหรับ generated files, build output, coverage, dependencies
[ ] เปลี่ยน test command ให้ silent/summary
[ ] ใช้ git diff --stat ก่อน full diff
[ ] สั่ง agent ให้อ่านเฉพาะ function หรือไฟล์ที่ระบุ
[ ] ใช้ /compact เมื่อ session ยาว
[ ] ใช้ /clear เมื่อเปลี่ยนงาน
[ ] ตั้งโมเดลราคาถูกเป็น default สำหรับงานง่าย
[ ] เปิด prompt caching ถ้าเรียก model API เอง
[ ] log token usage หรือต้นทุนต่อ task
บทสรุป
ค่าโทเค็นของ CLI coding agents ลดได้โดยไม่ต้องเปลี่ยนคุณภาพของงาน จุดที่ควรจัดการคือบริบทที่ส่งซ้ำ, output ที่ไม่จำเป็น และการใช้โมเดลแพงกับงานที่ไม่ต้องใช้ reasoning สูง
เริ่มจากสิ่งที่ง่ายที่สุด: scope งานให้แคบ, ทำ command output ให้เงียบ, ลด memory file และ clear session ระหว่างงาน จากนั้นค่อยเพิ่ม prompt caching, model routing และ cost tracking เพื่อให้การประหยัดวัดผลได้จริง
Google I/O 2026 Dev Keynote: Recap
In case you missed it, here’s a recap of what Google announced at I/O today. Some of these are updates, some are brand new. Let’s get into it.
The Antigravity Ecosystem
Antigravity 2.0
Google officially introduced Antigravity 2.0, the next evolution of its AI development platform.
Think of it as a mission control center for AI agents. Instead of just chatting with an AI assistant, Antigravity lets developers orchestrate multiple agents, tools, workflows, and cloud resources in one place. It’s designed for teams and enterprises that want to build agent-powered applications at scale.
For enterprise users, Antigravity connects directly to your Google Cloud project and automatically follows the same security rules, permissions, and policies your organization already uses.
Google is basically trying to turn AI agents into actual coworkers.
Antigravity IDE
Because Antigravity is now an agentic platform, Google needed a separate place for the code editor experience. That’s the Antigravity IDE. It’s basically what the original Antigravity app was.
Honestly, I’m not sure why Google didn’t just make two modes in one app. But okay.
Antigravity CLI
From what Google showed during the keynote, this looks like a revamped replacement for Gemini CLI.
Google didn’t fully explain the differences on stage, but the biggest clue is this:
Google already published a migration guide for moving from Gemini CLI to Antigravity CLI, which strongly suggests Gemini CLI will eventually be deprecated.
If you want to read more about the transition, Google posted the official update here: Google’s migration update for Antigravity CLI
I also don’t know why they make a new product for this. I mean, why not just updating the Gemini CLI?
Android Development Is Getting More Agentic Too
Google also announced several updates focused on Android development.
Android CLI + Android Knowledge Base
Google officially brought Android support into Antigravity through Android CLI — a tool that prepares agents for Android development workflows.
One of its biggest features is the Android Knowledge Base, which acts as a constantly updated source of official Android developer guidance. This allows AI agents to pull the latest best practices, APIs, and documentation while working on your project.
Google also introduced something called Android Skills — open-source skills that help LLMs better understand Android codebases and execute more complex workflows correctly.
Google’s internal team claims this uses 70% fewer tokens and completes tasks 3x faster. Of course, those are Google’s own benchmarks, so we’ll have to wait for real-world testing to see how accurate those numbers are.
Migration Agent — Possibly One of the Coolest Demos
Google gave a preview of Migration Agent — a tool that can migrate your existing app into a native Kotlin Android app. React Native, web framework, or iOS — it doesn’t matter. Still in preview, but the concept is interesting.
Web Updates
Modern Web Guidance
Moving over to web development, Google introduced something called
Modern Web Guidance.
This is basically a collection of AI-ready web development best practices and tooling guidance designed specifically for AI agents.
The goal is simple:
Google wants AI coding agents to stop generating outdated web code.
Modern Web Guidance integrates directly with Baseline so agents can understand which web platform features are actually safe and modern to use across browsers.
This is a pretty big deal because one of the biggest problems with AI-generated frontend code right now is that it often recommends outdated APIs or old patterns.
WebMCP
During the Modern Web Guidance demo, Google also introduced WebMCP.
So… what exactly is it?
According to Google’s developer docs:
“MCP is a proposed web standard to help you build and expose structured tools for AI agents.”
In simpler terms:
WebMCP lets websites explain to AI agents how they should interact with them.
Imagine visiting a complicated dashboard or settings page and instead of manually configuring everything yourself, you could simply tell Gemini:
“Set this up for me.”
And the AI would understand how to navigate and interact with the site properly.
That’s basically the future Google is aiming for.
WebMCP is still experimental for now, and Google announced that the experimental MCP APIs will begin trials in Chrome 149.
HTML-in-Canvas API
Last but definitely not least, Google announced the new HTML-in-Canvas API.
This API allows developers to place real DOM elements directly inside a canvas.
That might sound small, but it actually solves one of the biggest limitations of canvas-based apps:
- accessibility and interactivity.
- Because the elements are real DOM nodes:
- They’re searchable
- Accessible
- Selectable
- Compatible with browser features
- Better for SEO
- Easier to interact with
This could become huge for browser games, design tools, editors, and highly interactive web apps.
That’s everything from the developer keynote. The general direction is clear — Google is going all-in on agents. Antigravity is the center of that story.

