DAILY NEWS

Stay Ahead, Stay Informed – Every Day

Advertisement
Experienced devs are slower with AI tools. Nobody wants to admit it.



A recent study discovered that experienced open-source developers were 19% slower while using AI coding assistants. However, those same developers indicated themselves to believe that they were 20% faster.

Read it and weep: the disconnect between perception and reality is nearing 40 percentage points.

Why This Should Bother You

This wasn’t just any survey. It compared real task completion times with self-reported productivity. And the senior engineers – the ones we trust to make all the big architectural decisions – were certainly, but inaccurately, confident about their speed.

And the industry is building its entire tooling strategy around the opposite assumption.

The Perception Trap

I have a hypothesis to explain this phenomenon. As a senior dev, you have a lot of cognitive load taken up by context-switching costs that you are not aware of.

You prompt the AI. You read the output. You notice it got the abstraction wrong. You fix it. You re-prompt. You read again. You realize it missed an edge case you would have caught on line three. You fix that too.

Every single step appears to be helping. There is less typing on your part. More code on the screen. More dopamine. But wall-clock time, in total? It takes longer to finish the task.

→ AI output creates an illusion of velocity because characters appear fast→ Senior devs spend more time reviewing and correcting than they realize→ The cognitive load of evaluating generated code is real work that doesn’t feel like work

Who Actually Benefits?

This is not meant to be anti-AI. It’s a more nuanced perspective.

AI assistants are genuinely helpful when you are learning a new language or framework. They save you real minutes when you’re writing the boilerplate for the hundredth time. They are a decent starting point when you’re working with an unfamiliar API.

However, if you are familiar with the codebase, already understand the patterns, and can type as fast as you think? The AI is essentially adding an intermediary layer between your brain and the editor. This intermediary has a downside.

The study indicates that for skilled developers, the cost is about 19%. This is almost a full day per week.

The Industry Doesn’t Want to Hear This

A discussion with over 800 comments from experienced developers erupted about these findings. Reactions were polarized, but revealing. A lot of senior engineers acknowledged they had sensed this friction, but had assumed they were an outlier.

They were not the outlier. They were the average.

Meanwhile, every company is mandating AI tool adoption. Each job advertisement includes Copilot. Every engineering blog is publishing “how we 10x’d with AI” stories. The incentive structure punishes anyone who says “actually, this is slowing me down.”

Nobody wants to be the person who looks like they can’t adapt. Hence, everybody agrees and nods along to things. 🤷

What I Think We Should Do

Stop treating AI coding assistants as universally beneficial. Start treating them like any other tool — useful in specific contexts, counterproductive in others.

→ Measure actual output, not vibes→ Let senior engineers opt out without stigma→ Stop conflating “uses AI tools” with “is a modern developer”

The best developers I know are ruthless about removing friction from their workflow. If a tool becomes a hindrance, they eliminate it. We need to allow them to do so.

I have a question for you: Have you ever turned off Copilot or another similar tool and felt quicker than before, but you were too embarrassed to tell your team?



Source link

Building a Terminal AI Agent (v9)


Building AI agents that operate directly in the terminal offers huge productivity gains for developers. In this guide, we will provide hands-on, hands-on instructions on how to build a custom CLI AI agent based on a local LLM. 1. Analysis of CLI AI Agent Ecosystem Currently, there are several solutions in the CLI AI agent market: Key tools: Aider: GitHub Copilot-based, real-time code modification function Continue.dev: VSCode-based, handle complex tasks OpenCode: Open source, simple coding help Custom Scripts: Customize with your own script Current problems: Most tools rely on cloud API Poor performance when running locally Lack of complex tooling features Cost issues 2. Setting up local LLM API endpoint locally To run LLM, follow these steps: 1. Install LM Studio: # macOS brew install lm-studio # or download directly wget https://github.com/lmstudio-ai/LMStudio/releases/latest/download/LMStudio-MacOS.dmg Enter fullscreen mode Exit fullscreen mode 2. Run local model: # Download model and run lm-studio –model “Nous-Hermes-2-Mistral-7B-DPO.Q4_K_M.gguf” Enter fullscreen mode Exit fullscreen mode 3. API server settings: # Install Ollama curl -fsSL https://ollama.com/install.sh | sh # Download model ollama pull mistral # Run API server ollama serve Enter fullscreen mode Exit fullscreen mode 3. Building a simple Python CLI agent Now let’s create a basic CLI agent: # ai_agent.py import os import json import subprocess from typing import Dict, List, Any import openai class TerminalAIAgent: def __init__(self, model=”ollama/mistral”): self.model = model self.client = openai.OpenAI( base_url=”http://localhost:11434/v1″, api_key=”ollama” ) self.conversation_history = () def run_command(self, command: str) -> str: “””Execute the command and return the result””” try: result = subprocess.run( command, shell=True, capture_output=True, text=True, timeout=30 ) return result.stdout + result.stderr except Exception as e: return f”Error: {str(e)}” def get_context(self) -> str: “””Collect current working directory information””” pwd = os.getcwd() files = os.listdir(pwd) return f”Working directory: {pwd}\nFiles: {‘, ‘.join(files(:10))}” def chat(self, user_input: str) -> str: “””Conversation with AI””” self.conversation_history.append({ “role”: “user”, “content”: user_input }) # System prompt system_prompt = “”” You are a helpful AI assistant that helps developers with coding tasks. Your responses should be concise and actionable. You can execute shell commands and modify files. “”” messages = ( {“role”: “system”, “content”: system_prompt}, {“role”: “user”, “content”: f”Context: {self.get_context()}”}, ) + self.conversation_history response = self.client.chat.completions.create( model=self.model, messages=messages, temperature=0.3 ) ai_response = response.choices(0).message.content self.conversation_history.append({ “role”: “assistant”, “content”: ai_response }) return ai_response # Usage if __name__ == “__main__”: agent = TerminalAIAgent() print(“Start AI Agent (type ‘exit’ to exit)”) while True: user_input = input(“\n> “) if user_input.lower() == ‘exit’: break response = agent.chat(user_input) print(response) Enter fullscreen mode Exit fullscreen mode 4. Integrate with tmux Integrate with terminal multiplexers to improve workflow: # Create a tmux session tmux new-session -d -s ai_agent # Run the agent within a session tmux send-keys -t ai_agent “python ai_agent.py” Enter Enter fullscreen mode Exit fullscreen mode tmux script: # tmux_ai.sh #!/bin/bash SESSION=”ai_agent” # Check whether session exists if ! tmux has-session -t $SESSION 2>/dev/null; then tmux new-session -d -s $SESSION tmux send-keys -t $SESSION “python ai_agent.py” Enter fi tmux attach -t $SESSION Enter fullscreen mode Exit fullscreen mode 5. Custom tool development Code search tool: # tools/code_search.py import os import re from typing import List, Dict class CodeSearchTool: def __init__(self, root_dir: str = “.”): self.root_dir = root_dir def search_in_files(self, pattern: str, file_extensions: List(str) = None) -> List(Dict): “””Search for a pattern within a file””” results = () if file_extensions is None: file_extensions = (‘.py’, ‘.js’, ‘.ts’, ‘.java’, ‘.cpp’) for root, dirs, files in os.walk(self.root_dir): for file in files: if any(file.endswith(ext) for ext in file_extensions): file_path = os.path.join(root, file) try: with open(file_path, ‘r’, encoding=’utf-8′) as f: content = f.read() matches = re.finditer(pattern, content) for match in matches: results.append({ ‘file’: file_path, ‘line’: content(:match.start()).count(‘\n’) + 1, ‘context’: self.get_context(content, match.start()) }) except Exception: continue return results def get_context(self, content: str, position: int, context_lines: int = 3) -> str: “””Context Extraction””” lines = content.split(‘\n’) line_num = content(:position).count(‘\n’) start = max(0, line_num – context_lines) end = min(len(lines), line_num + context_lines + 1) return ‘\n’.join(lines(start:end)) # Usage example search_tool = CodeSearchTool() results = search_tool.search_in_files(r”def\s+(\w+)\s*\(“) print(json.dumps(results, indent=2)) Enter fullscreen mode Exit fullscreen mode Git tools: # tools/git_tool.py import subprocess import json from typing import Dict, List class GitTool: def get_status(self) -> Dict: “””Check Git status””” try: result = subprocess.run((‘git’, ‘status’, ‘–porcelain’), capture_output=True, text=True) return { ‘status’: result.stdout.strip(), ‘has_changes’: bool(result.stdout.strip()) } except Exception as e: return {‘error’: str(e)} def get_branch_info(self) -> Dict: “””Branch information””” try: branch = subprocess.run((‘git’, ‘branch’, ‘–show-current’), capture_output=True, text=True).stdout.strip() return {‘branch’: branch} except Exception as e: return {‘error’: str(e)} def commit_changes(self, message: str) -> Dict: “””Commit changes””” try: subprocess.run((‘git’, ‘add’, ‘.’), capture_output=True) result = subprocess.run((‘git’, ‘commit’, ‘-m’, message), capture_output=True, text=True) return { ‘success’: True, ‘output’: result.stdout, ‘error’: result.stderr } except Exception as e: return {‘success’: False, ‘error’: str(e)} # Usage example git_tool = GitTool() status = git_tool.get_status() print(json.dumps(status, indent=2)) Enter fullscreen mode Exit fullscreen mode 6. Context window management Context management for handling large code bases: python # context_manager.py import os import hashlib from typing import List, Dict, Set class ContextManager: def __init__(self, max_tokens: int = 8000): self.max_tokens = max_tokens self.token_cache = {} def calculate_tokens(self, text: str) — 📥 **Get the full guide on Gumroad**: https://gumroad.com/l/auto ($5) Enter fullscreen mode Exit fullscreen mode



Source link

Faithfulness gate: the agent layer most teams skip



A B2B SaaS team got an angry email from a customer last quarter. The customer’s account team had asked the company’s AI assistant whether their plan included SSO. The assistant said yes. The customer’s IT team spent two days trying to configure it, escalated to support, and discovered the assistant had been wrong. SSO was on the Enterprise tier. The customer was on Pro.

The assistant had searched the documentation, found nothing definitive about which tiers included SSO, and produced a fluent answer based on what seemed plausible from training data. The user had no way to know it was a hallucination.

The fix was not “a better model.” A larger LLM would have hallucinated more confidently with the same insufficient context. The fix was a layer that should have been there from day one: a faithfulness gate that checks whether the agent’s response is actually grounded in the retrieved context before shipping it to the user.

This is one of the highest-leverage interventions for production AI agents. Most teams skip it because the failure mode is invisible until a customer complains.

What faithfulness actually measures

Faithfulness is a single question: does the agent’s response make claims that are supported by the context the agent retrieved?

If the agent searched the KB and found “Pro tier includes basic features X, Y, Z. Enterprise tier includes X, Y, Z plus advanced features A, B, C, including SSO,” then a response saying “your Pro plan includes SSO” is unfaithful. The retrieved context does not support that claim.

This is different from “is the response correct.” Correctness requires ground truth. Faithfulness only requires the retrieved context. You can check it without a human in the loop.

The mechanic: extract atomic claims from the response, check each claim against the retrieved context, return a score. Below threshold, the response is unfaithful and should not be shipped.

How the gate actually works

The pattern is straightforward:

Agent generates a response based on retrieved context
A separate LLM call (the “judge”) extracts the atomic claims from the response
For each claim, the judge checks whether the retrieved context supports it
The faithfulness score is the fraction of claims supported
If the score is below threshold (we default to 0.85), the response is rejected
The agent either retries with revised context or returns “I cannot answer this confidently from available information”

Frameworks like Ragas implement this directly. You can also build it yourself with a single LLM call using a structured prompt. The judge model does not need to be the production model. We typically use GPT-4o-mini or Claude Haiku for the judge to keep costs low; they are accurate enough for this task.

Why this catches what model size does not

Bigger models are not less likely to hallucinate. They are more confident hallucinators. Given the same insufficient context, GPT-4o will produce a better-written, more structured, more authoritative-sounding wrong answer than GPT-3.5 ever could.

The faithfulness gate works at a different layer than the model. It does not care how confident the model sounds. It only cares whether the claims in the response can be traced back to the retrieved context.

In the team’s audit, faithfulness gates caught about 40% of the responses that customers had previously reported as wrong. Most of those would not have been caught by switching to a more expensive model.

The threshold question

Where to set the faithfulness threshold is a product decision, not a technical one.

0.95 and above: very strict. Use for legal advice, medical information, financial recommendations, regulatory compliance. The cost is more “I cannot answer” responses, which is the right cost for high-stakes domains.
0.85 to 0.95: production default for B2B SaaS. Catches most confident hallucinations without rejecting legitimate responses that have minor unsupported flourishes.
0.70 to 0.85: more permissive. Use for internal tools where users can self-verify, or for early-stage products where rejecting too many responses kills the UX.
Below 0.70: effectively disabled. Not recommended for customer-facing.

The team we worked with was in B2B SaaS. We set the threshold at 0.88 initially, monitored the rejection rate (about 6% of responses), and tuned to 0.85 after a week when the rejection rate felt too aggressive for the user experience.

What to do when the gate fails

The agent has three options when a response fails the faithfulness check:

Retry with augmented context. The agent searches again with a query informed by the failure. Sometimes the original retrieval was insufficient and a second pass surfaces the missing context. Retry once, max twice. Beyond that, do not loop.

Return “I cannot answer this confidently.” Honest about the limitation. Surfaces a real product problem (insufficient documentation, ambiguous query) that the team can address. Better than a confident wrong answer.

Escalate to human handoff. The agent surfaces the question to a human support agent, with the retrieved context attached. Useful for customer-facing systems where “I don’t know” is not an acceptable terminal state.

Production teams ship all three. Retry first (cheap, often resolves), fallback to honest “I don’t know” (acceptable for low-stakes), escalate for high-stakes or repeat questions.

What we shipped for the team

The original system was a customer support agent with RAG over the documentation. We added:

Faithfulness check on every response, using GPT-4o-mini as the judge model.
Threshold of 0.85 for production responses.
Retry once with augmented retrieval if the first response failed the check.
Honest fallback (“I cannot find that specific information in our documentation. Would you like me to escalate to a human agent?”) for responses that failed twice.
Logging of every failed faithfulness check, so the team can review patterns and improve documentation coverage.

Customer-reported wrong answers dropped 60% in the first month. The faithfulness gate did not improve correctness in the abstract; it just stopped the system from confidently shipping wrong answers to customers. The honest “I don’t know” responses were initially worried about (would users be unhappy?) but turned out to be received well. Users prefer “I don’t know” to wrong answers, even when they think they want fast answers.

The unexpected benefit was the failed-check log. The team now had a list of every question the documentation could not confidently answer. That became the documentation backlog. Six months in, customer-reported issues had dropped 80% from the pre-gate baseline, partly from the gate and partly from the documentation improvements the gate surfaced.

When the gate is not enough

A faithfulness gate prevents one specific failure mode: claims unsupported by retrieved context. It does not catch:

Wrong context retrieved. If the RAG pipeline pulled the wrong document, the response will be faithful to the wrong source. Need eval for this.
Outdated context. Faithful to documentation that was correct six months ago and is now stale. Need versioning and freshness tracking.
Subtly wrong reasoning. Claims supported by context but the inference between them is invalid. Need stronger evaluation, possibly human review.

The gate is necessary but not sufficient for production reliability. It is the highest-leverage single intervention, but it is not the only intervention.

The Sapota recommendation

For production agents that handle factual queries (customer support, internal knowledge, compliance, anything where being wrong has cost):

Add a faithfulness gate on the response path
Use a cheap judge model (GPT-4o-mini, Haiku) to keep costs low
Set threshold at 0.85 to start, tune based on rejection rate
Implement retry-once and honest-fallback policies
Log every failure for documentation improvement

The infrastructure cost is roughly $0.001 per response. The reduction in customer-reported errors is typically 40 to 60% in the first month.

This is not optional for production B2B agents. It is the layer that turns a demo into a product.

If your agent has been confidently wrong

If your team has had customers report incorrect answers from your AI assistant, and “we’ll switch to a better model” has not fixed it, the missing layer is almost certainly faithfulness checking.

Sapota offers a one-week implementation engagement that adds faithfulness checking to your existing agent, calibrates the threshold against your historical reports, and ships the retry and fallback logic as a working PR. We have done this for customer support agents, internal knowledge bases, and compliance tools.

Reach out via the AI engineering page with a few examples of incorrect responses your agent has given. The diagnostic conversation usually surfaces both the faithfulness gap and the documentation gaps that the gate will help expose.



Source link